diff --git a/setup.py b/setup.py index 8f68052..a29397f 100755 --- a/setup.py +++ b/setup.py @@ -232,7 +232,7 @@ setup_requires=["setuptools-git"], extras_require={':"linux" in sys_platform': ["cython"]}, cmdclass=CMDCLASS, # type: ignore - ext_modules=cythonize(PYRFC_EXT, annotate=True, compiler_directives={"language_level": "1"}) # type: ignore + ext_modules=cythonize(PYRFC_EXT, annotate=True) # type: ignore if BUILD_CYTHON else [PYRFC_EXT], # type: ignore test_suite=MODULE_NAME, diff --git a/src/pyrfc/__init__.py b/src/pyrfc/__init__.py index 75f35e1..6caf117 100755 --- a/src/pyrfc/__init__.py +++ b/src/pyrfc/__init__.py @@ -28,13 +28,11 @@ ExternalRuntimeError, ) +from ._utils import py_to_string, string_to_py + try: from ._cyrfc import ( - RfcParameterDirection, - RfcFieldType, get_nwrfclib_version, - py_to_string, - string_to_py, reload_ini_file, set_ini_file_directory, set_cryptolib_path, @@ -43,6 +41,7 @@ language_sap_to_iso, cancel_connection, Connection, + ConnectionParameters, Decimal, Throughput, TypeDescription, @@ -51,7 +50,8 @@ UnitCallType, UnitState, RCStatus, - ConnectionParameters, + RfcParameterDirection, + RfcFieldType ) except ModuleNotFoundError as ex: if "'src.pyrfc._cyrfc'" in ex.msg: diff --git a/src/pyrfc/_cyrfc.cpp b/src/pyrfc/_cyrfc.cpp index 2dc4abf..eb68d81 100644 --- a/src/pyrfc/_cyrfc.cpp +++ b/src/pyrfc/_cyrfc.cpp @@ -1,75 +1,4 @@ -/* Generated by Cython 0.29.34 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "define_macros": [ - [ - "NDEBUG", - null - ], - [ - "_LARGEFILE_SOURCE", - null - ], - [ - "_CONSOLE", - null - ], - [ - "_FILE_OFFSET_BITS", - 64 - ], - [ - "SAPonUNIX", - null - ], - [ - "SAPwithUNICODE", - null - ], - [ - "SAPwithTHREADS", - null - ], - [ - "SAPonLIN", - null - ] - ], - "depends": [], - "extra_compile_args": [ - "-Wall", - "-O2", - "-fexceptions", - "-funsigned-char", - "-fno-strict-aliasing", - "-Wall", - "-Wno-uninitialized", - "-Wno-deprecated-declarations", - "-Wno-unused-function", - "-Wcast-align", - "-fPIC", - "-pthread", - "-minline-all-stringops", - "-I/usr/local/sap/nwrfcsdk/include" - ], - "extra_link_args": [ - "-L/usr/local/sap/nwrfcsdk/lib" - ], - "language": "c++", - "libraries": [ - "sapnwrfc", - "sapucum" - ], - "name": "pyrfc._cyrfc", - "sources": [ - "src/pyrfc/_cyrfc.pyx" - ] - }, - "module_name": "pyrfc._cyrfc" -} -END: Cython Metadata */ +/* Generated by Cython 0.29.33 */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN @@ -80,8 +9,8 @@ END: Cython Metadata */ #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_34" -#define CYTHON_HEX_VERSION 0x001D22F0 +#define CYTHON_ABI "0_29_33" +#define CYTHON_HEX_VERSION 0x001D21F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -274,7 +203,7 @@ END: Cython Metadata */ #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5) + #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 @@ -313,7 +242,7 @@ END: Cython Metadata */ #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) #endif #if PY_VERSION_HEX >= 0x030B00A4 #undef CYTHON_USE_EXC_INFO_STACK @@ -1039,14 +968,8 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "src/pyrfc/nwrfcsdk.pyx", - "src/pyrfc/throughput.pyx", - "src/pyrfc/client.pyx", - "stringsource", - "src/pyrfc/data_container.pyx", - "src/pyrfc/server.pyx", "src/pyrfc/_cyrfc.pyx", - "src/pyrfc/config.pyx", + "stringsource", }; /* NoFastGil.proto */ #define __Pyx_PyGILState_Ensure PyGILState_Ensure @@ -1067,14 +990,10 @@ struct __pyx_obj_5pyrfc_6_cyrfc_Connection; struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection; struct __pyx_obj_5pyrfc_6_cyrfc_Server; struct __pyx_obj_5pyrfc_6_cyrfc_Throughput; -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names; -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr; -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values; -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr; struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py; struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString; -/* "src/pyrfc/data_container.pyx":707 +/* "pyrfc/_cyrfc.pyx":3073 * ) * * cdef wrapString(const SAP_UC* uc, uclen=-1, rstrip=False): # <<<<<<<<<<<<<< @@ -1087,7 +1006,7 @@ struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString { PyObject *rstrip; }; -/* "src/pyrfc/nwrfcsdk.pyx":190 +/* "pyrfc/_cyrfc.pyx":274 * * * cdef class ConnectionParameters: # <<<<<<<<<<<<<< @@ -1101,8 +1020,8 @@ struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters { }; -/* "src/pyrfc/client.pyx":25 - * ################################################################################ +/* "pyrfc/_cyrfc.pyx":498 + * * * cdef class Connection: # <<<<<<<<<<<<<< * """ A connection to an SAP backend system @@ -1122,7 +1041,7 @@ struct __pyx_obj_5pyrfc_6_cyrfc_Connection { }; -/* "src/pyrfc/server.pyx":32 +/* "pyrfc/_cyrfc.pyx":1512 * * * cdef class ServerConnection: # <<<<<<<<<<<<<< @@ -1139,7 +1058,7 @@ struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection { }; -/* "src/pyrfc/server.pyx":243 +/* "pyrfc/_cyrfc.pyx":1723 * * * cdef class Server: # <<<<<<<<<<<<<< @@ -1157,7 +1076,7 @@ struct __pyx_obj_5pyrfc_6_cyrfc_Server { }; -/* "src/pyrfc/throughput.pyx":6 +/* "pyrfc/_cyrfc.pyx":2172 * ################################################################################ * * cdef class Throughput: # <<<<<<<<<<<<<< @@ -1172,60 +1091,6 @@ struct __pyx_obj_5pyrfc_6_cyrfc_Throughput { }; -/* "src/pyrfc/nwrfcsdk.pyx":169 - * - * - * def enum_names(enum_obj): # <<<<<<<<<<<<<< - * return set(e.name for e in enum_obj) - * - */ -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names { - PyObject_HEAD - PyObject *__pyx_v_enum_obj; -}; - - -/* "src/pyrfc/nwrfcsdk.pyx":170 - * - * def enum_names(enum_obj): - * return set(e.name for e in enum_obj) # <<<<<<<<<<<<<< - * - * - */ -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr { - PyObject_HEAD - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *__pyx_outer_scope; - PyObject *__pyx_v_e; -}; - - -/* "src/pyrfc/nwrfcsdk.pyx":173 - * - * - * def enum_values(enum_obj): # <<<<<<<<<<<<<< - * return set(e.value for e in enum_obj) - * - */ -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values { - PyObject_HEAD - PyObject *__pyx_v_enum_obj; -}; - - -/* "src/pyrfc/nwrfcsdk.pyx":174 - * - * def enum_values(enum_obj): - * return set(e.value for e in enum_obj) # <<<<<<<<<<<<<< - * - * - */ -struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr { - PyObject_HEAD - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *__pyx_outer_scope; - PyObject *__pyx_v_e; -}; - - /* "cfunc.to_py":64 * * @cname("__Pyx_CFunc_object____object___to_py") @@ -1240,8 +1105,8 @@ struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py { -/* "src/pyrfc/client.pyx":25 - * ################################################################################ +/* "pyrfc/_cyrfc.pyx":498 + * * * cdef class Connection: # <<<<<<<<<<<<<< * """ A connection to an SAP backend system @@ -1256,7 +1121,7 @@ struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection { static struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *__pyx_vtabptr_5pyrfc_6_cyrfc_Connection; -/* "src/pyrfc/server.pyx":32 +/* "pyrfc/_cyrfc.pyx":1512 * * * cdef class ServerConnection: # <<<<<<<<<<<<<< @@ -1271,7 +1136,7 @@ struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection { static struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *__pyx_vtabptr_5pyrfc_6_cyrfc_ServerConnection; -/* "src/pyrfc/server.pyx":243 +/* "pyrfc/_cyrfc.pyx":1723 * * * cdef class Server: # <<<<<<<<<<<<<< @@ -1290,7 +1155,7 @@ struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Server { static struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Server *__pyx_vtabptr_5pyrfc_6_cyrfc_Server; -/* "src/pyrfc/throughput.pyx":6 +/* "pyrfc/_cyrfc.pyx":2172 * ################################################################################ * * cdef class Throughput: # <<<<<<<<<<<<<< @@ -1552,9 +1417,6 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); - /* KeywordStringCheck.proto */ static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); @@ -1676,6 +1538,84 @@ static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, /* CIntToPyUnicode.proto */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char); +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* StrEquals.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* 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) + +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); +#else +#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ + (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) +#endif + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_RFC_UNIT_STATE(RFC_UNIT_STATE value, Py_ssize_t width, char padding_char, char format_char); + +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); + /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ @@ -1698,24 +1638,23 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* ReRaiseException.proto */ -static CYTHON_INLINE void __Pyx_ReraiseException(void); +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif +/* CIntToPyUnicode.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_RFC_RC(RFC_RC value, Py_ssize_t width, char padding_char, char format_char); + +/* MergeKeywords.proto */ +static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping); /* PyErrExceptionMatches.proto */ #if CYTHON_FAST_THREAD_STATE @@ -1725,34 +1664,34 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif +/* None.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +/* SetItemInt.proto */ +#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +/* CallableCheck.proto */ +#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyCallable_Check(obj) (Py_TYPE(obj)->tp_call != NULL) #else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) #endif -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); +/* 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); -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif +/* ReRaiseException.proto */ +static CYTHON_INLINE void __Pyx_ReraiseException(void); /* StringJoin.proto */ #if PY_MAJOR_VERSION < 3 @@ -1779,12 +1718,6 @@ static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); #define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) #endif -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - /* PyDictContains.proto */ static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { int result = PyDict_Contains(dict, item); @@ -1819,27 +1752,9 @@ static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction * #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - /* PyIntCompare.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - /* decode_c_string_utf16.proto */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; @@ -1860,59 +1775,6 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); -/* 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) - -/* CIntToPyUnicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_RFC_UNIT_STATE(RFC_UNIT_STATE value, Py_ssize_t width, char padding_char, char format_char); - -/* CIntToPyUnicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); - -/* ObjectGetItem.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); -#else -#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) -#endif - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* CIntToPyUnicode.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_RFC_RC(RFC_RC value, Py_ssize_t width, char padding_char, char format_char); - -/* MergeKeywords.proto */ -static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping); - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* CallableCheck.proto */ -#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyCallable_Check(obj) (Py_TYPE(obj)->tp_call != NULL) -#else -#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) -#endif - -/* 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); - /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); @@ -2087,52 +1949,52 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_ERROR_GROUP(RFC_ERROR_GROUP value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* CIntFromPy.proto */ -static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE RFC_RC __Pyx_PyInt_As_RFC_RC(PyObject *); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_RAW(SAP_RAW value); +/* CIntFromPy.proto */ +static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT(RFC_INT value); +/* CIntFromPy.proto */ +static CYTHON_INLINE RFC_DIRECTION __Pyx_PyInt_As_RFC_DIRECTION(PyObject *); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT2(RFC_INT2 value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_ULLONG(SAP_ULLONG value); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT8(RFC_INT8 value); +/* CIntFromPy.proto */ +static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_ERROR_GROUP(RFC_ERROR_GROUP value); /* CIntFromPy.proto */ -static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *); +static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_RAW(SAP_RAW value); -/* CIntFromPy.proto */ -static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT(RFC_INT value); -/* CIntFromPy.proto */ -static CYTHON_INLINE RFC_DIRECTION __Pyx_PyInt_As_RFC_DIRECTION(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT2(RFC_INT2 value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_ULLONG(SAP_ULLONG value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT8(RFC_INT8 value); /* PrintOne.proto */ static int __Pyx_PrintOne(PyObject* stream, PyObject *o); @@ -2140,82 +2002,6 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); -/* CoroutineBase.proto */ -typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *); -#if CYTHON_USE_EXC_INFO_STACK -#define __Pyx_ExcInfoStruct _PyErr_StackItem -#else -typedef struct { - PyObject *exc_type; - PyObject *exc_value; - PyObject *exc_traceback; -} __Pyx_ExcInfoStruct; -#endif -typedef struct { - PyObject_HEAD - __pyx_coroutine_body_t body; - PyObject *closure; - __Pyx_ExcInfoStruct gi_exc_state; - PyObject *gi_weakreflist; - PyObject *classobj; - PyObject *yieldfrom; - PyObject *gi_name; - PyObject *gi_qualname; - PyObject *gi_modulename; - PyObject *gi_code; - PyObject *gi_frame; - int resume_label; - char is_running; -} __pyx_CoroutineObject; -static __pyx_CoroutineObject *__Pyx__Coroutine_New( - PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, - PyObject *name, PyObject *qualname, PyObject *module_name); -static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( - __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, - PyObject *name, PyObject *qualname, PyObject *module_name); -static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); -static int __Pyx_Coroutine_clear(PyObject *self); -static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); -static PyObject *__Pyx_Coroutine_Close(PyObject *self); -static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); -#if CYTHON_USE_EXC_INFO_STACK -#define __Pyx_Coroutine_SwapException(self) -#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) -#else -#define __Pyx_Coroutine_SwapException(self) {\ - __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ - __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ - } -#define __Pyx_Coroutine_ResetAndClearException(self) {\ - __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ - (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ - } -#endif -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ - __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) -#else -#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ - __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) -#endif -static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); -static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); - -/* PatchModuleWithCoroutine.proto */ -static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); - -/* PatchGeneratorABC.proto */ -static int __Pyx_patch_abc(void); - -/* Generator.proto */ -#define __Pyx_Generator_USED -static PyTypeObject *__pyx_GeneratorType = 0; -#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) -#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ - __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name) -static PyObject *__Pyx_Generator_Next(PyObject *self); -static int __pyx_Generator_init(void); - /* CStringEquals.proto */ static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); @@ -2252,12 +2038,13 @@ static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc_Connection = 0; static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc_ServerConnection = 0; static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc_Server = 0; static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc_Throughput = 0; -static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names = 0; -static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr = 0; -static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values = 0; -static PyTypeObject *__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr = 0; static PyTypeObject *__pyx_ptype___pyx_scope_struct____Pyx_CFunc_object____object___to_py = 0; static PyObject *__pyx_f_5pyrfc_6_cyrfc__cancel_connection(PyObject *); /*proto*/ +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_metadataLookup(SAP_UC const *, RFC_ATTRIBUTES, RFC_FUNCTION_DESC_HANDLE *); /*proto*/ +static PyObject *__pyx_f_5pyrfc_6_cyrfc_get_server_context(RFC_CONNECTION_HANDLE, RFC_ERROR_INFO *); /*proto*/ +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_genericHandler(RFC_CONNECTION_HANDLE, RFC_FUNCTION_HANDLE, RFC_ERROR_INFO *); /*proto*/ +static RFC_TYPE_DESC_HANDLE __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(PyObject *); /*proto*/ +static RFC_UNIT_IDENTIFIER __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(PyObject *); /*proto*/ static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE, RFC_FUNCTION_HANDLE, PyObject *, PyObject *); /*proto*/ static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillStructureField(RFC_TYPE_DESC_HANDLE, RFC_STRUCTURE_HANDLE, PyObject *, PyObject *); /*proto*/ static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillTable(RFC_TYPE_DESC_HANDLE, RFC_TABLE_HANDLE, PyObject *); /*proto*/ @@ -2276,11 +2063,6 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapTable(RFC_TYPE_DESC_HANDLE, RFC_TABL static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapVariable(RFCTYPE, RFC_FUNCTION_HANDLE, SAP_UC *, unsigned int, RFC_TYPE_DESC_HANDLE, PyObject *); /*proto*/ static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapError(RFC_ERROR_INFO *); /*proto*/ static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapString(SAP_UC const *, struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString *__pyx_optional_args); /*proto*/ -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_metadataLookup(SAP_UC const *, RFC_ATTRIBUTES, RFC_FUNCTION_DESC_HANDLE *); /*proto*/ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_get_server_context(RFC_CONNECTION_HANDLE, RFC_ERROR_INFO *); /*proto*/ -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_genericHandler(RFC_CONNECTION_HANDLE, RFC_FUNCTION_HANDLE, RFC_ERROR_INFO *); /*proto*/ -static RFC_TYPE_DESC_HANDLE __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(PyObject *); /*proto*/ -static RFC_UNIT_IDENTIFIER __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(PyObject *); /*proto*/ static PyObject *__Pyx_CFunc_object____object___to_py(PyObject *(*)(PyObject *)); /*proto*/ #define __Pyx_MODULE_NAME "pyrfc._cyrfc" extern int __pyx_module_is_main_pyrfc___cyrfc; @@ -2302,16 +2084,16 @@ static const char __pyx_k__3[] = "/"; static const char __pyx_k__4[] = ")>"; static const char __pyx_k__5[] = ""; static const char __pyx_k__6[] = "'"; -static const char __pyx_k__8[] = "."; static const char __pyx_k_id[] = "id"; static const char __pyx_k_rc[] = "rc"; static const char __pyx_k_TID[] = "TID "; static const char __pyx_k_UTC[] = " UTC] "; -static const char __pyx_k__20[] = "\000"; -static const char __pyx_k__35[] = "["; -static const char __pyx_k__36[] = " '"; -static const char __pyx_k__39[] = "'."; -static const char __pyx_k__40[] = ")."; +static const char __pyx_k__20[] = "."; +static const char __pyx_k__23[] = "["; +static const char __pyx_k__24[] = " '"; +static const char __pyx_k__27[] = "'."; +static const char __pyx_k__28[] = ")."; +static const char __pyx_k__45[] = "\000"; static const char __pyx_k__50[] = "*"; static const char __pyx_k_add[] = "add"; static const char __pyx_k_day[] = "day"; @@ -2320,7 +2102,6 @@ static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_end[] = "end"; static const char __pyx_k_get[] = "get"; static const char __pyx_k_key[] = "key"; -static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_rel[] = "rel"; static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_Enum[] = "Enum"; @@ -2344,7 +2125,6 @@ static const char __pyx_k_open[] = "open"; static const char __pyx_k_port[] = "port"; static const char __pyx_k_repr[] = "__repr__"; static const char __pyx_k_self[] = "self"; -static const char __pyx_k_send[] = "send"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_time[] = "time"; @@ -2364,10 +2144,8 @@ static const char __pyx_k_clear[] = "clear"; static const char __pyx_k_close[] = "_close"; static const char __pyx_k_debug[] = "debug"; static const char __pyx_k_dtime[] = "dtime"; -static const char __pyx_k_dumps[] = "dumps"; static const char __pyx_k_field[] = "field '"; static const char __pyx_k_items[] = "items"; -static const char __pyx_k_loads[] = "loads"; static const char __pyx_k_major[] = "major"; static const char __pyx_k_minor[] = "minor"; static const char __pyx_k_month[] = "month"; @@ -2378,9 +2156,9 @@ static const char __pyx_k_start[] = "start"; static const char __pyx_k_state[] = "state"; static const char __pyx_k_sysId[] = "sysId"; static const char __pyx_k_sysid[] = "sysid"; -static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_trace[] = "trace"; static const char __pyx_k_upper[] = "upper"; +static const char __pyx_k_utils[] = "_utils"; static const char __pyx_k_value[] = "value"; static const char __pyx_k_Server[] = "Server"; static const char __pyx_k_Thread[] = "Thread"; @@ -2407,10 +2185,8 @@ static const char __pyx_k_msg_v3[] = "msg_v3"; static const char __pyx_k_msg_v4[] = "msg_v4"; static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_object[] = "object"; -static const char __pyx_k_objstr[] = "objstr"; static const char __pyx_k_origin[] = "origin"; static const char __pyx_k_params[] = " params>"; -static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_queued[] = "queued"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_remove[] = "remove"; @@ -2429,7 +2205,6 @@ static const char __pyx_k_confirm[] = "confirm"; static const char __pyx_k_created[] = "created"; static const char __pyx_k_decimal[] = "decimal"; static const char __pyx_k_destroy[] = "destroy"; -static const char __pyx_k_genexpr[] = "genexpr"; static const char __pyx_k_isdigit[] = "isdigit"; static const char __pyx_k_message[] = "message"; static const char __pyx_k_of_type[] = "of type"; @@ -2449,7 +2224,6 @@ static const char __pyx_k_callback[] = "callback"; static const char __pyx_k_codepage[] = "codepage"; static const char __pyx_k_datetime[] = "datetime"; static const char __pyx_k_decimals[] = "decimals"; -static const char __pyx_k_enum_obj[] = "enum_obj"; static const char __pyx_k_exc_info[] = "exc_info"; static const char __pyx_k_executed[] = "executed"; static const char __pyx_k_getState[] = "getState"; @@ -2579,14 +2353,12 @@ static const char __pyx_k_destroy_unit[] = "_destroy_unit"; static const char __pyx_k_kernel_trace[] = "kernel_trace"; static const char __pyx_k_must_be_in_2[] = "' must be in '"; static const char __pyx_k_protocolType[] = "protocolType"; -static const char __pyx_k_py_to_string[] = "py_to_string"; static const char __pyx_k_pyrfc__cyrfc[] = "pyrfc._cyrfc"; static const char __pyx_k_sapnwrfc_ini[] = "sapnwrfc.ini"; static const char __pyx_k_sending_date[] = "sending_date"; static const char __pyx_k_sending_time[] = "sending_time"; static const char __pyx_k_server_log_2[] = "server_log"; static const char __pyx_k_staticmethod[] = "staticmethod"; -static const char __pyx_k_string_to_py[] = "string_to_py"; static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_unit_history[] = "unit_history"; static const char __pyx_k_RFCTYPE_DTDAY[] = "RFCTYPE_DTDAY"; @@ -2641,7 +2413,6 @@ static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_unit_attributes[] = "unit_attributes"; static const char __pyx_k_unit_identifier[] = "unit_identifier"; static const char __pyx_k_ABAPRuntimeError[] = "ABAPRuntimeError"; -static const char __pyx_k_HIGHEST_PROTOCOL[] = "HIGHEST_PROTOCOL"; static const char __pyx_k_ServerConnection[] = "ServerConnection"; static const char __pyx_k_currentBusyCount[] = "currentBusyCount"; static const char __pyx_k_direction_string[] = "'direction' (string) '"; @@ -2688,7 +2459,7 @@ static const char __pyx_k_RFC_EXTERNAL_FAILURE[] = "RFC_EXTERNAL_FAILURE"; static const char __pyx_k_default_value_string[] = "'default_value' (string) '"; static const char __pyx_k_get_nwrfclib_version[] = "get_nwrfclib_version"; static const char __pyx_k_return_import_params[] = "return_import_params"; -static const char __pyx_k_src_pyrfc_server_pyx[] = "src/pyrfc/server.pyx"; +static const char __pyx_k_src_pyrfc__cyrfc_pyx[] = "src/pyrfc/_cyrfc.pyx"; static const char __pyx_k_FunctionDescription_2[] = "FunctionDescription"; static const char __pyx_k_RfcParameterDirection[] = "RfcParameterDirection"; static const char __pyx_k_connection_attributes[] = "connection_attributes"; @@ -2700,7 +2471,6 @@ static const char __pyx_k_TypeDescription___repr[] = "TypeDescription.__repr__"; static const char __pyx_k_create_and_submit_unit[] = "_create_and_submit_unit"; static const char __pyx_k_install_bgrfc_handlers[] = "install_bgrfc_handlers"; static const char __pyx_k_set_ini_file_directory[] = "set_ini_file_directory"; -static const char __pyx_k_src_pyrfc_nwrfcsdk_pyx[] = "src/pyrfc/nwrfcsdk.pyx"; static const char __pyx_k_Connection_was_canceled[] = "Connection was canceled: "; static const char __pyx_k_No_connections_assigned[] = "No connections assigned"; static const char __pyx_k_Not_a_valid_error_group[] = "Not a valid error group."; @@ -2710,18 +2480,15 @@ static const char __pyx_k_raises_ABAPRuntimeError[] = "' raises ABAPRuntimeError static const char __pyx_k_Crypto_library_not_found[] = "Crypto library not found:"; static const char __pyx_k_ExternalApplicationError[] = "ExternalApplicationError"; static const char __pyx_k_must_not_exceed_30_chars[] = "' must not exceed 30 chars."; -static const char __pyx_k_src_pyrfc_throughput_pyx[] = "src/pyrfc/throughput.pyx"; static const char __pyx_k_Invalid_connection_handle[] = "Invalid connection handle."; static const char __pyx_k_MASK_RETURN_IMPORT_PARAMS[] = "_MASK_RETURN_IMPORT_PARAMS"; static const char __pyx_k_Server_function_installed[] = "Server function installed"; static const char __pyx_k_TypeDescription_add_field[] = "TypeDescription.add_field"; -static const char __pyx_k_enum_names_locals_genexpr[] = "enum_names..genexpr"; static const char __pyx_k_sapnwrfc_ini_not_found_in[] = "sapnwrfc.ini not found in:"; static const char __pyx_k_should_be_from_1_30_chars[] = "' should be from 1-30 chars."; static const char __pyx_k_ExternalAuthorizationError[] = "ExternalAuthorizationError"; static const char __pyx_k_FunctionDescription___init[] = "FunctionDescription.__init__"; static const char __pyx_k_FunctionDescription___repr[] = "FunctionDescription.__repr__"; -static const char __pyx_k_enum_values_locals_genexpr[] = "enum_values..genexpr"; static const char __pyx_k_raises_ABAPApplicationError[] = "' raises ABAPApplicationError "; static const char __pyx_k_raises_ExternalRuntimeError[] = "' raises ExternalRuntimeError "; static const char __pyx_k_should_be_from_1_30_chars_2[] = " should be from 1-30 chars."; @@ -2828,7 +2595,6 @@ static PyObject *__pyx_n_s_FunctionDescription_2; static PyObject *__pyx_n_s_FunctionDescription___init; static PyObject *__pyx_n_s_FunctionDescription___repr; static PyObject *__pyx_n_s_FunctionDescription_add_paramete; -static PyObject *__pyx_n_s_HIGHEST_PROTOCOL; static PyObject *__pyx_kp_s_H_M_S; static PyObject *__pyx_kp_s_Invalid_connection_handle; static PyObject *__pyx_kp_s_Invalid_exception_raised_by_call; @@ -2926,17 +2692,17 @@ static PyObject *__pyx_kp_s_User_user_from_system_sysId_clie; static PyObject *__pyx_kp_u_Values; static PyObject *__pyx_kp_s_Y_m_d; static PyObject *__pyx_kp_s__20; +static PyObject *__pyx_kp_u__20; +static PyObject *__pyx_kp_u__23; +static PyObject *__pyx_kp_u__24; +static PyObject *__pyx_kp_u__27; +static PyObject *__pyx_kp_u__28; static PyObject *__pyx_kp_u__3; -static PyObject *__pyx_kp_u__35; -static PyObject *__pyx_kp_u__36; -static PyObject *__pyx_kp_u__39; static PyObject *__pyx_kp_u__4; -static PyObject *__pyx_kp_u__40; +static PyObject *__pyx_kp_s__45; static PyObject *__pyx_kp_s__5; static PyObject *__pyx_n_s__50; static PyObject *__pyx_kp_u__6; -static PyObject *__pyx_kp_s__8; -static PyObject *__pyx_kp_u__8; static PyObject *__pyx_kp_s_a_decimal_value_required_receive; static PyObject *__pyx_kp_s_a_numeric_string_is_required_rec; static PyObject *__pyx_n_s_active_unit; @@ -3019,15 +2785,11 @@ static PyObject *__pyx_n_s_direction; static PyObject *__pyx_kp_u_direction_string; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_dtime; -static PyObject *__pyx_n_s_dumps; static PyObject *__pyx_n_s_encode; static PyObject *__pyx_n_s_end; static PyObject *__pyx_n_s_enum; static PyObject *__pyx_n_s_enum_names; -static PyObject *__pyx_n_s_enum_names_locals_genexpr; -static PyObject *__pyx_n_s_enum_obj; static PyObject *__pyx_n_s_enum_values; -static PyObject *__pyx_n_s_enum_values_locals_genexpr; static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_errorInfo; static PyObject *__pyx_n_s_exc_info; @@ -3047,7 +2809,6 @@ static PyObject *__pyx_n_s_func_desc_handle; static PyObject *__pyx_n_s_func_name; static PyObject *__pyx_n_s_function_name; static PyObject *__pyx_n_s_genericHandler; -static PyObject *__pyx_n_s_genexpr; static PyObject *__pyx_n_s_get; static PyObject *__pyx_n_s_getFromConnection; static PyObject *__pyx_n_s_getState; @@ -3095,7 +2856,6 @@ static PyObject *__pyx_n_s_language_sap_to_iso; static PyObject *__pyx_kp_u_launched; static PyObject *__pyx_kp_u_length; static PyObject *__pyx_kp_s_list_required_for_table_paramete; -static PyObject *__pyx_n_s_loads; static PyObject *__pyx_n_s_locale; static PyObject *__pyx_n_s_localeconv; static PyObject *__pyx_n_s_lock; @@ -3130,9 +2890,7 @@ static PyObject *__pyx_n_s_not_requested; static PyObject *__pyx_n_s_nuc_length; static PyObject *__pyx_n_s_nuc_offset; static PyObject *__pyx_n_s_numberOfCalls; -static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_object; -static PyObject *__pyx_n_s_objstr; static PyObject *__pyx_kp_s_of_type; static PyObject *__pyx_n_s_open; static PyObject *__pyx_n_s_optional; @@ -3159,7 +2917,6 @@ static PyObject *__pyx_n_s_patchlevel; static PyObject *__pyx_n_s_pathName; static PyObject *__pyx_n_s_path_name; static PyObject *__pyx_n_s_peakBusyCount; -static PyObject *__pyx_n_s_pickle; static PyObject *__pyx_n_s_platform; static PyObject *__pyx_n_s_port; static PyObject *__pyx_n_s_prepare; @@ -3167,7 +2924,6 @@ static PyObject *__pyx_n_s_print; static PyObject *__pyx_n_s_progName; static PyObject *__pyx_n_s_program; static PyObject *__pyx_n_s_protocolType; -static PyObject *__pyx_n_s_py_to_string; static PyObject *__pyx_n_s_pyrfc__cyrfc; static PyObject *__pyx_n_s_pyx_vtable; static PyObject *__pyx_n_s_qualname; @@ -3208,7 +2964,6 @@ static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_self__handle_cannot_be_converted; static PyObject *__pyx_kp_s_self__handle_self__tHandle_self; static PyObject *__pyx_kp_s_self__throughput_handle_cannot_b; -static PyObject *__pyx_n_s_send; static PyObject *__pyx_n_s_sending_date; static PyObject *__pyx_n_s_sending_time; static PyObject *__pyx_n_s_sentBytes; @@ -3230,14 +2985,11 @@ static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_kp_u_should_be_from_1_30_chars; static PyObject *__pyx_kp_u_should_be_from_1_30_chars_2; static PyObject *__pyx_n_s_socket; -static PyObject *__pyx_kp_s_src_pyrfc_nwrfcsdk_pyx; -static PyObject *__pyx_kp_s_src_pyrfc_server_pyx; -static PyObject *__pyx_kp_s_src_pyrfc_throughput_pyx; +static PyObject *__pyx_kp_s_src_pyrfc__cyrfc_pyx; static PyObject *__pyx_n_s_start; static PyObject *__pyx_n_s_state; static PyObject *__pyx_n_s_staticmethod; static PyObject *__pyx_n_s_stop; -static PyObject *__pyx_n_s_string_to_py; static PyObject *__pyx_kp_s_stringsource; static PyObject *__pyx_n_s_strptime; static PyObject *__pyx_n_s_synchronous; @@ -3251,7 +3003,6 @@ static PyObject *__pyx_n_s_target; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_threading; static PyObject *__pyx_n_s_throughput; -static PyObject *__pyx_n_s_throw; static PyObject *__pyx_n_s_time; static PyObject *__pyx_kp_s_time_value_required_received; static PyObject *__pyx_n_s_timeout; @@ -3276,6 +3027,7 @@ static PyObject *__pyx_n_s_update; static PyObject *__pyx_n_s_upper; static PyObject *__pyx_n_s_user; static PyObject *__pyx_n_s_utcnow; +static PyObject *__pyx_n_s_utils; static PyObject *__pyx_n_s_value; static PyObject *__pyx_kp_u_when_getting_server_context_for; static PyObject *__pyx_kp_u_with; @@ -3290,12 +3042,6 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_path_name); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_12set_locale_radix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_14cancel_connection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_client_connection); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10enum_names_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16enum_names(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_enum_obj); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_11enum_values_genexpr(PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_18enum_values(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_enum_obj); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20py_to_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_22string_to_py(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_objstr); /* proto */ static int __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters___cinit__(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self, PyObject *__pyx_v_params); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_2__del__(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self); /* proto */ @@ -3350,8 +3096,8 @@ static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_2__set__(struct __pyx_ static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_4__del__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_68__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_70__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_24default_auth_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_request_context); /* proto */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_26_server_log(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_origin, PyObject *__pyx_v_log_message); /* proto */ +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16default_auth_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_request_context); /* proto */ +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_18_server_log(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_origin, PyObject *__pyx_v_log_message); /* proto */ static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection___init__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, PyObject *__pyx_v_params); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_2open(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_4close(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self); /* proto */ @@ -3400,10 +3146,6 @@ static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc_Connection(PyTypeObject *t, PyObjec static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc_ServerConnection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc_Server(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc_Throughput(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new___pyx_scope_struct____Pyx_CFunc_object____object___to_py(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; static PyObject *__pyx_int_0; @@ -3429,42 +3171,42 @@ static PyObject *__pyx_int_512; static PyObject *__pyx_int_8080; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_tuple_; -static PyObject *__pyx_slice__9; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__7; -static PyObject *__pyx_slice__10; -static PyObject *__pyx_slice__11; +static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; static PyObject *__pyx_slice__12; static PyObject *__pyx_slice__13; static PyObject *__pyx_slice__14; static PyObject *__pyx_slice__15; -static PyObject *__pyx_slice__16; -static PyObject *__pyx_slice__17; -static PyObject *__pyx_slice__18; -static PyObject *__pyx_slice__19; -static PyObject *__pyx_slice__21; -static PyObject *__pyx_slice__22; -static PyObject *__pyx_slice__27; -static PyObject *__pyx_slice__28; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__24; +static PyObject *__pyx_slice__29; +static PyObject *__pyx_slice__37; +static PyObject *__pyx_slice__38; +static PyObject *__pyx_slice__39; +static PyObject *__pyx_slice__40; +static PyObject *__pyx_slice__41; +static PyObject *__pyx_slice__42; +static PyObject *__pyx_slice__43; +static PyObject *__pyx_slice__44; +static PyObject *__pyx_slice__46; +static PyObject *__pyx_slice__47; +static PyObject *__pyx_tuple__10; +static PyObject *__pyx_tuple__11; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__30; static PyObject *__pyx_tuple__31; static PyObject *__pyx_tuple__32; static PyObject *__pyx_tuple__33; static PyObject *__pyx_tuple__34; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__38; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__47; +static PyObject *__pyx_tuple__35; +static PyObject *__pyx_tuple__36; static PyObject *__pyx_tuple__48; static PyObject *__pyx_tuple__51; static PyObject *__pyx_tuple__53; @@ -3475,8 +3217,9 @@ static PyObject *__pyx_tuple__61; static PyObject *__pyx_tuple__63; static PyObject *__pyx_tuple__65; static PyObject *__pyx_tuple__67; -static PyObject *__pyx_tuple__69; -static PyObject *__pyx_tuple__71; +static PyObject *__pyx_tuple__68; +static PyObject *__pyx_tuple__70; +static PyObject *__pyx_tuple__72; static PyObject *__pyx_tuple__73; static PyObject *__pyx_tuple__75; static PyObject *__pyx_tuple__76; @@ -3484,13 +3227,8 @@ static PyObject *__pyx_tuple__78; static PyObject *__pyx_tuple__80; static PyObject *__pyx_tuple__81; static PyObject *__pyx_tuple__83; -static PyObject *__pyx_tuple__84; -static PyObject *__pyx_tuple__86; -static PyObject *__pyx_tuple__88; -static PyObject *__pyx_tuple__89; -static PyObject *__pyx_tuple__91; -static PyObject *__pyx_tuple__93; -static PyObject *__pyx_tuple__95; +static PyObject *__pyx_tuple__85; +static PyObject *__pyx_tuple__87; static PyObject *__pyx_codeobj__49; static PyObject *__pyx_codeobj__52; static PyObject *__pyx_codeobj__54; @@ -3500,22 +3238,18 @@ static PyObject *__pyx_codeobj__60; static PyObject *__pyx_codeobj__62; static PyObject *__pyx_codeobj__64; static PyObject *__pyx_codeobj__66; -static PyObject *__pyx_codeobj__68; -static PyObject *__pyx_codeobj__70; -static PyObject *__pyx_codeobj__72; +static PyObject *__pyx_codeobj__69; +static PyObject *__pyx_codeobj__71; static PyObject *__pyx_codeobj__74; static PyObject *__pyx_codeobj__77; static PyObject *__pyx_codeobj__79; static PyObject *__pyx_codeobj__82; -static PyObject *__pyx_codeobj__85; -static PyObject *__pyx_codeobj__87; -static PyObject *__pyx_codeobj__90; -static PyObject *__pyx_codeobj__92; -static PyObject *__pyx_codeobj__94; -static PyObject *__pyx_codeobj__96; +static PyObject *__pyx_codeobj__84; +static PyObject *__pyx_codeobj__86; +static PyObject *__pyx_codeobj__88; /* Late includes */ -/* "src/pyrfc/nwrfcsdk.pyx":12 +/* "pyrfc/_cyrfc.pyx":112 * * * def get_nwrfclib_version(): # <<<<<<<<<<<<<< @@ -3551,7 +3285,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_get_nwrfclib_version(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_nwrfclib_version", 0); - /* "src/pyrfc/nwrfcsdk.pyx":16 + /* "pyrfc/_cyrfc.pyx":116 * :returns: tuple of major, minor and patch level and OS platform * """ * cdef unsigned major = 0 # <<<<<<<<<<<<<< @@ -3560,7 +3294,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_get_nwrfclib_version(CYTHON_UNUSED PyOb */ __pyx_v_major = 0; - /* "src/pyrfc/nwrfcsdk.pyx":17 + /* "pyrfc/_cyrfc.pyx":117 * """ * cdef unsigned major = 0 * cdef unsigned minor = 0 # <<<<<<<<<<<<<< @@ -3569,7 +3303,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_get_nwrfclib_version(CYTHON_UNUSED PyOb */ __pyx_v_minor = 0; - /* "src/pyrfc/nwrfcsdk.pyx":18 + /* "pyrfc/_cyrfc.pyx":118 * cdef unsigned major = 0 * cdef unsigned minor = 0 * cdef unsigned patchlevel = 0 # <<<<<<<<<<<<<< @@ -3578,7 +3312,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_get_nwrfclib_version(CYTHON_UNUSED PyOb */ __pyx_v_patchlevel = 0; - /* "src/pyrfc/nwrfcsdk.pyx":19 + /* "pyrfc/_cyrfc.pyx":119 * cdef unsigned minor = 0 * cdef unsigned patchlevel = 0 * RfcGetVersion(&major, &minor, &patchlevel) # <<<<<<<<<<<<<< @@ -3587,7 +3321,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_get_nwrfclib_version(CYTHON_UNUSED PyOb */ (void)(RfcGetVersion((&__pyx_v_major), (&__pyx_v_minor), (&__pyx_v_patchlevel))); - /* "src/pyrfc/nwrfcsdk.pyx":20 + /* "pyrfc/_cyrfc.pyx":120 * cdef unsigned patchlevel = 0 * RfcGetVersion(&major, &minor, &patchlevel) * return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} # <<<<<<<<<<<<<< @@ -3595,29 +3329,29 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_get_nwrfclib_version(CYTHON_UNUSED PyOb * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_major); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_major); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_major, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_major, __pyx_t_2) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_minor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_minor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minor, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minor, __pyx_t_2) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_patchlevel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_patchlevel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_patchLevel, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_patchLevel, __pyx_t_2) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_platform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_platform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_platform, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_platform, __pyx_t_2) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":12 + /* "pyrfc/_cyrfc.pyx":112 * * * def get_nwrfclib_version(): # <<<<<<<<<<<<<< @@ -3637,7 +3371,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_get_nwrfclib_version(CYTHON_UNUSED PyOb return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":23 +/* "pyrfc/_cyrfc.pyx":123 * * * def set_ini_file_directory(path_name): # <<<<<<<<<<<<<< @@ -3681,7 +3415,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_ini_file_directory", 0); - /* "src/pyrfc/nwrfcsdk.pyx":31 + /* "pyrfc/_cyrfc.pyx":131 * :return: nothing, raises an error * """ * if type(path_name) is not str: # <<<<<<<<<<<<<< @@ -3692,14 +3426,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/nwrfcsdk.pyx":32 + /* "pyrfc/_cyrfc.pyx":132 * """ * if type(path_name) is not str: * raise TypeError('sapnwrfc.ini path is not a string:', path_name) # <<<<<<<<<<<<<< * cdef RFC_ERROR_INFO errorInfo * cdef SAP_UC pathName [512] */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_kp_s_sapnwrfc_ini_path_is_not_a_strin); __Pyx_GIVEREF(__pyx_kp_s_sapnwrfc_ini_path_is_not_a_strin); @@ -3707,14 +3441,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P __Pyx_INCREF(__pyx_v_path_name); __Pyx_GIVEREF(__pyx_v_path_name); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path_name); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 32, __pyx_L1_error) + __PYX_ERR(0, 132, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":31 + /* "pyrfc/_cyrfc.pyx":131 * :return: nothing, raises an error * """ * if type(path_name) is not str: # <<<<<<<<<<<<<< @@ -3723,16 +3457,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P */ } - /* "src/pyrfc/nwrfcsdk.pyx":35 + /* "pyrfc/_cyrfc.pyx":135 * cdef RFC_ERROR_INFO errorInfo * cdef SAP_UC pathName [512] * if not isfile(join(path_name, "sapnwrfc.ini")): # <<<<<<<<<<<<<< * raise TypeError('sapnwrfc.ini not found in:', path_name) * pathName = fillString(path_name) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -3749,7 +3483,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_path_name, __pyx_kp_s_sapnwrfc_ini}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_5); } else @@ -3757,13 +3491,13 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_path_name, __pyx_kp_s_sapnwrfc_ini}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_5); } else #endif { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; @@ -3774,7 +3508,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P __Pyx_INCREF(__pyx_kp_s_sapnwrfc_ini); __Pyx_GIVEREF(__pyx_kp_s_sapnwrfc_ini); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_kp_s_sapnwrfc_ini); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -3792,22 +3526,22 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = ((!__pyx_t_2) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":36 + /* "pyrfc/_cyrfc.pyx":136 * cdef SAP_UC pathName [512] * if not isfile(join(path_name, "sapnwrfc.ini")): * raise TypeError('sapnwrfc.ini not found in:', path_name) # <<<<<<<<<<<<<< * pathName = fillString(path_name) * cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_kp_s_sapnwrfc_ini_not_found_in); __Pyx_GIVEREF(__pyx_kp_s_sapnwrfc_ini_not_found_in); @@ -3815,14 +3549,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P __Pyx_INCREF(__pyx_v_path_name); __Pyx_GIVEREF(__pyx_v_path_name); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_path_name); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 36, __pyx_L1_error) + __PYX_ERR(0, 136, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":35 + /* "pyrfc/_cyrfc.pyx":135 * cdef RFC_ERROR_INFO errorInfo * cdef SAP_UC pathName [512] * if not isfile(join(path_name, "sapnwrfc.ini")): # <<<<<<<<<<<<<< @@ -3831,17 +3565,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P */ } - /* "src/pyrfc/nwrfcsdk.pyx":37 + /* "pyrfc/_cyrfc.pyx":137 * if not isfile(join(path_name, "sapnwrfc.ini")): * raise TypeError('sapnwrfc.ini not found in:', path_name) * pathName = fillString(path_name) # <<<<<<<<<<<<<< * cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) * if rc != RFC_OK: */ - __pyx_t_10 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_path_name); if (unlikely(__pyx_t_10 == ((SAP_UC *)NULL))) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_10 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_path_name); if (unlikely(__pyx_t_10 == ((SAP_UC *)NULL))) __PYX_ERR(0, 137, __pyx_L1_error) memcpy(&(__pyx_v_pathName[0]), __pyx_t_10, sizeof(__pyx_v_pathName[0]) * (0x200 - 0)); - /* "src/pyrfc/nwrfcsdk.pyx":38 + /* "pyrfc/_cyrfc.pyx":138 * raise TypeError('sapnwrfc.ini not found in:', path_name) * pathName = fillString(path_name) * cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) # <<<<<<<<<<<<<< @@ -3850,7 +3584,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P */ __pyx_v_rc = RfcSetIniPath(__pyx_v_pathName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/nwrfcsdk.pyx":39 + /* "pyrfc/_cyrfc.pyx":139 * pathName = fillString(path_name) * cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -3860,20 +3594,20 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":40 + /* "pyrfc/_cyrfc.pyx":140 * cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 40, __pyx_L1_error) + __PYX_ERR(0, 140, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":39 + /* "pyrfc/_cyrfc.pyx":139 * pathName = fillString(path_name) * cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -3882,7 +3616,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P */ } - /* "src/pyrfc/nwrfcsdk.pyx":23 + /* "pyrfc/_cyrfc.pyx":123 * * * def set_ini_file_directory(path_name): # <<<<<<<<<<<<<< @@ -3908,7 +3642,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_2set_ini_file_directory(CYTHON_UNUSED P return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":43 +/* "pyrfc/_cyrfc.pyx":143 * * * def reload_ini_file(): # <<<<<<<<<<<<<< @@ -3943,7 +3677,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_4reload_ini_file(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("reload_ini_file", 0); - /* "src/pyrfc/nwrfcsdk.pyx":57 + /* "pyrfc/_cyrfc.pyx":157 * """ * cdef RFC_ERROR_INFO errorInfo * cdef RFC_RC rc = RfcReloadIniFile (&errorInfo) # <<<<<<<<<<<<<< @@ -3952,7 +3686,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_4reload_ini_file(CYTHON_UNUSED PyObject */ __pyx_v_rc = RfcReloadIniFile((&__pyx_v_errorInfo)); - /* "src/pyrfc/nwrfcsdk.pyx":58 + /* "pyrfc/_cyrfc.pyx":158 * cdef RFC_ERROR_INFO errorInfo * cdef RFC_RC rc = RfcReloadIniFile (&errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -3962,20 +3696,20 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_4reload_ini_file(CYTHON_UNUSED PyObject __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":59 + /* "pyrfc/_cyrfc.pyx":159 * cdef RFC_RC rc = RfcReloadIniFile (&errorInfo) * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 59, __pyx_L1_error) + __PYX_ERR(0, 159, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":58 + /* "pyrfc/_cyrfc.pyx":158 * cdef RFC_ERROR_INFO errorInfo * cdef RFC_RC rc = RfcReloadIniFile (&errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -3984,7 +3718,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_4reload_ini_file(CYTHON_UNUSED PyObject */ } - /* "src/pyrfc/nwrfcsdk.pyx":43 + /* "pyrfc/_cyrfc.pyx":143 * * * def reload_ini_file(): # <<<<<<<<<<<<<< @@ -4005,7 +3739,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_4reload_ini_file(CYTHON_UNUSED PyObject return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":62 +/* "pyrfc/_cyrfc.pyx":162 * * * def language_iso_to_sap(lang_iso): # <<<<<<<<<<<<<< @@ -4044,17 +3778,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6language_iso_to_sap(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("language_iso_to_sap", 0); - /* "src/pyrfc/nwrfcsdk.pyx":73 + /* "pyrfc/_cyrfc.pyx":173 * if ISO to SAP code conversion fails. * """ * cdef SAP_UC *uclang_iso = fillString(lang_iso) # <<<<<<<<<<<<<< * cdef SAP_UC uclang_sap[8] * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_lang_iso); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_lang_iso); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 173, __pyx_L1_error) __pyx_v_uclang_iso = __pyx_t_1; - /* "src/pyrfc/nwrfcsdk.pyx":76 + /* "pyrfc/_cyrfc.pyx":176 * cdef SAP_UC uclang_sap[8] * cdef RFC_ERROR_INFO errorInfo * cdef RFC_RC rc = RfcLanguageIsoToSap(uclang_iso, uclang_sap, &errorInfo) # <<<<<<<<<<<<<< @@ -4063,7 +3797,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6language_iso_to_sap(CYTHON_UNUSED PyOb */ __pyx_v_rc = RfcLanguageIsoToSap(__pyx_v_uclang_iso, __pyx_v_uclang_sap, (&__pyx_v_errorInfo)); - /* "src/pyrfc/nwrfcsdk.pyx":77 + /* "pyrfc/_cyrfc.pyx":177 * cdef RFC_ERROR_INFO errorInfo * cdef RFC_RC rc = RfcLanguageIsoToSap(uclang_iso, uclang_sap, &errorInfo) * free(uclang_iso) # <<<<<<<<<<<<<< @@ -4072,7 +3806,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6language_iso_to_sap(CYTHON_UNUSED PyOb */ free(__pyx_v_uclang_iso); - /* "src/pyrfc/nwrfcsdk.pyx":78 + /* "pyrfc/_cyrfc.pyx":178 * cdef RFC_RC rc = RfcLanguageIsoToSap(uclang_iso, uclang_sap, &errorInfo) * free(uclang_iso) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -4082,20 +3816,20 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6language_iso_to_sap(CYTHON_UNUSED PyOb __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/nwrfcsdk.pyx":79 + /* "pyrfc/_cyrfc.pyx":179 * free(uclang_iso) * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * return wrapString(uclang_sap, 1) * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 79, __pyx_L1_error) + __PYX_ERR(0, 179, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":78 + /* "pyrfc/_cyrfc.pyx":178 * cdef RFC_RC rc = RfcLanguageIsoToSap(uclang_iso, uclang_sap, &errorInfo) * free(uclang_iso) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -4104,7 +3838,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6language_iso_to_sap(CYTHON_UNUSED PyOb */ } - /* "src/pyrfc/nwrfcsdk.pyx":80 + /* "pyrfc/_cyrfc.pyx":180 * if rc != RFC_OK: * raise wrapError(&errorInfo) * return wrapString(uclang_sap, 1) # <<<<<<<<<<<<<< @@ -4114,13 +3848,13 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6language_iso_to_sap(CYTHON_UNUSED PyOb __Pyx_XDECREF(__pyx_r); __pyx_t_4.__pyx_n = 1; __pyx_t_4.uclen = __pyx_int_1; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uclang_sap, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uclang_sap, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":62 + /* "pyrfc/_cyrfc.pyx":162 * * * def language_iso_to_sap(lang_iso): # <<<<<<<<<<<<<< @@ -4139,7 +3873,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6language_iso_to_sap(CYTHON_UNUSED PyOb return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":83 +/* "pyrfc/_cyrfc.pyx":183 * * * def language_sap_to_iso(lang_sap): # <<<<<<<<<<<<<< @@ -4178,17 +3912,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("language_sap_to_iso", 0); - /* "src/pyrfc/nwrfcsdk.pyx":94 + /* "pyrfc/_cyrfc.pyx":194 * if SAP to ISO code conversion fails. * """ * cdef SAP_UC *uclang_sap = fillString(lang_sap) # <<<<<<<<<<<<<< * cdef SAP_UC uclang_iso[16] * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_lang_sap); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_lang_sap); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 194, __pyx_L1_error) __pyx_v_uclang_sap = __pyx_t_1; - /* "src/pyrfc/nwrfcsdk.pyx":97 + /* "pyrfc/_cyrfc.pyx":197 * cdef SAP_UC uclang_iso[16] * cdef RFC_ERROR_INFO errorInfo * cdef RFC_RC rc = RfcLanguageSapToIso(uclang_sap, uclang_iso, &errorInfo) # <<<<<<<<<<<<<< @@ -4197,7 +3931,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb */ __pyx_v_rc = RfcLanguageSapToIso(__pyx_v_uclang_sap, __pyx_v_uclang_iso, (&__pyx_v_errorInfo)); - /* "src/pyrfc/nwrfcsdk.pyx":98 + /* "pyrfc/_cyrfc.pyx":198 * cdef RFC_ERROR_INFO errorInfo * cdef RFC_RC rc = RfcLanguageSapToIso(uclang_sap, uclang_iso, &errorInfo) * free(uclang_sap) # <<<<<<<<<<<<<< @@ -4206,7 +3940,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb */ free(__pyx_v_uclang_sap); - /* "src/pyrfc/nwrfcsdk.pyx":99 + /* "pyrfc/_cyrfc.pyx":199 * cdef RFC_RC rc = RfcLanguageSapToIso(uclang_sap, uclang_iso, &errorInfo) * free(uclang_sap) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -4216,20 +3950,20 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/nwrfcsdk.pyx":100 + /* "pyrfc/_cyrfc.pyx":200 * free(uclang_sap) * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * return wrapString(uclang_iso, 2) * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 100, __pyx_L1_error) + __PYX_ERR(0, 200, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":99 + /* "pyrfc/_cyrfc.pyx":199 * cdef RFC_RC rc = RfcLanguageSapToIso(uclang_sap, uclang_iso, &errorInfo) * free(uclang_sap) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -4238,7 +3972,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb */ } - /* "src/pyrfc/nwrfcsdk.pyx":101 + /* "pyrfc/_cyrfc.pyx":201 * if rc != RFC_OK: * raise wrapError(&errorInfo) * return wrapString(uclang_iso, 2) # <<<<<<<<<<<<<< @@ -4248,13 +3982,13 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb __Pyx_XDECREF(__pyx_r); __pyx_t_4.__pyx_n = 1; __pyx_t_4.uclen = __pyx_int_2; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uclang_iso, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uclang_iso, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":83 + /* "pyrfc/_cyrfc.pyx":183 * * * def language_sap_to_iso(lang_sap): # <<<<<<<<<<<<<< @@ -4273,7 +4007,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_8language_sap_to_iso(CYTHON_UNUSED PyOb return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":104 +/* "pyrfc/_cyrfc.pyx":204 * * * def set_cryptolib_path(path_name): # <<<<<<<<<<<<<< @@ -4313,7 +4047,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_cryptolib_path", 0); - /* "src/pyrfc/nwrfcsdk.pyx":116 + /* "pyrfc/_cyrfc.pyx":216 * :return: nothing, raises an error * """ * if type(path_name) is not str: # <<<<<<<<<<<<<< @@ -4324,14 +4058,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb __pyx_t_2 = (__pyx_t_1 != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/nwrfcsdk.pyx":117 + /* "pyrfc/_cyrfc.pyx":217 * """ * if type(path_name) is not str: * raise TypeError('sapnwrfc.ini path is not a string:', path_name) # <<<<<<<<<<<<<< * cdef RFC_ERROR_INFO errorInfo * cdef SAP_UC pathName [512] */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_kp_s_sapnwrfc_ini_path_is_not_a_strin); __Pyx_GIVEREF(__pyx_kp_s_sapnwrfc_ini_path_is_not_a_strin); @@ -4339,14 +4073,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_v_path_name); __Pyx_GIVEREF(__pyx_v_path_name); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_path_name); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 117, __pyx_L1_error) + __PYX_ERR(0, 217, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":116 + /* "pyrfc/_cyrfc.pyx":216 * :return: nothing, raises an error * """ * if type(path_name) is not str: # <<<<<<<<<<<<<< @@ -4355,14 +4089,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb */ } - /* "src/pyrfc/nwrfcsdk.pyx":120 + /* "pyrfc/_cyrfc.pyx":220 * cdef RFC_ERROR_INFO errorInfo * cdef SAP_UC pathName [512] * if not isfile(path_name): # <<<<<<<<<<<<<< * raise TypeError('Crypto library not found:', path_name) * pathName = fillString(path_name) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -4376,22 +4110,22 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_path_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_path_name); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = ((!__pyx_t_2) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":121 + /* "pyrfc/_cyrfc.pyx":221 * cdef SAP_UC pathName [512] * if not isfile(path_name): * raise TypeError('Crypto library not found:', path_name) # <<<<<<<<<<<<<< * pathName = fillString(path_name) * cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_kp_s_Crypto_library_not_found); __Pyx_GIVEREF(__pyx_kp_s_Crypto_library_not_found); @@ -4399,14 +4133,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_v_path_name); __Pyx_GIVEREF(__pyx_v_path_name); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_path_name); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 121, __pyx_L1_error) + __PYX_ERR(0, 221, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":120 + /* "pyrfc/_cyrfc.pyx":220 * cdef RFC_ERROR_INFO errorInfo * cdef SAP_UC pathName [512] * if not isfile(path_name): # <<<<<<<<<<<<<< @@ -4415,17 +4149,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb */ } - /* "src/pyrfc/nwrfcsdk.pyx":122 + /* "pyrfc/_cyrfc.pyx":222 * if not isfile(path_name): * raise TypeError('Crypto library not found:', path_name) * pathName = fillString(path_name) # <<<<<<<<<<<<<< * cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) * if rc != RFC_OK: */ - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_path_name); if (unlikely(__pyx_t_6 == ((SAP_UC *)NULL))) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_path_name); if (unlikely(__pyx_t_6 == ((SAP_UC *)NULL))) __PYX_ERR(0, 222, __pyx_L1_error) memcpy(&(__pyx_v_pathName[0]), __pyx_t_6, sizeof(__pyx_v_pathName[0]) * (0x200 - 0)); - /* "src/pyrfc/nwrfcsdk.pyx":123 + /* "pyrfc/_cyrfc.pyx":223 * raise TypeError('Crypto library not found:', path_name) * pathName = fillString(path_name) * cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) # <<<<<<<<<<<<<< @@ -4434,7 +4168,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb */ __pyx_v_rc = RfcLoadCryptoLibrary(__pyx_v_pathName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/nwrfcsdk.pyx":124 + /* "pyrfc/_cyrfc.pyx":224 * pathName = fillString(path_name) * cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -4444,20 +4178,20 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":125 + /* "pyrfc/_cyrfc.pyx":225 * cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 125, __pyx_L1_error) + __PYX_ERR(0, 225, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":124 + /* "pyrfc/_cyrfc.pyx":224 * pathName = fillString(path_name) * cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< @@ -4466,7 +4200,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb */ } - /* "src/pyrfc/nwrfcsdk.pyx":104 + /* "pyrfc/_cyrfc.pyx":204 * * * def set_cryptolib_path(path_name): # <<<<<<<<<<<<<< @@ -4489,7 +4223,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10set_cryptolib_path(CYTHON_UNUSED PyOb return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":128 +/* "pyrfc/_cyrfc.pyx":228 * * * def set_locale_radix(value=None): # <<<<<<<<<<<<<< @@ -4531,7 +4265,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_13set_locale_radix(PyObject *__pyx_self } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_locale_radix") < 0)) __PYX_ERR(0, 128, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_locale_radix") < 0)) __PYX_ERR(0, 228, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4545,7 +4279,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_13set_locale_radix(PyObject *__pyx_self } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_locale_radix", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 128, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_locale_radix", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 228, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyrfc._cyrfc.set_locale_radix", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4572,7 +4306,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_12set_locale_radix(CYTHON_UNUSED PyObje __Pyx_RefNannySetupContext("set_locale_radix", 0); __Pyx_INCREF(__pyx_v_value); - /* "src/pyrfc/nwrfcsdk.pyx":137 + /* "pyrfc/_cyrfc.pyx":237 * """ * global _LOCALE_RADIX * if value is None: # <<<<<<<<<<<<<< @@ -4583,14 +4317,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_12set_locale_radix(CYTHON_UNUSED PyObje __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "src/pyrfc/nwrfcsdk.pyx":138 + /* "pyrfc/_cyrfc.pyx":238 * global _LOCALE_RADIX * if value is None: * value = localeconv()['decimal_point'] # <<<<<<<<<<<<<< * _LOCALE_RADIX = value * return _LOCALE_RADIX */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_localeconv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_localeconv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -4604,16 +4338,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_12set_locale_radix(CYTHON_UNUSED PyObje } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_decimal_point); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_n_s_decimal_point); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":137 + /* "pyrfc/_cyrfc.pyx":237 * """ * global _LOCALE_RADIX * if value is None: # <<<<<<<<<<<<<< @@ -4622,16 +4356,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_12set_locale_radix(CYTHON_UNUSED PyObje */ } - /* "src/pyrfc/nwrfcsdk.pyx":139 + /* "pyrfc/_cyrfc.pyx":239 * if value is None: * value = localeconv()['decimal_point'] * _LOCALE_RADIX = value # <<<<<<<<<<<<<< * return _LOCALE_RADIX * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOCALE_RADIX, __pyx_v_value) < 0) __PYX_ERR(0, 139, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOCALE_RADIX, __pyx_v_value) < 0) __PYX_ERR(0, 239, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":140 + /* "pyrfc/_cyrfc.pyx":240 * value = localeconv()['decimal_point'] * _LOCALE_RADIX = value * return _LOCALE_RADIX # <<<<<<<<<<<<<< @@ -4639,13 +4373,13 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_12set_locale_radix(CYTHON_UNUSED PyObje * */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_LOCALE_RADIX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_LOCALE_RADIX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":128 + /* "pyrfc/_cyrfc.pyx":228 * * * def set_locale_radix(value=None): # <<<<<<<<<<<<<< @@ -4667,7 +4401,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_12set_locale_radix(CYTHON_UNUSED PyObje return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":143 +/* "pyrfc/_cyrfc.pyx":243 * * * cdef _cancel_connection(client_connection): # <<<<<<<<<<<<<< @@ -4689,34 +4423,34 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc__cancel_connection(PyObject *__pyx_v_cli int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_cancel_connection", 0); - /* "src/pyrfc/nwrfcsdk.pyx":146 + /* "pyrfc/_cyrfc.pyx":246 * cdef RFC_RC rc * cdef RFC_ERROR_INFO errorInfo * if client_connection.handle is not None: # <<<<<<<<<<<<<< * rc = RfcCancel(client_connection.handle, &errorInfo) * if rc != RFC_OK or errorInfo.code != RFC_OK: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_client_connection, __pyx_n_s_handle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_client_connection, __pyx_n_s_handle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "src/pyrfc/nwrfcsdk.pyx":147 + /* "pyrfc/_cyrfc.pyx":247 * cdef RFC_ERROR_INFO errorInfo * if client_connection.handle is not None: * rc = RfcCancel(client_connection.handle, &errorInfo) # <<<<<<<<<<<<<< * if rc != RFC_OK or errorInfo.code != RFC_OK: * raise wrapError(&errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_client_connection, __pyx_n_s_handle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_client_connection, __pyx_n_s_handle); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_rc = RfcCancel(((RFC_CONNECTION_HANDLE)((uintptr_t)__pyx_t_4)), (&__pyx_v_errorInfo)); - /* "src/pyrfc/nwrfcsdk.pyx":148 + /* "pyrfc/_cyrfc.pyx":248 * if client_connection.handle is not None: * rc = RfcCancel(client_connection.handle, &errorInfo) * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< @@ -4734,20 +4468,20 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc__cancel_connection(PyObject *__pyx_v_cli __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/nwrfcsdk.pyx":149 + /* "pyrfc/_cyrfc.pyx":249 * rc = RfcCancel(client_connection.handle, &errorInfo) * if rc != RFC_OK or errorInfo.code != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 149, __pyx_L1_error) + __PYX_ERR(0, 249, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":148 + /* "pyrfc/_cyrfc.pyx":248 * if client_connection.handle is not None: * rc = RfcCancel(client_connection.handle, &errorInfo) * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< @@ -4756,7 +4490,7 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc__cancel_connection(PyObject *__pyx_v_cli */ } - /* "src/pyrfc/nwrfcsdk.pyx":146 + /* "pyrfc/_cyrfc.pyx":246 * cdef RFC_RC rc * cdef RFC_ERROR_INFO errorInfo * if client_connection.handle is not None: # <<<<<<<<<<<<<< @@ -4765,7 +4499,7 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc__cancel_connection(PyObject *__pyx_v_cli */ } - /* "src/pyrfc/nwrfcsdk.pyx":143 + /* "pyrfc/_cyrfc.pyx":243 * * * cdef _cancel_connection(client_connection): # <<<<<<<<<<<<<< @@ -4786,7 +4520,7 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc__cancel_connection(PyObject *__pyx_v_cli return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":152 +/* "pyrfc/_cyrfc.pyx":252 * * * def cancel_connection(client_connection): # <<<<<<<<<<<<<< @@ -4821,33 +4555,33 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_14cancel_connection(CYTHON_UNUSED PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cancel_connection", 0); - /* "src/pyrfc/nwrfcsdk.pyx":166 + /* "pyrfc/_cyrfc.pyx":266 * thereof if the connection cannot be cancelled cleanly. * """ * Thread(target=_cancel_connection, args=(client_connection,)).start() # <<<<<<<<<<<<<< * * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_CFunc_object____object___to_py(__pyx_f_5pyrfc_6_cyrfc__cancel_connection); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_4 = __Pyx_CFunc_object____object___to_py(__pyx_f_5pyrfc_6_cyrfc__cancel_connection); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, __pyx_t_4) < 0) __PYX_ERR(0, 166, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, __pyx_t_4) < 0) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_client_connection); __Pyx_GIVEREF(__pyx_v_client_connection); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_client_connection); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_args, __pyx_t_4) < 0) __PYX_ERR(0, 166, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_args, __pyx_t_4) < 0) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -4862,12 +4596,12 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_14cancel_connection(CYTHON_UNUSED PyObj } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":152 + /* "pyrfc/_cyrfc.pyx":252 * * * def cancel_connection(client_connection): # <<<<<<<<<<<<<< @@ -4891,1005 +4625,331 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_14cancel_connection(CYTHON_UNUSED PyObj return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":169 - * - * - * def enum_names(enum_obj): # <<<<<<<<<<<<<< - * return set(e.name for e in enum_obj) +/* "pyrfc/_cyrfc.pyx":285 + * cdef RFC_CONNECTION_PARAMETER *_params * + * def __cinit__(self, **params): # <<<<<<<<<<<<<< + * self._params_count = len(params) + * if self._params_count < 1: */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_17enum_names(PyObject *__pyx_self, PyObject *__pyx_v_enum_obj); /*proto*/ -static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_17enum_names = {"enum_names", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_17enum_names, METH_O, 0}; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_17enum_names(PyObject *__pyx_self, PyObject *__pyx_v_enum_obj) { - PyObject *__pyx_r = 0; +static int __pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_params = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("enum_names (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16enum_names(__pyx_self, ((PyObject *)__pyx_v_enum_obj)); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1; + __pyx_v_params = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_params)) return -1; + __Pyx_GOTREF(__pyx_v_params); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters___cinit__(((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_v_self), __pyx_v_params); /* function exit code */ + __Pyx_XDECREF(__pyx_v_params); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_5pyrfc_6_cyrfc_10enum_names_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ - -/* "src/pyrfc/nwrfcsdk.pyx":170 - * - * def enum_names(enum_obj): - * return set(e.name for e in enum_obj) # <<<<<<<<<<<<<< - * - * - */ -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10enum_names_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; +static int __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters___cinit__(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self, PyObject *__pyx_v_params) { + int __pyx_v_i; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + int __pyx_r; __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + SAP_UC *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *)__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr(__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 170, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pyrfc_6_cyrfc_10enum_names_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_enum_names_locals_genexpr, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!gen)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } + __Pyx_RefNannySetupContext("__cinit__", 0); - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.enum_names.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":286 + * + * def __cinit__(self, **params): + * self._params_count = len(params) # <<<<<<<<<<<<<< + * if self._params_count < 1: + * raise RFCError("Connection parameters missing") + */ + __pyx_t_1 = PyDict_Size(__pyx_v_params); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 286, __pyx_L1_error) + __pyx_v_self->_params_count = ((unsigned int)__pyx_t_1); -static PyObject *__pyx_gb_5pyrfc_6_cyrfc_10enum_names_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 170, __pyx_L1_error) - __pyx_r = PySet_New(NULL); if (unlikely(!__pyx_r)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj)) { __Pyx_RaiseClosureNameError("enum_obj"); __PYX_ERR(0, 170, __pyx_L1_error) } - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 170, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 170, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 170, __pyx_L1_error) - } - break; + /* "pyrfc/_cyrfc.pyx":287 + * def __cinit__(self, **params): + * self._params_count = len(params) + * if self._params_count < 1: # <<<<<<<<<<<<<< + * raise RFCError("Connection parameters missing") + * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) + */ + __pyx_t_2 = ((__pyx_v_self->_params_count < 1) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":288 + * self._params_count = len(params) + * if self._params_count < 1: + * raise RFCError("Connection parameters missing") # <<<<<<<<<<<<<< + * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) + * cdef int i = 0 + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); } - __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_e, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PySet_Add(__pyx_r, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Connection_parameters_missing) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Connection_parameters_missing); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 288, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":287 + * def __cinit__(self, **params): + * self._params_count = len(params) + * if self._params_count < 1: # <<<<<<<<<<<<<< + * raise RFCError("Connection parameters missing") + * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) + */ } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - #if !CYTHON_USE_EXC_INFO_STACK - __Pyx_Coroutine_ResetAndClearException(__pyx_generator); - #endif - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":289 + * if self._params_count < 1: + * raise RFCError("Connection parameters missing") + * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) # <<<<<<<<<<<<<< + * cdef int i = 0 + * for name, value in params.iteritems(): + */ + __pyx_v_self->_params = ((RFC_CONNECTION_PARAMETER *)malloc((__pyx_v_self->_params_count * (sizeof(RFC_CONNECTION_PARAMETER))))); -/* "src/pyrfc/nwrfcsdk.pyx":169 - * - * - * def enum_names(enum_obj): # <<<<<<<<<<<<<< - * return set(e.name for e in enum_obj) - * + /* "pyrfc/_cyrfc.pyx":290 + * raise RFCError("Connection parameters missing") + * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) + * cdef int i = 0 # <<<<<<<<<<<<<< + * for name, value in params.iteritems(): + * self._params[i].name = fillString(name) */ + __pyx_v_i = 0; -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16enum_names(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_enum_obj) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *__pyx_cur_scope; - PyObject *__pyx_gb_5pyrfc_6_cyrfc_10enum_names_2generator = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("enum_names", 0); - __pyx_cur_scope = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *)__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names(__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 169, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_enum_obj = __pyx_v_enum_obj; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_enum_obj); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_enum_obj); + /* "pyrfc/_cyrfc.pyx":291 + * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) + * cdef int i = 0 + * for name, value in params.iteritems(): # <<<<<<<<<<<<<< + * self._params[i].name = fillString(name) + * self._params[i].value = fillString(value) + */ + __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_params, 1, __pyx_n_s_iteritems, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; + while (1) { + __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_6, &__pyx_t_1, &__pyx_t_4, &__pyx_t_5, NULL, __pyx_t_7); + if (unlikely(__pyx_t_8 == 0)) break; + if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5); + __pyx_t_5 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":170 - * - * def enum_names(enum_obj): - * return set(e.name for e in enum_obj) # <<<<<<<<<<<<<< - * - * + /* "pyrfc/_cyrfc.pyx":292 + * cdef int i = 0 + * for name, value in params.iteritems(): + * self._params[i].name = fillString(name) # <<<<<<<<<<<<<< + * self._params[i].value = fillString(value) + * i += 1 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_5pyrfc_6_cyrfc_10enum_names_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_9 == ((SAP_UC *)NULL))) __PYX_ERR(0, 292, __pyx_L1_error) + (__pyx_v_self->_params[__pyx_v_i]).name = __pyx_t_9; - /* "src/pyrfc/nwrfcsdk.pyx":169 + /* "pyrfc/_cyrfc.pyx":293 + * for name, value in params.iteritems(): + * self._params[i].name = fillString(name) + * self._params[i].value = fillString(value) # <<<<<<<<<<<<<< + * i += 1 * + */ + __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_9 == ((SAP_UC *)NULL))) __PYX_ERR(0, 293, __pyx_L1_error) + (__pyx_v_self->_params[__pyx_v_i]).value = __pyx_t_9; + + /* "pyrfc/_cyrfc.pyx":294 + * self._params[i].name = fillString(name) + * self._params[i].value = fillString(value) + * i += 1 # <<<<<<<<<<<<<< * - * def enum_names(enum_obj): # <<<<<<<<<<<<<< - * return set(e.name for e in enum_obj) + * def __del__(self): + */ + __pyx_v_i = (__pyx_v_i + 1); + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":285 + * cdef RFC_CONNECTION_PARAMETER *_params * + * def __cinit__(self, **params): # <<<<<<<<<<<<<< + * self._params_count = len(params) + * if self._params_count < 1: */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.enum_names", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pyrfc._cyrfc.ConnectionParameters.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_gb_5pyrfc_6_cyrfc_10enum_names_2generator); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":173 - * +/* "pyrfc/_cyrfc.pyx":296 + * i += 1 * - * def enum_values(enum_obj): # <<<<<<<<<<<<<< - * return set(e.value for e in enum_obj) + * def __del__(self): # <<<<<<<<<<<<<< + * self._free() * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19enum_values(PyObject *__pyx_self, PyObject *__pyx_v_enum_obj); /*proto*/ -static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_19enum_values = {"enum_values", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_19enum_values, METH_O, 0}; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19enum_values(PyObject *__pyx_self, PyObject *__pyx_v_enum_obj) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_3__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_3__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("enum_values (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_18enum_values(__pyx_self, ((PyObject *)__pyx_v_enum_obj)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_gb_5pyrfc_6_cyrfc_11enum_values_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ - -/* "src/pyrfc/nwrfcsdk.pyx":174 - * - * def enum_values(enum_obj): - * return set(e.value for e in enum_obj) # <<<<<<<<<<<<<< - * - * - */ - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_11enum_values_genexpr(PyObject *__pyx_self) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *__pyx_cur_scope; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("genexpr", 0); - __pyx_cur_scope = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr(__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 174, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *) __pyx_self; - __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); - { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pyrfc_6_cyrfc_11enum_values_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_enum_values_locals_genexpr, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!gen)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_DECREF(__pyx_cur_scope); - __Pyx_RefNannyFinishContext(); - return (PyObject *) gen; - } - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.enum_values.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_gb_5pyrfc_6_cyrfc_11enum_values_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ -{ - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("genexpr", 0); - switch (__pyx_generator->resume_label) { - case 0: goto __pyx_L3_first_run; - default: /* CPython raises the right error here */ - __Pyx_RefNannyFinishContext(); - return NULL; - } - __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 174, __pyx_L1_error) - __pyx_r = PySet_New(NULL); if (unlikely(!__pyx_r)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj)) { __Pyx_RaiseClosureNameError("enum_obj"); __PYX_ERR(0, 174, __pyx_L1_error) } - if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj)) { - __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_enum_obj); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 174, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 174, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 174, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_e); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_e, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_e, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PySet_Add(__pyx_r, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_2__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_r); __pyx_r = 0; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - #if !CYTHON_USE_EXC_INFO_STACK - __Pyx_Coroutine_ResetAndClearException(__pyx_generator); - #endif - __pyx_generator->resume_label = -1; - __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":173 - * - * - * def enum_values(enum_obj): # <<<<<<<<<<<<<< - * return set(e.value for e in enum_obj) - * - */ - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_18enum_values(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_enum_obj) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *__pyx_cur_scope; - PyObject *__pyx_gb_5pyrfc_6_cyrfc_11enum_values_2generator1 = 0; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_2__del__(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("enum_values", 0); - __pyx_cur_scope = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *)__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values(__pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values, __pyx_empty_tuple, NULL); - if (unlikely(!__pyx_cur_scope)) { - __pyx_cur_scope = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *)Py_None); - __Pyx_INCREF(Py_None); - __PYX_ERR(0, 173, __pyx_L1_error) - } else { - __Pyx_GOTREF(__pyx_cur_scope); - } - __pyx_cur_scope->__pyx_v_enum_obj = __pyx_v_enum_obj; - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_enum_obj); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_enum_obj); + __Pyx_RefNannySetupContext("__del__", 0); - /* "src/pyrfc/nwrfcsdk.pyx":174 - * - * def enum_values(enum_obj): - * return set(e.value for e in enum_obj) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":297 * + * def __del__(self): + * self._free() # <<<<<<<<<<<<<< * + * def _free(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_pf_5pyrfc_6_cyrfc_11enum_values_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":173 - * + /* "pyrfc/_cyrfc.pyx":296 + * i += 1 * - * def enum_values(enum_obj): # <<<<<<<<<<<<<< - * return set(e.value for e in enum_obj) + * def __del__(self): # <<<<<<<<<<<<<< + * self._free() * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.enum_values", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.ConnectionParameters.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_gb_5pyrfc_6_cyrfc_11enum_values_2generator1); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":177 - * - * - * def py_to_string(obj): # <<<<<<<<<<<<<< - * return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) +/* "pyrfc/_cyrfc.pyx":299 + * self._free() * + * def _free(self): # <<<<<<<<<<<<<< + * if self._params_count > 0: + * for i in range(self._params_count): */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_21py_to_string(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/ -static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_21py_to_string = {"py_to_string", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_21py_to_string, METH_O, 0}; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_21py_to_string(PyObject *__pyx_self, PyObject *__pyx_v_obj) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_5_free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_5_free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("py_to_string (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_20py_to_string(__pyx_self, ((PyObject *)__pyx_v_obj)); + __Pyx_RefNannySetupContext("_free (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20py_to_string(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self) { + unsigned int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("py_to_string", 0); + int __pyx_t_1; + unsigned int __pyx_t_2; + unsigned int __pyx_t_3; + unsigned int __pyx_t_4; + __Pyx_RefNannySetupContext("_free", 0); - /* "src/pyrfc/nwrfcsdk.pyx":178 - * - * def py_to_string(obj): - * return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) # <<<<<<<<<<<<<< - * + /* "pyrfc/_cyrfc.pyx":300 * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pickle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dumps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pickle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_HIGHEST_PROTOCOL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_obj, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_obj, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_INCREF(__pyx_v_obj); - __Pyx_GIVEREF(__pyx_v_obj); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_obj); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "src/pyrfc/nwrfcsdk.pyx":177 - * - * - * def py_to_string(obj): # <<<<<<<<<<<<<< - * return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pyrfc._cyrfc.py_to_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/nwrfcsdk.pyx":181 - * - * - * def string_to_py(objstr): # <<<<<<<<<<<<<< - * return pickle.loads(objstr) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_23string_to_py(PyObject *__pyx_self, PyObject *__pyx_v_objstr); /*proto*/ -static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_23string_to_py = {"string_to_py", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_23string_to_py, METH_O, 0}; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_23string_to_py(PyObject *__pyx_self, PyObject *__pyx_v_objstr) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("string_to_py (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_22string_to_py(__pyx_self, ((PyObject *)__pyx_v_objstr)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_22string_to_py(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_objstr) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("string_to_py", 0); - - /* "src/pyrfc/nwrfcsdk.pyx":182 - * - * def string_to_py(objstr): - * return pickle.loads(objstr) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pickle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_loads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_objstr) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_objstr); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "src/pyrfc/nwrfcsdk.pyx":181 - * - * - * def string_to_py(objstr): # <<<<<<<<<<<<<< - * return pickle.loads(objstr) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.string_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/nwrfcsdk.pyx":201 - * cdef RFC_CONNECTION_PARAMETER *_params - * - * def __cinit__(self, **params): # <<<<<<<<<<<<<< - * self._params_count = len(params) - * if self._params_count < 1: - */ - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_params = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1; - __pyx_v_params = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_params)) return -1; - __Pyx_GOTREF(__pyx_v_params); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters___cinit__(((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_v_self), __pyx_v_params); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_params); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters___cinit__(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self, PyObject *__pyx_v_params) { - int __pyx_v_i; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_value = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - SAP_UC *__pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - - /* "src/pyrfc/nwrfcsdk.pyx":202 - * - * def __cinit__(self, **params): - * self._params_count = len(params) # <<<<<<<<<<<<<< - * if self._params_count < 1: - * raise RFCError("Connection parameters missing") - */ - __pyx_t_1 = PyDict_Size(__pyx_v_params); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_v_self->_params_count = ((unsigned int)__pyx_t_1); - - /* "src/pyrfc/nwrfcsdk.pyx":203 - * def __cinit__(self, **params): - * self._params_count = len(params) - * if self._params_count < 1: # <<<<<<<<<<<<<< - * raise RFCError("Connection parameters missing") - * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) - */ - __pyx_t_2 = ((__pyx_v_self->_params_count < 1) != 0); - if (unlikely(__pyx_t_2)) { - - /* "src/pyrfc/nwrfcsdk.pyx":204 - * self._params_count = len(params) - * if self._params_count < 1: - * raise RFCError("Connection parameters missing") # <<<<<<<<<<<<<< - * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) - * cdef int i = 0 - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Connection_parameters_missing) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Connection_parameters_missing); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 204, __pyx_L1_error) - - /* "src/pyrfc/nwrfcsdk.pyx":203 - * def __cinit__(self, **params): - * self._params_count = len(params) - * if self._params_count < 1: # <<<<<<<<<<<<<< - * raise RFCError("Connection parameters missing") - * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) - */ - } - - /* "src/pyrfc/nwrfcsdk.pyx":205 - * if self._params_count < 1: - * raise RFCError("Connection parameters missing") - * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) # <<<<<<<<<<<<<< - * cdef int i = 0 - * for name, value in params.iteritems(): - */ - __pyx_v_self->_params = ((RFC_CONNECTION_PARAMETER *)malloc((__pyx_v_self->_params_count * (sizeof(RFC_CONNECTION_PARAMETER))))); - - /* "src/pyrfc/nwrfcsdk.pyx":206 - * raise RFCError("Connection parameters missing") - * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) - * cdef int i = 0 # <<<<<<<<<<<<<< - * for name, value in params.iteritems(): - * self._params[i].name = fillString(name) - */ - __pyx_v_i = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":207 - * self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) - * cdef int i = 0 - * for name, value in params.iteritems(): # <<<<<<<<<<<<<< - * self._params[i].name = fillString(name) - * self._params[i].value = fillString(value) - */ - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_params, 1, __pyx_n_s_iteritems, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - while (1) { - __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_6, &__pyx_t_1, &__pyx_t_4, &__pyx_t_5, NULL, __pyx_t_7); - if (unlikely(__pyx_t_8 == 0)) break; - if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_5); - __pyx_t_5 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":208 - * cdef int i = 0 - * for name, value in params.iteritems(): - * self._params[i].name = fillString(name) # <<<<<<<<<<<<<< - * self._params[i].value = fillString(value) - * i += 1 - */ - __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_9 == ((SAP_UC *)NULL))) __PYX_ERR(0, 208, __pyx_L1_error) - (__pyx_v_self->_params[__pyx_v_i]).name = __pyx_t_9; - - /* "src/pyrfc/nwrfcsdk.pyx":209 - * for name, value in params.iteritems(): - * self._params[i].name = fillString(name) - * self._params[i].value = fillString(value) # <<<<<<<<<<<<<< - * i += 1 - * - */ - __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_9 == ((SAP_UC *)NULL))) __PYX_ERR(0, 209, __pyx_L1_error) - (__pyx_v_self->_params[__pyx_v_i]).value = __pyx_t_9; - - /* "src/pyrfc/nwrfcsdk.pyx":210 - * self._params[i].name = fillString(name) - * self._params[i].value = fillString(value) - * i += 1 # <<<<<<<<<<<<<< - * - * def __del__(self): - */ - __pyx_v_i = (__pyx_v_i + 1); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":201 - * cdef RFC_CONNECTION_PARAMETER *_params - * - * def __cinit__(self, **params): # <<<<<<<<<<<<<< - * self._params_count = len(params) - * if self._params_count < 1: - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.ConnectionParameters.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/nwrfcsdk.pyx":212 - * i += 1 - * - * def __del__(self): # <<<<<<<<<<<<<< - * self._free() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_3__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_3__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_2__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_2__del__(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__del__", 0); - - /* "src/pyrfc/nwrfcsdk.pyx":213 - * - * def __del__(self): - * self._free() # <<<<<<<<<<<<<< - * - * def _free(self): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":212 - * i += 1 - * - * def __del__(self): # <<<<<<<<<<<<<< - * self._free() - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.ConnectionParameters.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/nwrfcsdk.pyx":215 - * self._free() - * - * def _free(self): # <<<<<<<<<<<<<< - * if self._params_count > 0: - * for i in range(self._params_count): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_5_free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_20ConnectionParameters_5_free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_free (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *__pyx_v_self) { - unsigned int __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - unsigned int __pyx_t_2; - unsigned int __pyx_t_3; - unsigned int __pyx_t_4; - __Pyx_RefNannySetupContext("_free", 0); - - /* "src/pyrfc/nwrfcsdk.pyx":216 - * - * def _free(self): - * if self._params_count > 0: # <<<<<<<<<<<<<< - * for i in range(self._params_count): - * free(self._params[i].name) + * def _free(self): + * if self._params_count > 0: # <<<<<<<<<<<<<< + * for i in range(self._params_count): + * free(self._params[i].name) */ __pyx_t_1 = ((__pyx_v_self->_params_count > 0) != 0); if (__pyx_t_1) { - /* "src/pyrfc/nwrfcsdk.pyx":217 + /* "pyrfc/_cyrfc.pyx":301 * def _free(self): * if self._params_count > 0: * for i in range(self._params_count): # <<<<<<<<<<<<<< @@ -5901,7 +4961,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "src/pyrfc/nwrfcsdk.pyx":218 + /* "pyrfc/_cyrfc.pyx":302 * if self._params_count > 0: * for i in range(self._params_count): * free(self._params[i].name) # <<<<<<<<<<<<<< @@ -5910,7 +4970,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __ */ free(((SAP_UC *)(__pyx_v_self->_params[__pyx_v_i]).name)); - /* "src/pyrfc/nwrfcsdk.pyx":219 + /* "pyrfc/_cyrfc.pyx":303 * for i in range(self._params_count): * free(self._params[i].name) * free( self._params[i].value) # <<<<<<<<<<<<<< @@ -5920,7 +4980,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __ free(((SAP_UC *)(__pyx_v_self->_params[__pyx_v_i]).value)); } - /* "src/pyrfc/nwrfcsdk.pyx":220 + /* "pyrfc/_cyrfc.pyx":304 * free(self._params[i].name) * free( self._params[i].value) * free(self._params) # <<<<<<<<<<<<<< @@ -5929,7 +4989,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __ */ free(__pyx_v_self->_params); - /* "src/pyrfc/nwrfcsdk.pyx":221 + /* "pyrfc/_cyrfc.pyx":305 * free( self._params[i].value) * free(self._params) * self._params_count = 0 # <<<<<<<<<<<<<< @@ -5938,7 +4998,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __ */ __pyx_v_self->_params_count = 0; - /* "src/pyrfc/nwrfcsdk.pyx":216 + /* "pyrfc/_cyrfc.pyx":300 * * def _free(self): * if self._params_count > 0: # <<<<<<<<<<<<<< @@ -5947,7 +5007,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_4_free(struct __ */ } - /* "src/pyrfc/nwrfcsdk.pyx":215 + /* "pyrfc/_cyrfc.pyx":299 * self._free() * * def _free(self): # <<<<<<<<<<<<<< @@ -5996,11 +5056,11 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_6__reduce_cython * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 2, __pyx_L1_error) + __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< @@ -6052,11 +5112,11 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_8__setstate_cyth * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 4, __pyx_L1_error) + __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): @@ -6075,7 +5135,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_20ConnectionParameters_8__setstate_cyth return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":253 +/* "pyrfc/_cyrfc.pyx":337 * * """ * def __init__(self, name, nuc_length, uc_length): # <<<<<<<<<<<<<< @@ -6124,23 +5184,23 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_15TypeDescription_1__init__(PyObject *_ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 253, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 337, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nuc_length)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 253, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 337, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uc_length)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 253, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 337, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 253, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 337, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -6157,7 +5217,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_15TypeDescription_1__init__(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 253, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 337, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyrfc._cyrfc.TypeDescription.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6187,46 +5247,46 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "src/pyrfc/nwrfcsdk.pyx":254 + /* "pyrfc/_cyrfc.pyx":338 * """ * def __init__(self, name, nuc_length, uc_length): * self.fields = [] # <<<<<<<<<<<<<< * if len(name)<1 or len(name)>30: * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fields, __pyx_t_1) < 0) __PYX_ERR(0, 254, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fields, __pyx_t_1) < 0) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":255 + /* "pyrfc/_cyrfc.pyx":339 * def __init__(self, name, nuc_length, uc_length): * self.fields = [] * if len(name)<1 or len(name)>30: # <<<<<<<<<<<<<< * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * for int_field in [nuc_length, uc_length]: */ - __pyx_t_3 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_3 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 339, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_3 < 1) != 0); if (!__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } - __pyx_t_3 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_3 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 339, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_3 > 30) != 0); __pyx_t_2 = __pyx_t_4; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/nwrfcsdk.pyx":256 + /* "pyrfc/_cyrfc.pyx":340 * self.fields = [] * if len(name)<1 or len(name)>30: * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") # <<<<<<<<<<<<<< * for int_field in [nuc_length, uc_length]: * if type(int_field) not in [int, long]: */ - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_5 = 127; @@ -6234,7 +5294,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE __pyx_t_3 += 23; __Pyx_GIVEREF(__pyx_kp_u_field_name_string); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_field_name_string); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -6245,17 +5305,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE __pyx_t_3 += 28; __Pyx_GIVEREF(__pyx_kp_u_should_be_from_1_30_chars); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_should_be_from_1_30_chars); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 256, __pyx_L1_error) + __PYX_ERR(0, 340, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":255 + /* "pyrfc/_cyrfc.pyx":339 * def __init__(self, name, nuc_length, uc_length): * self.fields = [] * if len(name)<1 or len(name)>30: # <<<<<<<<<<<<<< @@ -6264,14 +5324,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE */ } - /* "src/pyrfc/nwrfcsdk.pyx":257 + /* "pyrfc/_cyrfc.pyx":341 * if len(name)<1 or len(name)>30: * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * for int_field in [nuc_length, uc_length]: # <<<<<<<<<<<<<< * if type(int_field) not in [int, long]: * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_nuc_length); __Pyx_GIVEREF(__pyx_v_nuc_length); @@ -6284,15 +5344,15 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE for (;;) { if (__pyx_t_3 >= 2) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 341, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif __Pyx_XDECREF_SET(__pyx_v_int_field, __pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":258 + /* "pyrfc/_cyrfc.pyx":342 * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * for int_field in [nuc_length, uc_length]: * if type(int_field) not in [int, long]: # <<<<<<<<<<<<<< @@ -6301,16 +5361,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE */ __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_int_field))); __pyx_t_1 = ((PyObject *)Py_TYPE(__pyx_v_int_field)); - __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyInt_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyInt_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L9_bool_binop_done; } - __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyLong_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 258, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyLong_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 342, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_2 = __pyx_t_4; __pyx_L9_bool_binop_done:; @@ -6318,14 +5378,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE __pyx_t_4 = (__pyx_t_2 != 0); if (unlikely(__pyx_t_4)) { - /* "src/pyrfc/nwrfcsdk.pyx":259 + /* "pyrfc/_cyrfc.pyx":343 * for int_field in [nuc_length, uc_length]: * if type(int_field) not in [int, long]: * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") # <<<<<<<<<<<<<< * self.name = name * self.nuc_length = nuc_length */ - __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = 0; __pyx_t_5 = 127; @@ -6333,7 +5393,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE __pyx_t_8 += 7; __Pyx_GIVEREF(__pyx_kp_u_field); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_field); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); @@ -6344,7 +5404,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE __pyx_t_8 += 10; __Pyx_GIVEREF(__pyx_kp_u_length); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_length); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_int_field, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_int_field, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); @@ -6355,17 +5415,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE __pyx_t_8 += 25; __Pyx_GIVEREF(__pyx_kp_u_must_be_of_type_integer); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_must_be_of_type_integer); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 259, __pyx_L1_error) + __PYX_ERR(0, 343, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":258 + /* "pyrfc/_cyrfc.pyx":342 * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * for int_field in [nuc_length, uc_length]: * if type(int_field) not in [int, long]: # <<<<<<<<<<<<<< @@ -6374,7 +5434,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE */ } - /* "src/pyrfc/nwrfcsdk.pyx":257 + /* "pyrfc/_cyrfc.pyx":341 * if len(name)<1 or len(name)>30: * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * for int_field in [nuc_length, uc_length]: # <<<<<<<<<<<<<< @@ -6384,34 +5444,34 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":260 + /* "pyrfc/_cyrfc.pyx":344 * if type(int_field) not in [int, long]: * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") * self.name = name # <<<<<<<<<<<<<< * self.nuc_length = nuc_length * self.uc_length = uc_length */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 260, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 344, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":261 + /* "pyrfc/_cyrfc.pyx":345 * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") * self.name = name * self.nuc_length = nuc_length # <<<<<<<<<<<<<< * self.uc_length = uc_length * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nuc_length, __pyx_v_nuc_length) < 0) __PYX_ERR(0, 261, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_nuc_length, __pyx_v_nuc_length) < 0) __PYX_ERR(0, 345, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":262 + /* "pyrfc/_cyrfc.pyx":346 * self.name = name * self.nuc_length = nuc_length * self.uc_length = uc_length # <<<<<<<<<<<<<< * * def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_uc_length, __pyx_v_uc_length) < 0) __PYX_ERR(0, 262, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_uc_length, __pyx_v_uc_length) < 0) __PYX_ERR(0, 346, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":253 + /* "pyrfc/_cyrfc.pyx":337 * * """ * def __init__(self, name, nuc_length, uc_length): # <<<<<<<<<<<<<< @@ -6435,7 +5495,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription___init__(CYTHON_UNUSE return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":264 +/* "pyrfc/_cyrfc.pyx":348 * self.uc_length = uc_length * * def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, # <<<<<<<<<<<<<< @@ -6468,7 +5528,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_15TypeDescription_3add_field(PyObject * PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; values[7] = ((PyObject *)((PyObject *)__pyx_int_0)); - /* "src/pyrfc/nwrfcsdk.pyx":265 + /* "pyrfc/_cyrfc.pyx":349 * * def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, * uc_offset, decimals=0, type_description=None): # <<<<<<<<<<<<<< @@ -6510,37 +5570,37 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_15TypeDescription_3add_field(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 1); __PYX_ERR(0, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 1); __PYX_ERR(0, 348, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_field_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 2); __PYX_ERR(0, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 2); __PYX_ERR(0, 348, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nuc_length)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 3); __PYX_ERR(0, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 3); __PYX_ERR(0, 348, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uc_length)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 4); __PYX_ERR(0, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 4); __PYX_ERR(0, 348, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nuc_offset)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 5); __PYX_ERR(0, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 5); __PYX_ERR(0, 348, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uc_offset)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 6); __PYX_ERR(0, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, 6); __PYX_ERR(0, 348, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: @@ -6556,7 +5616,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_15TypeDescription_3add_field(PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_field") < 0)) __PYX_ERR(0, 264, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_field") < 0)) __PYX_ERR(0, 348, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6587,7 +5647,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_15TypeDescription_3add_field(PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 264, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_field", 0, 7, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 348, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyrfc._cyrfc.TypeDescription.add_field", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6595,7 +5655,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_15TypeDescription_3add_field(PyObject * __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_field_type, __pyx_v_nuc_length, __pyx_v_uc_length, __pyx_v_nuc_offset, __pyx_v_uc_offset, __pyx_v_decimals, __pyx_v_type_description); - /* "src/pyrfc/nwrfcsdk.pyx":264 + /* "pyrfc/_cyrfc.pyx":348 * self.uc_length = uc_length * * def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, # <<<<<<<<<<<<<< @@ -6629,18 +5689,18 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_field", 0); - /* "src/pyrfc/nwrfcsdk.pyx":285 + /* "pyrfc/_cyrfc.pyx":369 * :type type_description: object of class TypeDescription * """ * if len(name)<1: # <<<<<<<<<<<<<< * return None * if len(name)>30: */ - __pyx_t_1 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 369, __pyx_L1_error) __pyx_t_2 = ((__pyx_t_1 < 1) != 0); if (__pyx_t_2) { - /* "src/pyrfc/nwrfcsdk.pyx":286 + /* "pyrfc/_cyrfc.pyx":370 * """ * if len(name)<1: * return None # <<<<<<<<<<<<<< @@ -6651,7 +5711,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":285 + /* "pyrfc/_cyrfc.pyx":369 * :type type_description: object of class TypeDescription * """ * if len(name)<1: # <<<<<<<<<<<<<< @@ -6660,25 +5720,25 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU */ } - /* "src/pyrfc/nwrfcsdk.pyx":287 + /* "pyrfc/_cyrfc.pyx":371 * if len(name)<1: * return None * if len(name)>30: # <<<<<<<<<<<<<< * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * if field_type not in enum_names(RfcFieldType): */ - __pyx_t_1 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 371, __pyx_L1_error) __pyx_t_2 = ((__pyx_t_1 > 30) != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/nwrfcsdk.pyx":288 + /* "pyrfc/_cyrfc.pyx":372 * return None * if len(name)>30: * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") # <<<<<<<<<<<<<< * if field_type not in enum_names(RfcFieldType): * raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") */ - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_4 = 127; @@ -6686,7 +5746,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_1 += 23; __Pyx_GIVEREF(__pyx_kp_u_field_name_string); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_field_name_string); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); @@ -6697,17 +5757,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_1 += 28; __Pyx_GIVEREF(__pyx_kp_u_should_be_from_1_30_chars); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_should_be_from_1_30_chars); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 288, __pyx_L1_error) + __PYX_ERR(0, 372, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":287 + /* "pyrfc/_cyrfc.pyx":371 * if len(name)<1: * return None * if len(name)>30: # <<<<<<<<<<<<<< @@ -6716,16 +5776,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU */ } - /* "src/pyrfc/nwrfcsdk.pyx":289 + /* "pyrfc/_cyrfc.pyx":373 * if len(name)>30: * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * if field_type not in enum_names(RfcFieldType): # <<<<<<<<<<<<<< * raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") * for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -6740,22 +5800,22 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_field_type, __pyx_t_3, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_field_type, __pyx_t_3, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = (__pyx_t_2 != 0); if (unlikely(__pyx_t_8)) { - /* "src/pyrfc/nwrfcsdk.pyx":290 + /* "pyrfc/_cyrfc.pyx":374 * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * if field_type not in enum_names(RfcFieldType): * raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") # <<<<<<<<<<<<<< * for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: * if not isinstance(int_field, (int, long)): */ - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_4 = 127; @@ -6763,7 +5823,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_1 += 23; __Pyx_GIVEREF(__pyx_kp_u_field_type_string); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_field_type_string); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_field_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_field_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); @@ -6774,9 +5834,9 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_1 += 13; __Pyx_GIVEREF(__pyx_kp_u_must_be_in); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_must_be_in); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -6791,10 +5851,10 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 290, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4; @@ -6802,17 +5862,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 290, __pyx_L1_error) + __PYX_ERR(0, 374, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":289 + /* "pyrfc/_cyrfc.pyx":373 * if len(name)>30: * raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") * if field_type not in enum_names(RfcFieldType): # <<<<<<<<<<<<<< @@ -6821,14 +5881,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU */ } - /* "src/pyrfc/nwrfcsdk.pyx":291 + /* "pyrfc/_cyrfc.pyx":375 * if field_type not in enum_names(RfcFieldType): * raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") * for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: # <<<<<<<<<<<<<< * if not isinstance(int_field, (int, long)): * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") */ - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_nuc_length); __Pyx_GIVEREF(__pyx_v_nuc_length); @@ -6847,15 +5907,15 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU for (;;) { if (__pyx_t_1 >= 4) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 375, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_int_field, __pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":292 + /* "pyrfc/_cyrfc.pyx":376 * raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") * for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: * if not isinstance(int_field, (int, long)): # <<<<<<<<<<<<<< @@ -6876,14 +5936,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_2 = ((!(__pyx_t_8 != 0)) != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/nwrfcsdk.pyx":293 + /* "pyrfc/_cyrfc.pyx":377 * for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: * if not isinstance(int_field, (int, long)): * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") # <<<<<<<<<<<<<< * self.fields.append({ * 'name': name, */ - __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = 0; __pyx_t_4 = 127; @@ -6891,7 +5951,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_11 += 7; __Pyx_GIVEREF(__pyx_kp_u_field); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_field); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); @@ -6902,7 +5962,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_11 += 10; __Pyx_GIVEREF(__pyx_kp_u_length); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_length); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_int_field, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_int_field, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_11 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); @@ -6913,17 +5973,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU __pyx_t_11 += 25; __Pyx_GIVEREF(__pyx_kp_u_must_be_of_type_integer); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_must_be_of_type_integer); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 293, __pyx_L1_error) + __PYX_ERR(0, 377, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":292 + /* "pyrfc/_cyrfc.pyx":376 * raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") * for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: * if not isinstance(int_field, (int, long)): # <<<<<<<<<<<<<< @@ -6932,7 +5992,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU */ } - /* "src/pyrfc/nwrfcsdk.pyx":291 + /* "pyrfc/_cyrfc.pyx":375 * if field_type not in enum_names(RfcFieldType): * raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") * for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: # <<<<<<<<<<<<<< @@ -6942,102 +6002,102 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":294 + /* "pyrfc/_cyrfc.pyx":378 * if not isinstance(int_field, (int, long)): * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") * self.fields.append({ # <<<<<<<<<<<<<< * 'name': name, * 'field_type': field_type, */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fields); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fields); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "src/pyrfc/nwrfcsdk.pyx":295 + /* "pyrfc/_cyrfc.pyx":379 * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") * self.fields.append({ * 'name': name, # <<<<<<<<<<<<<< * 'field_type': field_type, * 'nuc_length': nuc_length, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":296 + /* "pyrfc/_cyrfc.pyx":380 * self.fields.append({ * 'name': name, * 'field_type': field_type, # <<<<<<<<<<<<<< * 'nuc_length': nuc_length, * 'nuc_offset': nuc_offset, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_field_type, __pyx_v_field_type) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_field_type, __pyx_v_field_type) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":297 + /* "pyrfc/_cyrfc.pyx":381 * 'name': name, * 'field_type': field_type, * 'nuc_length': nuc_length, # <<<<<<<<<<<<<< * 'nuc_offset': nuc_offset, * 'uc_length': uc_length, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nuc_length, __pyx_v_nuc_length) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nuc_length, __pyx_v_nuc_length) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":298 + /* "pyrfc/_cyrfc.pyx":382 * 'field_type': field_type, * 'nuc_length': nuc_length, * 'nuc_offset': nuc_offset, # <<<<<<<<<<<<<< * 'uc_length': uc_length, * 'uc_offset': uc_offset, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nuc_offset, __pyx_v_nuc_offset) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nuc_offset, __pyx_v_nuc_offset) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":299 + /* "pyrfc/_cyrfc.pyx":383 * 'nuc_length': nuc_length, * 'nuc_offset': nuc_offset, * 'uc_length': uc_length, # <<<<<<<<<<<<<< * 'uc_offset': uc_offset, * 'decimals': decimals, */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_uc_length, __pyx_v_uc_length) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_uc_length, __pyx_v_uc_length) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":300 + /* "pyrfc/_cyrfc.pyx":384 * 'nuc_offset': nuc_offset, * 'uc_length': uc_length, * 'uc_offset': uc_offset, # <<<<<<<<<<<<<< * 'decimals': decimals, * 'type_description': type_description */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_uc_offset, __pyx_v_uc_offset) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_uc_offset, __pyx_v_uc_offset) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":301 + /* "pyrfc/_cyrfc.pyx":385 * 'uc_length': uc_length, * 'uc_offset': uc_offset, * 'decimals': decimals, # <<<<<<<<<<<<<< * 'type_description': type_description * }) */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_decimals, __pyx_v_decimals) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_decimals, __pyx_v_decimals) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":302 + /* "pyrfc/_cyrfc.pyx":386 * 'uc_offset': uc_offset, * 'decimals': decimals, * 'type_description': type_description # <<<<<<<<<<<<<< * }) * */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_type_description, __pyx_v_type_description) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_type_description, __pyx_v_type_description) < 0) __PYX_ERR(0, 379, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":294 + /* "pyrfc/_cyrfc.pyx":378 * if not isinstance(int_field, (int, long)): * raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") * self.fields.append({ # <<<<<<<<<<<<<< * 'name': name, * 'field_type': field_type, */ - __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 294, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":264 + /* "pyrfc/_cyrfc.pyx":348 * self.uc_length = uc_length * * def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, # <<<<<<<<<<<<<< @@ -7063,7 +6123,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_2add_field(CYTHON_UNU return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":305 +/* "pyrfc/_cyrfc.pyx":389 * }) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -7099,7 +6159,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_4__repr__(CYTHON_UNUS int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/pyrfc/nwrfcsdk.pyx":306 + /* "pyrfc/_cyrfc.pyx":390 * * def __repr__(self): * return f" __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; @@ -7129,11 +6189,11 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_4__repr__(CYTHON_UNUS __pyx_t_2 += 7; __Pyx_GIVEREF(__pyx_kp_u_with); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_with); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fields); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_6, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_6, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); @@ -7144,16 +6204,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_4__repr__(CYTHON_UNUS __Pyx_GIVEREF(__pyx_kp_u_fields_n_uclength); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_fields_n_uclength); - /* "src/pyrfc/nwrfcsdk.pyx":307 + /* "pyrfc/_cyrfc.pyx":391 * def __repr__(self): * return f"" # <<<<<<<<<<<<<< * * ################################################################################ */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; @@ -7165,9 +6225,9 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_4__repr__(CYTHON_UNUS __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; @@ -7180,21 +6240,21 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_4__repr__(CYTHON_UNUS __Pyx_GIVEREF(__pyx_kp_u__4); PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_kp_u__4); - /* "src/pyrfc/nwrfcsdk.pyx":306 + /* "pyrfc/_cyrfc.pyx":390 * * def __repr__(self): * return f"" * */ - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 9, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":305 + /* "pyrfc/_cyrfc.pyx":389 * }) * * def __repr__(self): # <<<<<<<<<<<<<< @@ -7215,7 +6275,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_15TypeDescription_4__repr__(CYTHON_UNUS return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":337 +/* "pyrfc/_cyrfc.pyx":421 * * """ * def __init__(self, name): # <<<<<<<<<<<<<< @@ -7258,11 +6318,11 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19FunctionDescription_1__init__(PyObjec case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 337, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 421, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 337, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 421, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7275,7 +6335,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19FunctionDescription_1__init__(PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 337, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 421, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyrfc._cyrfc.FunctionDescription.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7297,28 +6357,28 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription___init__(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "src/pyrfc/nwrfcsdk.pyx":338 + /* "pyrfc/_cyrfc.pyx":422 * """ * def __init__(self, name): * self.name = name # <<<<<<<<<<<<<< * self.parameters = [] * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 338, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 422, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":339 + /* "pyrfc/_cyrfc.pyx":423 * def __init__(self, name): * self.name = name * self.parameters = [] # <<<<<<<<<<<<<< * * def add_parameter(self, name, parameter_type, direction, nuc_length, */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_parameters, __pyx_t_1) < 0) __PYX_ERR(0, 339, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_parameters, __pyx_t_1) < 0) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":337 + /* "pyrfc/_cyrfc.pyx":421 * * """ * def __init__(self, name): # <<<<<<<<<<<<<< @@ -7339,7 +6399,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription___init__(CYTHON_U return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":341 +/* "pyrfc/_cyrfc.pyx":425 * self.parameters = [] * * def add_parameter(self, name, parameter_type, direction, nuc_length, # <<<<<<<<<<<<<< @@ -7376,7 +6436,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19FunctionDescription_3add_parameter(Py values[7] = ((PyObject *)((PyObject*)__pyx_kp_s__5)); values[8] = ((PyObject *)((PyObject*)__pyx_kp_s__5)); - /* "src/pyrfc/nwrfcsdk.pyx":343 + /* "pyrfc/_cyrfc.pyx":427 * def add_parameter(self, name, parameter_type, direction, nuc_length, * uc_length, decimals=0, default_value="", parameter_text="", * optional=False, type_description=None): # <<<<<<<<<<<<<< @@ -7423,31 +6483,31 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19FunctionDescription_3add_parameter(Py case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 1); __PYX_ERR(0, 341, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 1); __PYX_ERR(0, 425, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameter_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 2); __PYX_ERR(0, 341, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 2); __PYX_ERR(0, 425, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_direction)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 3); __PYX_ERR(0, 341, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 3); __PYX_ERR(0, 425, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nuc_length)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 4); __PYX_ERR(0, 341, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 4); __PYX_ERR(0, 425, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_uc_length)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 5); __PYX_ERR(0, 341, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, 5); __PYX_ERR(0, 425, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: @@ -7481,7 +6541,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19FunctionDescription_3add_parameter(Py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_parameter") < 0)) __PYX_ERR(0, 341, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_parameter") < 0)) __PYX_ERR(0, 425, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7519,7 +6579,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19FunctionDescription_3add_parameter(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 341, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("add_parameter", 0, 6, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 425, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyrfc._cyrfc.FunctionDescription.add_parameter", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7527,7 +6587,7 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19FunctionDescription_3add_parameter(Py __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_parameter_type, __pyx_v_direction, __pyx_v_nuc_length, __pyx_v_uc_length, __pyx_v_decimals, __pyx_v_default_value, __pyx_v_parameter_text, __pyx_v_optional, __pyx_v_type_description); - /* "src/pyrfc/nwrfcsdk.pyx":341 + /* "pyrfc/_cyrfc.pyx":425 * self.parameters = [] * * def add_parameter(self, name, parameter_type, direction, nuc_length, # <<<<<<<<<<<<<< @@ -7558,34 +6618,34 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_parameter", 0); - /* "src/pyrfc/nwrfcsdk.pyx":367 + /* "pyrfc/_cyrfc.pyx":451 * :type type_description: object of class TypeDescription * """ * if len(name)<1 or len(name)>30: # <<<<<<<<<<<<<< * raise TypeError(f"field 'name' (string) {name} should be from 1-30 chars.") * if parameter_type not in enum_names(RfcFieldType): */ - __pyx_t_2 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 451, __pyx_L1_error) __pyx_t_3 = ((__pyx_t_2 < 1) != 0); if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } - __pyx_t_2 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 367, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_name); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 451, __pyx_L1_error) __pyx_t_3 = ((__pyx_t_2 > 30) != 0); __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":368 + /* "pyrfc/_cyrfc.pyx":452 * """ * if len(name)<1 or len(name)>30: * raise TypeError(f"field 'name' (string) {name} should be from 1-30 chars.") # <<<<<<<<<<<<<< * if parameter_type not in enum_names(RfcFieldType): * raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_5 = 127; @@ -7593,7 +6653,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 22; __Pyx_GIVEREF(__pyx_kp_u_field_name_string_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_field_name_string_2); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -7604,17 +6664,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 27; __Pyx_GIVEREF(__pyx_kp_u_should_be_from_1_30_chars_2); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_should_be_from_1_30_chars_2); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 368, __pyx_L1_error) + __PYX_ERR(0, 452, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":367 + /* "pyrfc/_cyrfc.pyx":451 * :type type_description: object of class TypeDescription * """ * if len(name)<1 or len(name)>30: # <<<<<<<<<<<<<< @@ -7623,16 +6683,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY */ } - /* "src/pyrfc/nwrfcsdk.pyx":369 + /* "pyrfc/_cyrfc.pyx":453 * if len(name)<1 or len(name)>30: * raise TypeError(f"field 'name' (string) {name} should be from 1-30 chars.") * if parameter_type not in enum_names(RfcFieldType): # <<<<<<<<<<<<<< * raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") * if direction not in enum_names(RfcParameterDirection): */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7647,22 +6707,22 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_parameter_type, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 369, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_parameter_type, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__pyx_t_1 != 0); if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/nwrfcsdk.pyx":370 + /* "pyrfc/_cyrfc.pyx":454 * raise TypeError(f"field 'name' (string) {name} should be from 1-30 chars.") * if parameter_type not in enum_names(RfcFieldType): * raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") # <<<<<<<<<<<<<< * if direction not in enum_names(RfcParameterDirection): * raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") */ - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_5 = 127; @@ -7670,7 +6730,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 27; __Pyx_GIVEREF(__pyx_kp_u_parameter_type_string); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_parameter_type_string); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_parameter_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_parameter_type, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -7681,9 +6741,9 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 13; __Pyx_GIVEREF(__pyx_kp_u_must_be_in); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_must_be_in); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -7698,10 +6758,10 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; @@ -7709,17 +6769,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 4, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 370, __pyx_L1_error) + __PYX_ERR(0, 454, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":369 + /* "pyrfc/_cyrfc.pyx":453 * if len(name)<1 or len(name)>30: * raise TypeError(f"field 'name' (string) {name} should be from 1-30 chars.") * if parameter_type not in enum_names(RfcFieldType): # <<<<<<<<<<<<<< @@ -7728,16 +6788,16 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY */ } - /* "src/pyrfc/nwrfcsdk.pyx":371 + /* "pyrfc/_cyrfc.pyx":455 * if parameter_type not in enum_names(RfcFieldType): * raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") * if direction not in enum_names(RfcParameterDirection): # <<<<<<<<<<<<<< * raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") * if len(default_value)>30: */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 371, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -7752,22 +6812,22 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_direction, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 371, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_direction, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = (__pyx_t_3 != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":372 + /* "pyrfc/_cyrfc.pyx":456 * raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") * if direction not in enum_names(RfcParameterDirection): * raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") # <<<<<<<<<<<<<< * if len(default_value)>30: * raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_5 = 127; @@ -7775,7 +6835,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 22; __Pyx_GIVEREF(__pyx_kp_u_direction_string); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_direction_string); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_direction, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_direction, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); @@ -7786,9 +6846,9 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 14; __Pyx_GIVEREF(__pyx_kp_u_must_be_in_2); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_must_be_in_2); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7803,10 +6863,10 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; @@ -7818,17 +6878,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__6); PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__6); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 372, __pyx_L1_error) + __PYX_ERR(0, 456, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":371 + /* "pyrfc/_cyrfc.pyx":455 * if parameter_type not in enum_names(RfcFieldType): * raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") * if direction not in enum_names(RfcParameterDirection): # <<<<<<<<<<<<<< @@ -7837,25 +6897,25 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY */ } - /* "src/pyrfc/nwrfcsdk.pyx":373 + /* "pyrfc/_cyrfc.pyx":457 * if direction not in enum_names(RfcParameterDirection): * raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") * if len(default_value)>30: # <<<<<<<<<<<<<< * raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") * if len(parameter_text)>79: */ - __pyx_t_2 = PyObject_Length(__pyx_v_default_value); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_default_value); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 457, __pyx_L1_error) __pyx_t_1 = ((__pyx_t_2 > 30) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":374 + /* "pyrfc/_cyrfc.pyx":458 * raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") * if len(default_value)>30: * raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") # <<<<<<<<<<<<<< * if len(parameter_text)>79: * raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_5 = 127; @@ -7863,7 +6923,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 26; __Pyx_GIVEREF(__pyx_kp_u_default_value_string); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_default_value_string); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_default_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_default_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -7874,17 +6934,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY __pyx_t_2 += 27; __Pyx_GIVEREF(__pyx_kp_u_must_not_exceed_30_chars); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_must_not_exceed_30_chars); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 374, __pyx_L1_error) + __PYX_ERR(0, 458, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":373 + /* "pyrfc/_cyrfc.pyx":457 * if direction not in enum_names(RfcParameterDirection): * raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") * if len(default_value)>30: # <<<<<<<<<<<<<< @@ -7893,31 +6953,31 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY */ } - /* "src/pyrfc/nwrfcsdk.pyx":375 + /* "pyrfc/_cyrfc.pyx":459 * if len(default_value)>30: * raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") * if len(parameter_text)>79: # <<<<<<<<<<<<<< * raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") * self.parameters.append({ */ - __pyx_t_2 = PyObject_Length(__pyx_v_parameter_text); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 375, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_parameter_text); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 459, __pyx_L1_error) __pyx_t_1 = ((__pyx_t_2 > 79) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/nwrfcsdk.pyx":376 + /* "pyrfc/_cyrfc.pyx":460 * raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") * if len(parameter_text)>79: * raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") # <<<<<<<<<<<<<< * self.parameters.append({ * 'name': name, */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 376, __pyx_L1_error) + __PYX_ERR(0, 460, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":375 + /* "pyrfc/_cyrfc.pyx":459 * if len(default_value)>30: * raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") * if len(parameter_text)>79: # <<<<<<<<<<<<<< @@ -7926,120 +6986,120 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY */ } - /* "src/pyrfc/nwrfcsdk.pyx":377 + /* "pyrfc/_cyrfc.pyx":461 * if len(parameter_text)>79: * raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") * self.parameters.append({ # <<<<<<<<<<<<<< * 'name': name, * 'parameter_type': parameter_type, */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parameters); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "src/pyrfc/nwrfcsdk.pyx":378 + /* "pyrfc/_cyrfc.pyx":462 * raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") * self.parameters.append({ * 'name': name, # <<<<<<<<<<<<<< * 'parameter_type': parameter_type, * 'direction': direction, */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":379 + /* "pyrfc/_cyrfc.pyx":463 * self.parameters.append({ * 'name': name, * 'parameter_type': parameter_type, # <<<<<<<<<<<<<< * 'direction': direction, * 'nuc_length': nuc_length, */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_parameter_type, __pyx_v_parameter_type) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_parameter_type, __pyx_v_parameter_type) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":380 + /* "pyrfc/_cyrfc.pyx":464 * 'name': name, * 'parameter_type': parameter_type, * 'direction': direction, # <<<<<<<<<<<<<< * 'nuc_length': nuc_length, * 'uc_length': uc_length, */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_direction, __pyx_v_direction) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_direction, __pyx_v_direction) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":381 + /* "pyrfc/_cyrfc.pyx":465 * 'parameter_type': parameter_type, * 'direction': direction, * 'nuc_length': nuc_length, # <<<<<<<<<<<<<< * 'uc_length': uc_length, * 'decimals': decimals, */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_nuc_length, __pyx_v_nuc_length) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_nuc_length, __pyx_v_nuc_length) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":382 + /* "pyrfc/_cyrfc.pyx":466 * 'direction': direction, * 'nuc_length': nuc_length, * 'uc_length': uc_length, # <<<<<<<<<<<<<< * 'decimals': decimals, * 'default_value': default_value, */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_uc_length, __pyx_v_uc_length) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_uc_length, __pyx_v_uc_length) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":383 + /* "pyrfc/_cyrfc.pyx":467 * 'nuc_length': nuc_length, * 'uc_length': uc_length, * 'decimals': decimals, # <<<<<<<<<<<<<< * 'default_value': default_value, * 'parameter_text': parameter_text, */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_decimals, __pyx_v_decimals) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_decimals, __pyx_v_decimals) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":384 + /* "pyrfc/_cyrfc.pyx":468 * 'uc_length': uc_length, * 'decimals': decimals, * 'default_value': default_value, # <<<<<<<<<<<<<< * 'parameter_text': parameter_text, * 'optional': optional, */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_default_value, __pyx_v_default_value) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_default_value, __pyx_v_default_value) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":385 + /* "pyrfc/_cyrfc.pyx":469 * 'decimals': decimals, * 'default_value': default_value, * 'parameter_text': parameter_text, # <<<<<<<<<<<<<< * 'optional': optional, * 'type_description': type_description */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_parameter_text, __pyx_v_parameter_text) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_parameter_text, __pyx_v_parameter_text) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":386 + /* "pyrfc/_cyrfc.pyx":470 * 'default_value': default_value, * 'parameter_text': parameter_text, * 'optional': optional, # <<<<<<<<<<<<<< * 'type_description': type_description * }) */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_optional, __pyx_v_optional) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_optional, __pyx_v_optional) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":387 + /* "pyrfc/_cyrfc.pyx":471 * 'parameter_text': parameter_text, * 'optional': optional, * 'type_description': type_description # <<<<<<<<<<<<<< * }) * */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_type_description, __pyx_v_type_description) < 0) __PYX_ERR(0, 378, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_type_description, __pyx_v_type_description) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":377 + /* "pyrfc/_cyrfc.pyx":461 * if len(parameter_text)>79: * raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") * self.parameters.append({ # <<<<<<<<<<<<<< * 'name': name, * 'parameter_type': parameter_type, */ - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_6); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":341 + /* "pyrfc/_cyrfc.pyx":425 * self.parameters = [] * * def add_parameter(self, name, parameter_type, direction, nuc_length, # <<<<<<<<<<<<<< @@ -8064,11 +7124,12 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_2add_parameter(CY return __pyx_r; } -/* "src/pyrfc/nwrfcsdk.pyx":390 +/* "pyrfc/_cyrfc.pyx":474 * }) * * def __repr__(self): # <<<<<<<<<<<<<< * return f"" + * */ /* Python wrapper */ @@ -8099,13 +7160,15 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_4__repr__(CYTHON_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "src/pyrfc/nwrfcsdk.pyx":391 + /* "pyrfc/_cyrfc.pyx":475 * * def __repr__(self): * return f"" # <<<<<<<<<<<<<< + * + * # NOTES ON ERROR HANDLING */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; @@ -8113,9 +7176,9 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_4__repr__(CYTHON_ __pyx_t_2 += 22; __Pyx_GIVEREF(__pyx_kp_u_FunctionDescription); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_FunctionDescription); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; @@ -8127,11 +7190,11 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_4__repr__(CYTHON_ __pyx_t_2 += 7; __Pyx_GIVEREF(__pyx_kp_u_with); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_with); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parameters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parameters); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_6, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_6, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); @@ -8141,18 +7204,19 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_4__repr__(CYTHON_ __pyx_t_2 += 8; __Pyx_GIVEREF(__pyx_kp_u_params); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_params); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "src/pyrfc/nwrfcsdk.pyx":390 + /* "pyrfc/_cyrfc.pyx":474 * }) * * def __repr__(self): # <<<<<<<<<<<<<< * return f"" + * */ /* function exit code */ @@ -8168,11570 +7232,10637 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_19FunctionDescription_4__repr__(CYTHON_ return __pyx_r; } -/* "src/pyrfc/data_container.pyx":8 - * ################################################################################ +/* "pyrfc/_cyrfc.pyx":554 * - * cdef fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_FUNCTION_HANDLE container, name, value): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * @property + * def version(self): # <<<<<<<<<<<<<< + * """Get SAP NW RFC SDK and PyRFC binding versions + * :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc, RFC_FUNCTION_HANDLE __pyx_v_container, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_PARAMETER_DESC __pyx_v_paramDesc; - SAP_UC *__pyx_v_cName; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7version_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7version_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_7version___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_7version___get__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + unsigned int __pyx_v_major; + unsigned int __pyx_v_minor; + unsigned int __pyx_v_patchlevel; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - SAP_UC *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillFunctionParameter", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/pyrfc/data_container.pyx":12 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_PARAMETER_DESC paramDesc - * cName = fillString(name) # <<<<<<<<<<<<<< - * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) - * free(cName) + /* "pyrfc/_cyrfc.pyx":558 + * :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version + * """ + * cdef unsigned major = 0 # <<<<<<<<<<<<<< + * cdef unsigned minor = 0 + * cdef unsigned patchlevel = 0 */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(4, 12, __pyx_L1_error) - __pyx_v_cName = __pyx_t_1; + __pyx_v_major = 0; - /* "src/pyrfc/data_container.pyx":13 - * cdef RFC_PARAMETER_DESC paramDesc - * cName = fillString(name) - * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) # <<<<<<<<<<<<<< - * free(cName) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":559 + * """ + * cdef unsigned major = 0 + * cdef unsigned minor = 0 # <<<<<<<<<<<<<< + * cdef unsigned patchlevel = 0 + * RfcGetVersion(&major, &minor, &patchlevel) */ - __pyx_v_rc = RfcGetParameterDescByName(__pyx_v_funcDesc, __pyx_v_cName, (&__pyx_v_paramDesc), (&__pyx_v_errorInfo)); + __pyx_v_minor = 0; - /* "src/pyrfc/data_container.pyx":14 - * cName = fillString(name) - * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) - * free(cName) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":560 + * cdef unsigned major = 0 + * cdef unsigned minor = 0 + * cdef unsigned patchlevel = 0 # <<<<<<<<<<<<<< + * RfcGetVersion(&major, &minor, &patchlevel) + * return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} */ - free(__pyx_v_cName); + __pyx_v_patchlevel = 0; - /* "src/pyrfc/data_container.pyx":15 - * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) - * free(cName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) + /* "pyrfc/_cyrfc.pyx":561 + * cdef unsigned minor = 0 + * cdef unsigned patchlevel = 0 + * RfcGetVersion(&major, &minor, &patchlevel) # <<<<<<<<<<<<<< + * return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} + * */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + (void)(RfcGetVersion((&__pyx_v_major), (&__pyx_v_minor), (&__pyx_v_patchlevel))); - /* "src/pyrfc/data_container.pyx":16 - * free(cName) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) + /* "pyrfc/_cyrfc.pyx":562 + * cdef unsigned patchlevel = 0 + * RfcGetVersion(&major, &minor, &patchlevel) + * return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 16, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_major); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_major, __pyx_t_2) < 0) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_minor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minor, __pyx_t_2) < 0) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_patchlevel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_patchLevel, __pyx_t_2) < 0) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_platform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_platform, __pyx_t_2) < 0) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":15 - * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) - * free(cName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) + /* "pyrfc/_cyrfc.pyx":554 + * + * @property + * def version(self): # <<<<<<<<<<<<<< + * """Get SAP NW RFC SDK and PyRFC binding versions + * :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version */ - } - /* "src/pyrfc/data_container.pyx":17 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":565 + * + * @property + * def options(self): # <<<<<<<<<<<<<< + * """Client connection configuration * - * cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillVariable(__pyx_v_paramDesc.type, __pyx_v_container, __pyx_v_paramDesc.name, __pyx_v_value, __pyx_v_paramDesc.typeDescHandle); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":8 - * ################################################################################ +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7options_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7options_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_7options___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_7options___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "pyrfc/_cyrfc.pyx":572 + * :type: dict + * """ + * return self.__config # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__config); + __pyx_r = __pyx_v_self->__config; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":565 + * + * @property + * def options(self): # <<<<<<<<<<<<<< + * """Client connection configuration * - * cdef fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_FUNCTION_HANDLE container, name, value): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.fillFunctionParameter", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":19 - * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) +/* "pyrfc/_cyrfc.pyx":575 + * + * @property + * def handle(self): # <<<<<<<<<<<<<< + * """Get client connection handle * - * cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillStructureField(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_STRUCTURE_HANDLE __pyx_v_container, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_FIELD_DESC __pyx_v_fieldDesc; - SAP_UC *__pyx_v_cName; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_6handle_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_6handle_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_6handle___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_6handle___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - SAP_UC *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillStructureField", 0); - - /* "src/pyrfc/data_container.pyx":23 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_FIELD_DESC fieldDesc - * cdef SAP_UC* cName = fillString(name) # <<<<<<<<<<<<<< - * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) - * free(cName) - */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(4, 23, __pyx_L1_error) - __pyx_v_cName = __pyx_t_1; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/pyrfc/data_container.pyx":24 - * cdef RFC_FIELD_DESC fieldDesc - * cdef SAP_UC* cName = fillString(name) - * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) # <<<<<<<<<<<<<< - * free(cName) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":581 + * :type: uintptr_t + * """ + * return self._handle if self._handle is not NULL else None # <<<<<<<<<<<<<< + * + * @property */ - __pyx_v_rc = RfcGetFieldDescByName(__pyx_v_typeDesc, __pyx_v_cName, (&__pyx_v_fieldDesc), (&__pyx_v_errorInfo)); + __Pyx_XDECREF(__pyx_r); + if (((__pyx_v_self->_handle != NULL) != 0)) { + __pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = 0; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_1 = Py_None; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":25 - * cdef SAP_UC* cName = fillString(name) - * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) - * free(cName) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":575 + * + * @property + * def handle(self): # <<<<<<<<<<<<<< + * """Get client connection handle + * */ - free(__pyx_v_cName); - /* "src/pyrfc/data_container.pyx":26 - * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) - * free(cName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) - */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":27 - * free(cName) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) +/* "pyrfc/_cyrfc.pyx":584 + * + * @property + * def alive(self): # <<<<<<<<<<<<<< + * """Conection alive property * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 27, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":26 - * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) - * free(cName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) - */ - } +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5alive_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5alive_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_5alive___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":28 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) # <<<<<<<<<<<<<< + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_5alive___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "pyrfc/_cyrfc.pyx":590 + * :type: boolean + * """ + * return self._handle != NULL # <<<<<<<<<<<<<< * - * cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): + * def __init__(self, config=None, **params): */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillVariable(__pyx_v_fieldDesc.type, __pyx_v_container, __pyx_v_fieldDesc.name, __pyx_v_value, __pyx_v_fieldDesc.typeDescHandle); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_handle != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":19 - * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) + /* "pyrfc/_cyrfc.pyx":584 + * + * @property + * def alive(self): # <<<<<<<<<<<<<< + * """Conection alive property * - * cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.fillStructureField", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.alive.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":30 - * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) +/* "pyrfc/_cyrfc.pyx":592 + * return self._handle != NULL * - * cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_STRUCTURE_HANDLE lineHandle + * def __init__(self, config=None, **params): # <<<<<<<<<<<<<< + * # check and set connection configuration + * config = config or {} */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillTable(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_TABLE_HANDLE __pyx_v_container, PyObject *__pyx_v_lines) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_STRUCTURE_HANDLE __pyx_v_lineHandle; - unsigned int __pyx_v_rowCount; - unsigned int __pyx_v_i; - PyObject *__pyx_v_line = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_config = 0; + PyObject *__pyx_v_params = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_params = PyDict_New(); if (unlikely(!__pyx_v_params)) return -1; + __Pyx_GOTREF(__pyx_v_params); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_config,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_config); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_params, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 592, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_config = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 592, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_params); __pyx_v_params = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection___init__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_config, __pyx_v_params); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_params); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5pyrfc_6_cyrfc_10Connection___init__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_config, PyObject *__pyx_v_params) { + PyObject *__pyx_v_k = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + unsigned int __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillTable", 0); - - /* "src/pyrfc/data_container.pyx":33 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_STRUCTURE_HANDLE lineHandle - * cdef unsigned int rowCount = int(len(lines)) # <<<<<<<<<<<<<< - * cdef unsigned int i = 0 - * while i < rowCount: - */ - __pyx_t_1 = PyObject_Length(__pyx_v_lines); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 33, __pyx_L1_error) - __pyx_v_rowCount = ((unsigned int)__pyx_t_1); - - /* "src/pyrfc/data_container.pyx":34 - * cdef RFC_STRUCTURE_HANDLE lineHandle - * cdef unsigned int rowCount = int(len(lines)) - * cdef unsigned int i = 0 # <<<<<<<<<<<<<< - * while i < rowCount: - * lineHandle = RfcAppendNewRow(container, &errorInfo) - */ - __pyx_v_i = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_INCREF(__pyx_v_config); - /* "src/pyrfc/data_container.pyx":35 - * cdef unsigned int rowCount = int(len(lines)) - * cdef unsigned int i = 0 - * while i < rowCount: # <<<<<<<<<<<<<< - * lineHandle = RfcAppendNewRow(container, &errorInfo) - * if not lineHandle: + /* "pyrfc/_cyrfc.pyx":594 + * def __init__(self, config=None, **params): + * # check and set connection configuration + * config = config or {} # <<<<<<<<<<<<<< + * for k in config: + * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: */ - while (1) { - __pyx_t_2 = ((__pyx_v_i < __pyx_v_rowCount) != 0); - if (!__pyx_t_2) break; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_config); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 594, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __Pyx_INCREF(__pyx_v_config); + __pyx_t_1 = __pyx_v_config; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3_bool_binop_done:; + __Pyx_DECREF_SET(__pyx_v_config, __pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":36 - * cdef unsigned int i = 0 - * while i < rowCount: - * lineHandle = RfcAppendNewRow(container, &errorInfo) # <<<<<<<<<<<<<< - * if not lineHandle: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":595 + * # check and set connection configuration + * config = config or {} + * for k in config: # <<<<<<<<<<<<<< + * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: + * raise RFCError(f"Connection configuration option '{k}' is not supported") */ - __pyx_v_lineHandle = RfcAppendNewRow(__pyx_v_container, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/data_container.pyx":37 - * while i < rowCount: - * lineHandle = RfcAppendNewRow(container, &errorInfo) - * if not lineHandle: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * line = lines[i] + if (likely(PyList_CheckExact(__pyx_v_config)) || PyTuple_CheckExact(__pyx_v_config)) { + __pyx_t_1 = __pyx_v_config; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 595, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 595, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 595, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); + __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":596 + * config = config or {} + * for k in config: + * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: # <<<<<<<<<<<<<< + * raise RFCError(f"Connection configuration option '{k}' is not supported") + * self.__config = {} */ - __pyx_t_2 = ((!(__pyx_v_lineHandle != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __Pyx_INCREF(__pyx_v_k); + __pyx_t_3 = __pyx_v_k; + __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_dtime, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 596, __pyx_L1_error) + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_return_import_params, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 596, __pyx_L1_error) + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_rstrip, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 596, __pyx_L1_error) + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_timeout, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 596, __pyx_L1_error) + __pyx_t_2 = __pyx_t_6; + __pyx_L8_bool_binop_done:; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (__pyx_t_2 != 0); + if (unlikely(__pyx_t_6)) { - /* "src/pyrfc/data_container.pyx":38 - * lineHandle = RfcAppendNewRow(container, &errorInfo) - * if not lineHandle: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * line = lines[i] - * if type(line) is dict: + /* "pyrfc/_cyrfc.pyx":597 + * for k in config: + * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: + * raise RFCError(f"Connection configuration option '{k}' is not supported") # <<<<<<<<<<<<<< + * self.__config = {} + * self.__config['dtime'] = config.get('dtime', False) */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 38, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Connection_configuration_option); + __pyx_t_9 += 33; + __Pyx_GIVEREF(__pyx_kp_u_Connection_configuration_option); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Connection_configuration_option); + __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_v_k, __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_10; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_INCREF(__pyx_kp_u_is_not_supported); + __pyx_t_9 += 18; + __Pyx_GIVEREF(__pyx_kp_u_is_not_supported); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u_is_not_supported); + __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_11); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 38, __pyx_L1_error) + __PYX_ERR(0, 597, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":37 - * while i < rowCount: - * lineHandle = RfcAppendNewRow(container, &errorInfo) - * if not lineHandle: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * line = lines[i] + /* "pyrfc/_cyrfc.pyx":596 + * config = config or {} + * for k in config: + * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: # <<<<<<<<<<<<<< + * raise RFCError(f"Connection configuration option '{k}' is not supported") + * self.__config = {} */ } - /* "src/pyrfc/data_container.pyx":39 - * if not lineHandle: - * raise wrapError(&errorInfo) - * line = lines[i] # <<<<<<<<<<<<<< - * if type(line) is dict: - * for name, value in line.iteritems(): + /* "pyrfc/_cyrfc.pyx":595 + * # check and set connection configuration + * config = config or {} + * for k in config: # <<<<<<<<<<<<<< + * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: + * raise RFCError(f"Connection configuration option '{k}' is not supported") + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":598 + * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: + * raise RFCError(f"Connection configuration option '{k}' is not supported") + * self.__config = {} # <<<<<<<<<<<<<< + * self.__config['dtime'] = config.get('dtime', False) + * self.__config['return_import_params'] = config.get('return_import_params', False) + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__config); + __Pyx_DECREF(__pyx_v_self->__config); + __pyx_v_self->__config = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":599 + * raise RFCError(f"Connection configuration option '{k}' is not supported") + * self.__config = {} + * self.__config['dtime'] = config.get('dtime', False) # <<<<<<<<<<<<<< + * self.__config['return_import_params'] = config.get('return_import_params', False) + * self.__config['rstrip'] = config.get('rstrip', True) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 599, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_dtime, __pyx_t_3) < 0)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":600 + * self.__config = {} + * self.__config['dtime'] = config.get('dtime', False) + * self.__config['return_import_params'] = config.get('return_import_params', False) # <<<<<<<<<<<<<< + * self.__config['rstrip'] = config.get('rstrip', True) + * self.__config['timeout'] = config.get('timeout', None) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 600, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_return_import_params, __pyx_t_1) < 0)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":601 + * self.__config['dtime'] = config.get('dtime', False) + * self.__config['return_import_params'] = config.get('return_import_params', False) + * self.__config['rstrip'] = config.get('rstrip', True) # <<<<<<<<<<<<<< + * self.__config['timeout'] = config.get('timeout', None) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 601, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_rstrip, __pyx_t_3) < 0)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":602 + * self.__config['return_import_params'] = config.get('return_import_params', False) + * self.__config['rstrip'] = config.get('rstrip', True) + * self.__config['timeout'] = config.get('timeout', None) # <<<<<<<<<<<<<< + * + * # set internal configuration + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 602, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_timeout, __pyx_t_1) < 0)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":605 + * + * # set internal configuration + * self.__bconfig = 0 # <<<<<<<<<<<<<< + * if self.__config['dtime']: + * self.__bconfig |= _MASK_DTIME + */ + __pyx_v_self->__pyx___bconfig = 0; + + /* "pyrfc/_cyrfc.pyx":606 + * # set internal configuration + * self.__bconfig = 0 + * if self.__config['dtime']: # <<<<<<<<<<<<<< + * self.__bconfig |= _MASK_DTIME + * if self.__config['return_import_params']: + */ + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 606, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_dtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 606, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { + + /* "pyrfc/_cyrfc.pyx":607 + * self.__bconfig = 0 + * if self.__config['dtime']: + * self.__bconfig |= _MASK_DTIME # <<<<<<<<<<<<<< + * if self.__config['return_import_params']: + * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_lines, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 39, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_DTIME); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_7 = PyNumber_InPlaceOr(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_7); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_self->__pyx___bconfig = __pyx_t_12; - /* "src/pyrfc/data_container.pyx":40 - * raise wrapError(&errorInfo) - * line = lines[i] - * if type(line) is dict: # <<<<<<<<<<<<<< - * for name, value in line.iteritems(): - * fillStructureField(typeDesc, lineHandle, name, value) + /* "pyrfc/_cyrfc.pyx":606 + * # set internal configuration + * self.__bconfig = 0 + * if self.__config['dtime']: # <<<<<<<<<<<<<< + * self.__bconfig |= _MASK_DTIME + * if self.__config['return_import_params']: */ - __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_line)) == ((PyObject *)(&PyDict_Type))); - __pyx_t_4 = (__pyx_t_2 != 0); - if (__pyx_t_4) { + } - /* "src/pyrfc/data_container.pyx":41 - * line = lines[i] - * if type(line) is dict: - * for name, value in line.iteritems(): # <<<<<<<<<<<<<< - * fillStructureField(typeDesc, lineHandle, name, value) - * else: + /* "pyrfc/_cyrfc.pyx":608 + * if self.__config['dtime']: + * self.__bconfig |= _MASK_DTIME + * if self.__config['return_import_params']: # <<<<<<<<<<<<<< + * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS + * if self.__config['rstrip']: */ - __pyx_t_1 = 0; - if (unlikely(__pyx_v_line == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); - __PYX_ERR(4, 41, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_line, 0, __pyx_n_s_iteritems, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_7; - __pyx_t_7 = 0; - while (1) { - __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_1, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); - if (unlikely(__pyx_t_9 == 0)) break; - if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(4, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 608, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_return_import_params); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 608, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_6) { - /* "src/pyrfc/data_container.pyx":42 - * if type(line) is dict: - * for name, value in line.iteritems(): - * fillStructureField(typeDesc, lineHandle, name, value) # <<<<<<<<<<<<<< - * else: - * fillStructureField(typeDesc, lineHandle, '', line) + /* "pyrfc/_cyrfc.pyx":609 + * self.__bconfig |= _MASK_DTIME + * if self.__config['return_import_params']: + * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS # <<<<<<<<<<<<<< + * if self.__config['rstrip']: + * self.__bconfig |= _MASK_RSTRIP */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillStructureField(__pyx_v_typeDesc, __pyx_v_lineHandle, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RETURN_IMPORT_PARAMS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_InPlaceOr(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx___bconfig = __pyx_t_12; - /* "src/pyrfc/data_container.pyx":40 - * raise wrapError(&errorInfo) - * line = lines[i] - * if type(line) is dict: # <<<<<<<<<<<<<< - * for name, value in line.iteritems(): - * fillStructureField(typeDesc, lineHandle, name, value) + /* "pyrfc/_cyrfc.pyx":608 + * if self.__config['dtime']: + * self.__bconfig |= _MASK_DTIME + * if self.__config['return_import_params']: # <<<<<<<<<<<<<< + * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS + * if self.__config['rstrip']: */ - goto __pyx_L6; - } + } - /* "src/pyrfc/data_container.pyx":44 - * fillStructureField(typeDesc, lineHandle, name, value) - * else: - * fillStructureField(typeDesc, lineHandle, '', line) # <<<<<<<<<<<<<< - * i += 1 + /* "pyrfc/_cyrfc.pyx":610 + * if self.__config['return_import_params']: + * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS + * if self.__config['rstrip']: # <<<<<<<<<<<<<< + * self.__bconfig |= _MASK_RSTRIP * */ - /*else*/ { - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillStructureField(__pyx_v_typeDesc, __pyx_v_lineHandle, __pyx_kp_s__5, __pyx_v_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __pyx_L6:; + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 610, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_6) { - /* "src/pyrfc/data_container.pyx":45 - * else: - * fillStructureField(typeDesc, lineHandle, '', line) - * i += 1 # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":611 + * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS + * if self.__config['rstrip']: + * self.__bconfig |= _MASK_RSTRIP # <<<<<<<<<<<<<< + * + * self._connection = ConnectionParameters(**params) + */ + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyNumber_InPlaceOr(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_7); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_self->__pyx___bconfig = __pyx_t_12; + + /* "pyrfc/_cyrfc.pyx":610 + * if self.__config['return_import_params']: + * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS + * if self.__config['rstrip']: # <<<<<<<<<<<<<< + * self.__bconfig |= _MASK_RSTRIP * - * cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): */ - __pyx_v_i = (__pyx_v_i + 1); } - /* "src/pyrfc/data_container.pyx":30 - * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) + /* "pyrfc/_cyrfc.pyx":613 + * self.__bconfig |= _MASK_RSTRIP * - * cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_STRUCTURE_HANDLE lineHandle + * self._connection = ConnectionParameters(**params) # <<<<<<<<<<<<<< + * self._handle = NULL + * self.active_transaction = False + */ + __pyx_t_7 = PyDict_Copy(__pyx_v_params); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_ConnectionParameters), __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->_connection); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_connection)); + __pyx_v_self->_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":614 + * + * self._connection = ConnectionParameters(**params) + * self._handle = NULL # <<<<<<<<<<<<<< + * self.active_transaction = False + * self.active_unit = False + */ + __pyx_v_self->_handle = NULL; + + /* "pyrfc/_cyrfc.pyx":615 + * self._connection = ConnectionParameters(**params) + * self._handle = NULL + * self.active_transaction = False # <<<<<<<<<<<<<< + * self.active_unit = False + * self._open() + */ + __pyx_v_self->active_transaction = 0; + + /* "pyrfc/_cyrfc.pyx":616 + * self._handle = NULL + * self.active_transaction = False + * self.active_unit = False # <<<<<<<<<<<<<< + * self._open() + * + */ + __pyx_v_self->active_unit = 0; + + /* "pyrfc/_cyrfc.pyx":617 + * self.active_transaction = False + * self.active_unit = False + * self._open() # <<<<<<<<<<<<<< + * + * def free(self): + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":592 + * return self._handle != NULL + * + * def __init__(self, config=None, **params): # <<<<<<<<<<<<<< + * # check and set connection configuration + * config = config or {} */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyrfc._cyrfc.fillTable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_line); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XDECREF(__pyx_v_config); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":47 - * i += 1 +/* "pyrfc/_cyrfc.pyx":619 + * self._open() + * + * def free(self): # <<<<<<<<<<<<<< + * """ Explicitly free connection parameters and close the connection. * - * cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillVariable(RFCTYPE __pyx_v_typ, RFC_FUNCTION_HANDLE __pyx_v_container, SAP_UC *__pyx_v_cName, PyObject *__pyx_v_value, RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_STRUCTURE_HANDLE __pyx_v_struct; - RFC_TABLE_HANDLE __pyx_v_table; - SAP_UC *__pyx_v_cValue; - SAP_RAW *__pyx_v_bValue; - PyObject *__pyx_v_name = NULL; - CYTHON_UNUSED PyObject *__pyx_v_ex = NULL; - PyObject *__pyx_v_svalue = NULL; - PyObject *__pyx_v_locale_radix = NULL; - int __pyx_v_format_ok; - PyObject *__pyx_v_e = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_2free[] = " Explicitly free connection parameters and close the connection.\n\n Note that this is usually required because the object destruction\n can be delayed by the garbage collection and problems may occur\n when too many connections are opened.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("free (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_2free(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_2free(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - SAP_RAW *__pyx_t_13; - SAP_UC *__pyx_t_14; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - char const *__pyx_t_20; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - PyObject *__pyx_t_25 = NULL; - PyObject *__pyx_t_26 = NULL; - int __pyx_t_27; - PyObject *__pyx_t_28 = NULL; - char const *__pyx_t_29; - RFC_INT __pyx_t_30; - RFC_INT8 __pyx_t_31; - Py_UCS4 __pyx_t_32; - PyObject *__pyx_t_33 = NULL; - char const *__pyx_t_34; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillVariable", 0); - __Pyx_INCREF(__pyx_v_value); + __Pyx_RefNannySetupContext("free", 0); - /* "src/pyrfc/data_container.pyx":56 - * global _LOCALE_RADIX - * # print ("fill", wrapString(cName), value, type(value)) - * try: # <<<<<<<<<<<<<< - * if typ == RFCTYPE_STRUCTURE: - * if type(value) is not dict: + /* "pyrfc/_cyrfc.pyx":626 + * when too many connections are opened. + * """ + * self.__del__() # <<<<<<<<<<<<<< + * + * def __del__(self): */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_del); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":57 - * # print ("fill", wrapString(cName), value, type(value)) - * try: - * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< - * if type(value) is not dict: - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) + /* "pyrfc/_cyrfc.pyx":619 + * self._open() + * + * def free(self): # <<<<<<<<<<<<<< + * """ Explicitly free connection parameters and close the connection. + * */ - switch (__pyx_v_typ) { - case RFCTYPE_STRUCTURE: - /* "src/pyrfc/data_container.pyx":58 - * try: - * if typ == RFCTYPE_STRUCTURE: - * if type(value) is not dict: # <<<<<<<<<<<<<< - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) - * rc = RfcGetStructure(container, cName, &struct, &errorInfo) - */ - __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyDict_Type))); - __pyx_t_5 = (__pyx_t_4 != 0); - if (unlikely(__pyx_t_5)) { + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.free", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":59 - * if typ == RFCTYPE_STRUCTURE: - * if type(value) is not dict: - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) # <<<<<<<<<<<<<< - * rc = RfcGetStructure(container, cName, &struct, &errorInfo) - * if rc != RFC_OK: +/* "pyrfc/_cyrfc.pyx":628 + * self.__del__() + * + * def __del__(self): # <<<<<<<<<<<<<< + * self._close() + * self._connection._free() */ - __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_value))); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 59, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 59, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_kp_s_dictionary_required_for_structur); - __Pyx_GIVEREF(__pyx_kp_s_dictionary_required_for_structur); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_s_dictionary_required_for_structur); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 59, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(4, 59, __pyx_L3_error) - /* "src/pyrfc/data_container.pyx":58 - * try: - * if typ == RFCTYPE_STRUCTURE: - * if type(value) is not dict: # <<<<<<<<<<<<<< - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) - * rc = RfcGetStructure(container, cName, &struct, &errorInfo) - */ - } +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_4__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":60 - * if type(value) is not dict: - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) - * rc = RfcGetStructure(container, cName, &struct, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetStructure(__pyx_v_container, __pyx_v_cName, (&__pyx_v_struct), (&__pyx_v_errorInfo)); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":61 - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) - * rc = RfcGetStructure(container, cName, &struct, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * for name, value in value.iteritems(): - */ - __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_5)) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_4__del__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__del__", 0); - /* "src/pyrfc/data_container.pyx":62 - * rc = RfcGetStructure(container, cName, &struct, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * for name, value in value.iteritems(): - * fillStructureField(typeDesc, struct, name, value) + /* "pyrfc/_cyrfc.pyx":629 + * + * def __del__(self): + * self._close() # <<<<<<<<<<<<<< + * self._connection._free() + * */ - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 62, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(4, 62, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":61 - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) - * rc = RfcGetStructure(container, cName, &struct, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * for name, value in value.iteritems(): + /* "pyrfc/_cyrfc.pyx":630 + * def __del__(self): + * self._close() + * self._connection._free() # <<<<<<<<<<<<<< + * + * def __enter__(self): */ - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_connection), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":63 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * for name, value in value.iteritems(): # <<<<<<<<<<<<<< - * fillStructureField(typeDesc, struct, name, value) - * elif typ == RFCTYPE_TABLE: + /* "pyrfc/_cyrfc.pyx":628 + * self.__del__() + * + * def __del__(self): # <<<<<<<<<<<<<< + * self._close() + * self._connection._free() */ - __pyx_t_8 = 0; - if (unlikely(__pyx_v_value == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); - __PYX_ERR(4, 63, __pyx_L3_error) - } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_value, 0, __pyx_n_s_iteritems, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 63, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); - __pyx_t_6 = __pyx_t_7; - __pyx_t_7 = 0; - while (1) { - __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_8, &__pyx_t_7, &__pyx_t_11, NULL, __pyx_t_10); - if (unlikely(__pyx_t_12 == 0)) break; - if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(4, 63, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_11); - __pyx_t_11 = 0; - /* "src/pyrfc/data_container.pyx":64 - * raise wrapError(&errorInfo) - * for name, value in value.iteritems(): - * fillStructureField(typeDesc, struct, name, value) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_TABLE: - * if type(value) is not list: - */ - __pyx_t_11 = __pyx_f_5pyrfc_6_cyrfc_fillStructureField(__pyx_v_typeDesc, __pyx_v_struct, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 64, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":57 - * # print ("fill", wrapString(cName), value, type(value)) - * try: - * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< - * if type(value) is not dict: - * raise TypeError('dictionary required for structure parameter, received', str(type(value))) +/* "pyrfc/_cyrfc.pyx":632 + * self._connection._free() + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * */ - break; - case RFCTYPE_TABLE: - /* "src/pyrfc/data_container.pyx":66 - * fillStructureField(typeDesc, struct, name, value) - * elif typ == RFCTYPE_TABLE: - * if type(value) is not list: # <<<<<<<<<<<<<< - * raise TypeError('list required for table parameter, received', str(type(value))) - * rc = RfcGetTable(container, cName, &table, &errorInfo) - */ - __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyList_Type))); - __pyx_t_4 = (__pyx_t_5 != 0); - if (unlikely(__pyx_t_4)) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_6__enter__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":67 - * elif typ == RFCTYPE_TABLE: - * if type(value) is not list: - * raise TypeError('list required for table parameter, received', str(type(value))) # <<<<<<<<<<<<<< - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: - */ - __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_value))); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 67, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 67, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_kp_s_list_required_for_table_paramete); - __Pyx_GIVEREF(__pyx_kp_s_list_required_for_table_paramete); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_list_required_for_table_paramete); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 67, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(4, 67, __pyx_L3_error) + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":66 - * fillStructureField(typeDesc, struct, name, value) - * elif typ == RFCTYPE_TABLE: - * if type(value) is not list: # <<<<<<<<<<<<<< - * raise TypeError('list required for table parameter, received', str(type(value))) - * rc = RfcGetTable(container, cName, &table, &errorInfo) - */ - } +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_6__enter__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__", 0); - /* "src/pyrfc/data_container.pyx":68 - * if type(value) is not list: - * raise TypeError('list required for table parameter, received', str(type(value))) - * rc = RfcGetTable(container, cName, &table, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":633 + * + * def __enter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __exit__(self, type, value, traceback): */ - __pyx_v_rc = RfcGetTable(__pyx_v_container, __pyx_v_cName, (&__pyx_v_table), (&__pyx_v_errorInfo)); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":69 - * raise TypeError('list required for table parameter, received', str(type(value))) - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * fillTable(typeDesc, table, value) + /* "pyrfc/_cyrfc.pyx":632 + * self._connection._free() + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * */ - __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_4)) { - /* "src/pyrfc/data_container.pyx":70 - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * fillTable(typeDesc, table, value) - * elif typ == RFCTYPE_BYTE: - */ - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 70, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(4, 70, __pyx_L3_error) + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":69 - * raise TypeError('list required for table parameter, received', str(type(value))) - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * fillTable(typeDesc, table, value) +/* "pyrfc/_cyrfc.pyx":635 + * return self + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * # Although the _close() method is also called in the destructor, the + * # explicit call assures the immediate closing to the connection. */ - } - /* "src/pyrfc/data_container.pyx":71 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * fillTable(typeDesc, table, value) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_BYTE: - * bValue = fillBytes(value) - */ - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillTable(__pyx_v_typeDesc, __pyx_v_table, __pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 71, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_type = 0; + CYTHON_UNUSED PyObject *__pyx_v_value = 0; + CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; + PyObject* values[3] = {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 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_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_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 635, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 635, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 635, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + 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); + } + __pyx_v_type = values[0]; + __pyx_v_value = values[1]; + __pyx_v_traceback = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 635, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__exit__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); - /* "src/pyrfc/data_container.pyx":65 - * for name, value in value.iteritems(): - * fillStructureField(typeDesc, struct, name, value) - * elif typ == RFCTYPE_TABLE: # <<<<<<<<<<<<<< - * if type(value) is not list: - * raise TypeError('list required for table parameter, received', str(type(value))) - */ - break; - case RFCTYPE_BYTE: + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":73 - * fillTable(typeDesc, table, value) - * elif typ == RFCTYPE_BYTE: - * bValue = fillBytes(value) # <<<<<<<<<<<<<< - * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) - * free(bValue) - */ - __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_fillBytes(__pyx_v_value); if (unlikely(__pyx_t_13 == ((SAP_RAW *)NULL))) __PYX_ERR(4, 73, __pyx_L3_error) - __pyx_v_bValue = __pyx_t_13; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_8__exit__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__exit__", 0); - /* "src/pyrfc/data_container.pyx":74 - * elif typ == RFCTYPE_BYTE: - * bValue = fillBytes(value) - * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) # <<<<<<<<<<<<<< - * free(bValue) - * elif typ == RFCTYPE_XSTRING: + /* "pyrfc/_cyrfc.pyx":638 + * # Although the _close() method is also called in the destructor, the + * # explicit call assures the immediate closing to the connection. + * self._close() # <<<<<<<<<<<<<< + * + * def open(self): */ - __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 74, __pyx_L3_error) - __pyx_v_rc = RfcSetBytes(__pyx_v_container, __pyx_v_cName, __pyx_v_bValue, ((unsigned int)__pyx_t_9), (&__pyx_v_errorInfo)); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":75 - * bValue = fillBytes(value) - * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) - * free(bValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_XSTRING: - * bValue = fillBytes(value) + /* "pyrfc/_cyrfc.pyx":635 + * return self + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * # Although the _close() method is also called in the destructor, the + * # explicit call assures the immediate closing to the connection. */ - free(__pyx_v_bValue); - /* "src/pyrfc/data_container.pyx":72 - * raise wrapError(&errorInfo) - * fillTable(typeDesc, table, value) - * elif typ == RFCTYPE_BYTE: # <<<<<<<<<<<<<< - * bValue = fillBytes(value) - * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) - */ - break; - case RFCTYPE_XSTRING: + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":77 - * free(bValue) - * elif typ == RFCTYPE_XSTRING: - * bValue = fillBytes(value) # <<<<<<<<<<<<<< - * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) - * free(bValue) +/* "pyrfc/_cyrfc.pyx":640 + * self._close() + * + * def open(self): # <<<<<<<<<<<<<< + * """ Open client the connection + * */ - __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_fillBytes(__pyx_v_value); if (unlikely(__pyx_t_13 == ((SAP_RAW *)NULL))) __PYX_ERR(4, 77, __pyx_L3_error) - __pyx_v_bValue = __pyx_t_13; - /* "src/pyrfc/data_container.pyx":78 - * elif typ == RFCTYPE_XSTRING: - * bValue = fillBytes(value) - * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) # <<<<<<<<<<<<<< - * free(bValue) - * elif typ == RFCTYPE_CHAR: - */ - __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 78, __pyx_L3_error) - __pyx_v_rc = RfcSetXString(__pyx_v_container, __pyx_v_cName, __pyx_v_bValue, ((unsigned int)__pyx_t_9), (&__pyx_v_errorInfo)); +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_11open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_10open[] = " Open client the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be opened.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_11open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("open (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_10open(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":79 - * bValue = fillBytes(value) - * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) - * free(bValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_CHAR: - * if type(value) is not str: - */ - free(__pyx_v_bValue); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":76 - * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) - * free(bValue) - * elif typ == RFCTYPE_XSTRING: # <<<<<<<<<<<<<< - * bValue = fillBytes(value) - * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) - */ - break; - case RFCTYPE_CHAR: +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_10open(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("open", 0); - /* "src/pyrfc/data_container.pyx":81 - * free(bValue) - * elif typ == RFCTYPE_CHAR: - * if type(value) is not str: # <<<<<<<<<<<<<< - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) + /* "pyrfc/_cyrfc.pyx":646 + * thereof if the connection cannot be opened. + * """ + * self._open() # <<<<<<<<<<<<<< + * + * def reopen(self): */ - __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyString_Type))); - __pyx_t_5 = (__pyx_t_4 != 0); - if (unlikely(__pyx_t_5)) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":82 - * elif typ == RFCTYPE_CHAR: - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * cValue = fillString(value) - * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) + /* "pyrfc/_cyrfc.pyx":640 + * self._close() + * + * def open(self): # <<<<<<<<<<<<<< + * """ Open client the connection + * */ - __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 82, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_kp_s_an_string_is_required_received); - __Pyx_GIVEREF(__pyx_kp_s_an_string_is_required_received); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_an_string_is_required_received); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 82, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(4, 82, __pyx_L3_error) - /* "src/pyrfc/data_container.pyx":81 - * free(bValue) - * elif typ == RFCTYPE_CHAR: - * if type(value) is not str: # <<<<<<<<<<<<<< - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) - */ - } + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":83 - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) # <<<<<<<<<<<<<< - * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) +/* "pyrfc/_cyrfc.pyx":648 + * self._open() + * + * def reopen(self): # <<<<<<<<<<<<<< + * """ Re-open client the connection + * */ - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 83, __pyx_L3_error) - __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/data_container.pyx":84 - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) - * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< - * free(cValue) - * elif typ == RFCTYPE_STRING: - */ - __pyx_v_rc = RfcSetChars(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_13reopen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_12reopen[] = " Re-open client the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be re-opened.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_13reopen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reopen (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_12reopen(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":85 - * cValue = fillString(value) - * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_STRING: - * if type(value) is not str: - */ - free(__pyx_v_cValue); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":80 - * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) - * free(bValue) - * elif typ == RFCTYPE_CHAR: # <<<<<<<<<<<<<< - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) - */ - break; - case RFCTYPE_STRING: +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_12reopen(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("reopen", 0); - /* "src/pyrfc/data_container.pyx":87 - * free(cValue) - * elif typ == RFCTYPE_STRING: - * if type(value) is not str: # <<<<<<<<<<<<<< - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) + /* "pyrfc/_cyrfc.pyx":654 + * thereof if the connection cannot be re-opened. + * """ + * self._reopen() # <<<<<<<<<<<<<< + * + * def close(self): */ - __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyString_Type))); - __pyx_t_4 = (__pyx_t_5 != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_reopen(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":88 - * elif typ == RFCTYPE_STRING: - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * cValue = fillString(value) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + /* "pyrfc/_cyrfc.pyx":648 + * self._open() + * + * def reopen(self): # <<<<<<<<<<<<<< + * """ Re-open client the connection + * */ - __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 88, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_kp_s_an_string_is_required_received); - __Pyx_GIVEREF(__pyx_kp_s_an_string_is_required_received); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_an_string_is_required_received); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 88, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(4, 88, __pyx_L3_error) - /* "src/pyrfc/data_container.pyx":87 - * free(cValue) - * elif typ == RFCTYPE_STRING: - * if type(value) is not str: # <<<<<<<<<<<<<< - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) - */ - } + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.reopen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":89 - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) # <<<<<<<<<<<<<< - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) +/* "pyrfc/_cyrfc.pyx":656 + * self._reopen() + * + * def close(self): # <<<<<<<<<<<<<< + * """ Close the connection + * */ - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 89, __pyx_L3_error) - __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/data_container.pyx":90 - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< - * free(cValue) - * elif typ == RFCTYPE_NUM: - */ - __pyx_v_rc = RfcSetString(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_14close[] = " Close the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be closed cleanly.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("close (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_14close(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":91 - * cValue = fillString(value) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_NUM: - * try: - */ - free(__pyx_v_cValue); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":86 - * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) - * elif typ == RFCTYPE_STRING: # <<<<<<<<<<<<<< - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) - */ - break; - case RFCTYPE_NUM: +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_14close(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("close", 0); - /* "src/pyrfc/data_container.pyx":93 - * free(cValue) - * elif typ == RFCTYPE_NUM: - * try: # <<<<<<<<<<<<<< - * if value.isdigit(): - * cValue = fillString(value) + /* "pyrfc/_cyrfc.pyx":662 + * thereof if the connection cannot be closed cleanly. + * """ + * self._close() # <<<<<<<<<<<<<< + * + * def cancel(self): */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_17); - /*try:*/ { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":94 - * elif typ == RFCTYPE_NUM: - * try: - * if value.isdigit(): # <<<<<<<<<<<<<< - * cValue = fillString(value) - * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) + /* "pyrfc/_cyrfc.pyx":656 + * self._reopen() + * + * def close(self): # <<<<<<<<<<<<<< + * """ Close the connection + * */ - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_isdigit); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 94, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 94, __pyx_L17_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 94, __pyx_L17_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (likely(__pyx_t_4)) { - /* "src/pyrfc/data_container.pyx":95 - * try: - * if value.isdigit(): - * cValue = fillString(value) # <<<<<<<<<<<<<< - * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) - */ - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 95, __pyx_L17_error) - __pyx_v_cValue = __pyx_t_14; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.close", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":96 - * if value.isdigit(): - * cValue = fillString(value) - * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< - * free(cValue) - * else: +/* "pyrfc/_cyrfc.pyx":664 + * self._close() + * + * def cancel(self): # <<<<<<<<<<<<<< + * """ Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function + * */ - __pyx_v_rc = RfcSetNum(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":97 - * cValue = fillString(value) - * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) # <<<<<<<<<<<<<< - * else: - * raise - */ - free(__pyx_v_cValue); +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_17cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_16cancel[] = " Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be cancelled cleanly.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_17cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("cancel (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_16cancel(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":94 - * elif typ == RFCTYPE_NUM: - * try: - * if value.isdigit(): # <<<<<<<<<<<<<< - * cValue = fillString(value) - * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) - */ - goto __pyx_L23; - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":99 - * free(cValue) - * else: - * raise # <<<<<<<<<<<<<< - * except Exception as ex: - * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) - */ - /*else*/ { - __Pyx_ReraiseException(); __PYX_ERR(4, 99, __pyx_L17_error) - } - __pyx_L23:; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_16cancel(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cancel", 0); - /* "src/pyrfc/data_container.pyx":93 - * free(cValue) - * elif typ == RFCTYPE_NUM: - * try: # <<<<<<<<<<<<<< - * if value.isdigit(): - * cValue = fillString(value) + /* "pyrfc/_cyrfc.pyx":670 + * thereof if the connection cannot be cancelled cleanly. + * """ + * cancel_connection(self) # <<<<<<<<<<<<<< + * + * def __bool__(self): */ - } - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - goto __pyx_L22_try_end; - __pyx_L17_error:; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cancel_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":100 - * else: - * raise - * except Exception as ex: # <<<<<<<<<<<<<< - * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + /* "pyrfc/_cyrfc.pyx":664 + * self._close() + * + * def cancel(self): # <<<<<<<<<<<<<< + * """ Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function + * */ - __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_10) { - __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_11, &__pyx_t_7) < 0) __PYX_ERR(4, 100, __pyx_L19_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_11); - __pyx_v_ex = __pyx_t_11; - /*try:*/ { - /* "src/pyrfc/data_container.pyx":101 - * raise - * except Exception as ex: - * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: - * # cast to string prevents rounding errors in NWRFC SDK - */ - __pyx_t_18 = PyTuple_New(4); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 101, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_INCREF(__pyx_kp_s_a_numeric_string_is_required_rec); - __Pyx_GIVEREF(__pyx_kp_s_a_numeric_string_is_required_rec); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_kp_s_a_numeric_string_is_required_rec); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_18, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_18, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 101, __pyx_L29_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_Raise(__pyx_t_19, 0, 0, 0); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __PYX_ERR(4, 101, __pyx_L29_error) - } + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.cancel", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":100 - * else: - * raise - * except Exception as ex: # <<<<<<<<<<<<<< - * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: +/* "pyrfc/_cyrfc.pyx":672 + * cancel_connection(self) + * + * def __bool__(self): # <<<<<<<<<<<<<< + * return self.alive + * */ - /*finally:*/ { - __pyx_L29_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_26); - __pyx_t_10 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_20 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26); - } - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_ErrRestore(__pyx_t_21, __pyx_t_22, __pyx_t_23); - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_20; - goto __pyx_L19_except_error; - } - } - } - goto __pyx_L19_except_error; - __pyx_L19_except_error:; - /* "src/pyrfc/data_container.pyx":93 - * free(cValue) - * elif typ == RFCTYPE_NUM: - * try: # <<<<<<<<<<<<<< - * if value.isdigit(): - * cValue = fillString(value) - */ - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); - goto __pyx_L3_error; - __pyx_L22_try_end:; - } +/* Python wrapper */ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_19__bool__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_19__bool__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_18__bool__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":92 - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) - * elif typ == RFCTYPE_NUM: # <<<<<<<<<<<<<< - * try: - * if value.isdigit(): - */ - break; - case RFCTYPE_BCD: + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":102 - * except Exception as ex: - * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< - * # cast to string prevents rounding errors in NWRFC SDK - * try: - */ - case RFCTYPE_FLOAT: - case RFCTYPE_DECF16: - case RFCTYPE_DECF34: +static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_18__bool__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__bool__", 0); - /* "src/pyrfc/data_container.pyx":104 - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: - * # cast to string prevents rounding errors in NWRFC SDK - * try: # <<<<<<<<<<<<<< - * if type(value) is float or type(value) is Decimal: - * svalue = str(value) + /* "pyrfc/_cyrfc.pyx":673 + * + * def __bool__(self): + * return self.alive # <<<<<<<<<<<<<< + * + * cdef _reopen(self): */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_15); - /*try:*/ { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":105 - * # cast to string prevents rounding errors in NWRFC SDK - * try: - * if type(value) is float or type(value) is Decimal: # <<<<<<<<<<<<<< - * svalue = str(value) - * else: + /* "pyrfc/_cyrfc.pyx":672 + * cancel_connection(self) + * + * def __bool__(self): # <<<<<<<<<<<<<< + * return self.alive + * */ - __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)(&PyFloat_Type))); - __pyx_t_27 = (__pyx_t_5 != 0); - if (!__pyx_t_27) { - } else { - __pyx_t_4 = __pyx_t_27; - goto __pyx_L42_bool_binop_done; - } - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 105, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_27 = (((PyObject *)Py_TYPE(__pyx_v_value)) == __pyx_t_7); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = (__pyx_t_27 != 0); - __pyx_t_4 = __pyx_t_5; - __pyx_L42_bool_binop_done:; - if (__pyx_t_4) { - /* "src/pyrfc/data_container.pyx":106 - * try: - * if type(value) is float or type(value) is Decimal: - * svalue = str(value) # <<<<<<<<<<<<<< - * else: - * # string passed from application should be locale correct, do nothing - */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 106, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_v_svalue = __pyx_t_7; - __pyx_t_7 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":105 - * # cast to string prevents rounding errors in NWRFC SDK - * try: - * if type(value) is float or type(value) is Decimal: # <<<<<<<<<<<<<< - * svalue = str(value) - * else: +/* "pyrfc/_cyrfc.pyx":675 + * return self.alive + * + * cdef _reopen(self): # <<<<<<<<<<<<<< + * self._close() + * self._open() */ - goto __pyx_L41; - } - /* "src/pyrfc/data_container.pyx":109 - * else: - * # string passed from application should be locale correct, do nothing - * svalue = value # <<<<<<<<<<<<<< - * # decimal separator must be "." for the Decimal parsing check - * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] - */ - /*else*/ { - __Pyx_INCREF(__pyx_v_value); - __pyx_v_svalue = __pyx_v_value; - } - __pyx_L41:; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__reopen(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_reopen", 0); - /* "src/pyrfc/data_container.pyx":111 - * svalue = value - * # decimal separator must be "." for the Decimal parsing check - * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] # <<<<<<<<<<<<<< - * if locale_radix != ".": - * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) + /* "pyrfc/_cyrfc.pyx":676 + * + * cdef _reopen(self): + * self._close() # <<<<<<<<<<<<<< + * self._open() + * */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_LOCALE_RADIX); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 111, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_v_locale_radix = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":112 - * # decimal separator must be "." for the Decimal parsing check - * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] - * if locale_radix != ".": # <<<<<<<<<<<<<< - * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) - * else: + /* "pyrfc/_cyrfc.pyx":677 + * cdef _reopen(self): + * self._close() + * self._open() # <<<<<<<<<<<<<< + * + * cdef _open(self): */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_locale_radix, __pyx_kp_s__8, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 112, __pyx_L35_error) - if (__pyx_t_4) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":113 - * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] - * if locale_radix != ".": - * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) # <<<<<<<<<<<<<< - * else: - * Decimal(svalue) + /* "pyrfc/_cyrfc.pyx":675 + * return self.alive + * + * cdef _reopen(self): # <<<<<<<<<<<<<< + * self._close() + * self._open() */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_svalue, __pyx_n_s_rsplit); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_18 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) { - __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_19); - if (likely(__pyx_t_18)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_19, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_19)) { - PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_v_locale_radix, __pyx_int_1}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { - PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_v_locale_radix, __pyx_int_1}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else - #endif - { - __pyx_t_28 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_28)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_28); - if (__pyx_t_18) { - __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_18); __pyx_t_18 = NULL; - } - __Pyx_INCREF(__pyx_v_locale_radix); - __Pyx_GIVEREF(__pyx_v_locale_radix); - PyTuple_SET_ITEM(__pyx_t_28, 0+__pyx_t_12, __pyx_v_locale_radix); - __Pyx_INCREF(__pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_28, 1+__pyx_t_12, __pyx_int_1); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_28, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - } - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = __Pyx_PyString_Join(__pyx_kp_s__8, __pyx_t_6); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_6, __pyx_t_19) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_19); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 113, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/data_container.pyx":112 - * # decimal separator must be "." for the Decimal parsing check - * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] - * if locale_radix != ".": # <<<<<<<<<<<<<< - * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) - * else: - */ - goto __pyx_L44; - } + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._reopen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":115 - * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) - * else: - * Decimal(svalue) # <<<<<<<<<<<<<< - * cValue = fillString(svalue) - * except Exception as ex: +/* "pyrfc/_cyrfc.pyx":679 + * self._open() + * + * cdef _open(self): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * with nogil: */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 115, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_19, __pyx_v_svalue) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_svalue); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 115, __pyx_L35_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __pyx_L44:; - /* "src/pyrfc/data_container.pyx":116 - * else: - * Decimal(svalue) - * cValue = fillString(svalue) # <<<<<<<<<<<<<< - * except Exception as ex: - * raise TypeError('a decimal value required, received', value, 'of type', type(value)) - */ - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_svalue); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 116, __pyx_L35_error) - __pyx_v_cValue = __pyx_t_14; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__open(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_open", 0); - /* "src/pyrfc/data_container.pyx":104 - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: - * # cast to string prevents rounding errors in NWRFC SDK - * try: # <<<<<<<<<<<<<< - * if type(value) is float or type(value) is Decimal: - * svalue = str(value) + /* "pyrfc/_cyrfc.pyx":681 + * cdef _open(self): + * cdef RFC_ERROR_INFO errorInfo + * with nogil: # <<<<<<<<<<<<<< + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) + * if not self._handle: */ - } - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - goto __pyx_L40_try_end; - __pyx_L35_error:; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "src/pyrfc/data_container.pyx":117 - * Decimal(svalue) - * cValue = fillString(svalue) - * except Exception as ex: # <<<<<<<<<<<<<< - * raise TypeError('a decimal value required, received', value, 'of type', type(value)) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + /* "pyrfc/_cyrfc.pyx":682 + * cdef RFC_ERROR_INFO errorInfo + * with nogil: + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) # <<<<<<<<<<<<<< + * if not self._handle: + * self._error(&errorInfo) */ - __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_12) { - __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_19) < 0) __PYX_ERR(4, 117, __pyx_L37_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GOTREF(__pyx_t_19); - __Pyx_INCREF(__pyx_t_11); - __pyx_v_ex = __pyx_t_11; - /*try:*/ { + __pyx_v_self->_handle = RfcOpenConnection(__pyx_v_self->_connection->_params, __pyx_v_self->_connection->_params_count, (&__pyx_v_errorInfo)); + } - /* "src/pyrfc/data_container.pyx":118 - * cValue = fillString(svalue) - * except Exception as ex: - * raise TypeError('a decimal value required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) + /* "pyrfc/_cyrfc.pyx":681 + * cdef _open(self): + * cdef RFC_ERROR_INFO errorInfo + * with nogil: # <<<<<<<<<<<<<< + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) + * if not self._handle: */ - __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 118, __pyx_L50_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_kp_s_a_decimal_value_required_receive); - __Pyx_GIVEREF(__pyx_kp_s_a_decimal_value_required_receive); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_a_decimal_value_required_receive); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_28 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_28)) __PYX_ERR(4, 118, __pyx_L50_error) - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_28, 0, 0, 0); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __PYX_ERR(4, 118, __pyx_L50_error) - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; + } + } - /* "src/pyrfc/data_container.pyx":117 - * Decimal(svalue) - * cValue = fillString(svalue) - * except Exception as ex: # <<<<<<<<<<<<<< - * raise TypeError('a decimal value required, received', value, 'of type', type(value)) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + /* "pyrfc/_cyrfc.pyx":683 + * with nogil: + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) + * if not self._handle: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - /*finally:*/ { - __pyx_L50_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_26); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_21); - __pyx_t_12 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_29 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21); - } - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ErrRestore(__pyx_t_26, __pyx_t_25, __pyx_t_24); - __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; - __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_29; - goto __pyx_L37_except_error; - } - } - } - goto __pyx_L37_except_error; - __pyx_L37_except_error:; + __pyx_t_1 = ((!(__pyx_v_self->_handle != 0)) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":104 - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: - * # cast to string prevents rounding errors in NWRFC SDK - * try: # <<<<<<<<<<<<<< - * if type(value) is float or type(value) is Decimal: - * svalue = str(value) + /* "pyrfc/_cyrfc.pyx":684 + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) + * if not self._handle: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * def _close(self): */ - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15); - goto __pyx_L3_error; - __pyx_L40_try_end:; - } + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":119 - * except Exception as ex: - * raise TypeError('a decimal value required, received', value, 'of type', type(value)) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< - * free(cValue) - * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): + /* "pyrfc/_cyrfc.pyx":683 + * with nogil: + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) + * if not self._handle: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_v_rc = RfcSetString(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); + } - /* "src/pyrfc/data_container.pyx":120 - * raise TypeError('a decimal value required, received', value, 'of type', type(value)) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) # <<<<<<<<<<<<<< - * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): - * if type(value) is not int: + /* "pyrfc/_cyrfc.pyx":679 + * self._open() + * + * cdef _open(self): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * with nogil: */ - free(__pyx_v_cValue); - /* "src/pyrfc/data_container.pyx":102 - * except Exception as ex: - * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) - * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< - * # cast to string prevents rounding errors in NWRFC SDK - * try: - */ - break; - case RFCTYPE_INT: + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":121 - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) - * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): # <<<<<<<<<<<<<< - * if type(value) is not int: - * raise TypeError('an integer required, received', value, 'of type', type(value)) +/* "pyrfc/_cyrfc.pyx":686 + * self._error(&errorInfo) + * + * def _close(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - case RFCTYPE_INT1: - case RFCTYPE_INT2: - /* "src/pyrfc/data_container.pyx":122 - * free(cValue) - * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): - * if type(value) is not int: # <<<<<<<<<<<<<< - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt(container, cName, value, &errorInfo) +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_21_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_21_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_close (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_20_close(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_20_close(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_close", 0); + + /* "pyrfc/_cyrfc.pyx":689 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if self._handle != NULL: # <<<<<<<<<<<<<< + * rc = RfcCloseConnection(self._handle, &errorInfo) + * self._handle = NULL */ - __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyInt_Type))); - __pyx_t_5 = (__pyx_t_4 != 0); - if (unlikely(__pyx_t_5)) { + __pyx_t_1 = ((__pyx_v_self->_handle != NULL) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":123 - * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): - * if type(value) is not int: - * raise TypeError('an integer required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * rc = RfcSetInt(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_INT8: + /* "pyrfc/_cyrfc.pyx":690 + * cdef RFC_ERROR_INFO errorInfo + * if self._handle != NULL: + * rc = RfcCloseConnection(self._handle, &errorInfo) # <<<<<<<<<<<<<< + * self._handle = NULL + * if rc != RFC_OK: */ - __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 123, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_INCREF(__pyx_kp_s_an_integer_required_received); - __Pyx_GIVEREF(__pyx_kp_s_an_integer_required_received); - PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_s_an_integer_required_received); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_19, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_19, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 123, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(4, 123, __pyx_L3_error) + __pyx_v_rc = RfcCloseConnection(__pyx_v_self->_handle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":122 - * free(cValue) - * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): - * if type(value) is not int: # <<<<<<<<<<<<<< - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt(container, cName, value, &errorInfo) + /* "pyrfc/_cyrfc.pyx":691 + * if self._handle != NULL: + * rc = RfcCloseConnection(self._handle, &errorInfo) + * self._handle = NULL # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - } + __pyx_v_self->_handle = NULL; - /* "src/pyrfc/data_container.pyx":124 - * if type(value) is not int: - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt(container, cName, value, &errorInfo) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_INT8: - * if type(value) is not int: + /* "pyrfc/_cyrfc.pyx":692 + * rc = RfcCloseConnection(self._handle, &errorInfo) + * self._handle = NULL + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_t_30 = __Pyx_PyInt_As_RFC_INT(__pyx_v_value); if (unlikely((__pyx_t_30 == ((RFC_INT)-1)) && PyErr_Occurred())) __PYX_ERR(4, 124, __pyx_L3_error) - __pyx_v_rc = RfcSetInt(__pyx_v_container, __pyx_v_cName, __pyx_t_30, (&__pyx_v_errorInfo)); + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":121 - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) - * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): # <<<<<<<<<<<<<< - * if type(value) is not int: - * raise TypeError('an integer required, received', value, 'of type', type(value)) + /* "pyrfc/_cyrfc.pyx":693 + * self._handle = NULL + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * cdef _error(self, RFC_ERROR_INFO* errorInfo): */ - break; - case RFCTYPE_INT8: + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":126 - * rc = RfcSetInt(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_INT8: - * if type(value) is not int: # <<<<<<<<<<<<<< - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt8(container, cName, value, &errorInfo) + /* "pyrfc/_cyrfc.pyx":692 + * rc = RfcCloseConnection(self._handle, &errorInfo) + * self._handle = NULL + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyInt_Type))); - __pyx_t_4 = (__pyx_t_5 != 0); - if (unlikely(__pyx_t_4)) { + } - /* "src/pyrfc/data_container.pyx":127 - * elif typ == RFCTYPE_INT8: - * if type(value) is not int: - * raise TypeError('an integer required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * rc = RfcSetInt8(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_UTCLONG: + /* "pyrfc/_cyrfc.pyx":689 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if self._handle != NULL: # <<<<<<<<<<<<<< + * rc = RfcCloseConnection(self._handle, &errorInfo) + * self._handle = NULL */ - __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 127, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_kp_s_an_integer_required_received); - __Pyx_GIVEREF(__pyx_kp_s_an_integer_required_received); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_an_integer_required_received); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 127, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_Raise(__pyx_t_19, 0, 0, 0); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __PYX_ERR(4, 127, __pyx_L3_error) + } - /* "src/pyrfc/data_container.pyx":126 - * rc = RfcSetInt(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_INT8: - * if type(value) is not int: # <<<<<<<<<<<<<< - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt8(container, cName, value, &errorInfo) + /* "pyrfc/_cyrfc.pyx":686 + * self._error(&errorInfo) + * + * def _close(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - } - /* "src/pyrfc/data_container.pyx":128 - * if type(value) is not int: - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt8(container, cName, value, &errorInfo) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_UTCLONG: - * if type(value) is not str: - */ - __pyx_t_31 = __Pyx_PyInt_As_RFC_INT8(__pyx_v_value); if (unlikely((__pyx_t_31 == ((RFC_INT8)-1)) && PyErr_Occurred())) __PYX_ERR(4, 128, __pyx_L3_error) - __pyx_v_rc = RfcSetInt8(__pyx_v_container, __pyx_v_cName, __pyx_t_31, (&__pyx_v_errorInfo)); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._close", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":125 - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_INT8: # <<<<<<<<<<<<<< - * if type(value) is not int: - * raise TypeError('an integer required, received', value, 'of type', type(value)) +/* "pyrfc/_cyrfc.pyx":695 + * self._error(&errorInfo) + * + * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * """ + * Error treatment of a connection. */ - break; - case RFCTYPE_UTCLONG: - /* "src/pyrfc/data_container.pyx":130 - * rc = RfcSetInt8(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_UTCLONG: - * if type(value) is not str: # <<<<<<<<<<<<<< - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) - */ - __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyString_Type))); - __pyx_t_5 = (__pyx_t_4 != 0); - if (unlikely(__pyx_t_5)) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__error(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, RFC_ERROR_INFO *__pyx_v_errorInfo) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_error", 0); - /* "src/pyrfc/data_container.pyx":131 - * elif typ == RFCTYPE_UTCLONG: - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * cValue = fillString(value) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + /* "pyrfc/_cyrfc.pyx":710 + * # self.alive = False + * + * raise wrapError(errorInfo) # <<<<<<<<<<<<<< + * + * def ping(self): */ - __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 131, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_INCREF(__pyx_kp_s_an_string_is_required_received); - __Pyx_GIVEREF(__pyx_kp_s_an_string_is_required_received); - PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_s_an_string_is_required_received); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_19, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_19, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 131, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(4, 131, __pyx_L3_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError(__pyx_v_errorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 710, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":130 - * rc = RfcSetInt8(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_UTCLONG: - * if type(value) is not str: # <<<<<<<<<<<<<< - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) + /* "pyrfc/_cyrfc.pyx":695 + * self._error(&errorInfo) + * + * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * """ + * Error treatment of a connection. */ - } - /* "src/pyrfc/data_container.pyx":132 - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) # <<<<<<<<<<<<<< - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) - */ - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 132, __pyx_L3_error) - __pyx_v_cValue = __pyx_t_14; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":133 - * raise TypeError('an string is required, received', value, 'of type', type(value)) - * cValue = fillString(value) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< - * free(cValue) - * elif typ == RFCTYPE_DATE: +/* "pyrfc/_cyrfc.pyx":712 + * raise wrapError(errorInfo) + * + * def ping(self): # <<<<<<<<<<<<<< + * """ Send a RFC Ping through the current connection + * */ - __pyx_v_rc = RfcSetString(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":134 - * cValue = fillString(value) - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_DATE: - * if value: - */ - free(__pyx_v_cValue); +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_23ping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_22ping[] = " Send a RFC Ping through the current connection\n\n Returns nothing.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the RFC Ping fails.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_23ping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ping (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_22ping(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":129 - * raise TypeError('an integer required, received', value, 'of type', type(value)) - * rc = RfcSetInt8(container, cName, value, &errorInfo) - * elif typ == RFCTYPE_UTCLONG: # <<<<<<<<<<<<<< - * if type(value) is not str: - * raise TypeError('an string is required, received', value, 'of type', type(value)) + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_22ping(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ping", 0); + + /* "pyrfc/_cyrfc.pyx":722 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * rc = RfcPing(self._handle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - break; - case RFCTYPE_DATE: + __pyx_v_rc = RfcPing(__pyx_v_self->_handle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":136 - * free(cValue) - * elif typ == RFCTYPE_DATE: - * if value: # <<<<<<<<<<<<<< - * format_ok = True - * if type(value) is date: + /* "pyrfc/_cyrfc.pyx":723 + * cdef RFC_ERROR_INFO errorInfo + * rc = RfcPing(self._handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 136, __pyx_L3_error) - if (__pyx_t_5) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":137 - * elif typ == RFCTYPE_DATE: - * if value: - * format_ok = True # <<<<<<<<<<<<<< - * if type(value) is date: - * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') + /* "pyrfc/_cyrfc.pyx":724 + * rc = RfcPing(self._handle, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * def reset_server_context(self): */ - __pyx_v_format_ok = 1; + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":138 - * if value: - * format_ok = True - * if type(value) is date: # <<<<<<<<<<<<<< - * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') - * else: + /* "pyrfc/_cyrfc.pyx":723 + * cdef RFC_ERROR_INFO errorInfo + * rc = RfcPing(self._handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_date); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 138, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) == __pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { + } - /* "src/pyrfc/data_container.pyx":139 - * format_ok = True - * if type(value) is date: - * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') # <<<<<<<<<<<<<< - * else: - * try: + /* "pyrfc/_cyrfc.pyx":712 + * raise wrapError(errorInfo) + * + * def ping(self): # <<<<<<<<<<<<<< + * """ Send a RFC Ping through the current connection + * */ - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = 0; - __pyx_t_32 = 127; - __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_year); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_19, __pyx_kp_u_04); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_32; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_month); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_19 = __Pyx_PyObject_Format(__pyx_t_7, __pyx_kp_u_02); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) : __pyx_t_32; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_19); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_19); - __pyx_t_19 = 0; - __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_day); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_19, __pyx_kp_u_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_32; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __pyx_t_9, __pyx_t_32); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_7); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 139, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/data_container.pyx":138 - * if value: - * format_ok = True - * if type(value) is date: # <<<<<<<<<<<<<< - * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') - * else: + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.ping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":726 + * self._error(&errorInfo) + * + * def reset_server_context(self): # <<<<<<<<<<<<<< + * """ Resets the SAP server context ("user context / ABAP session context") + * associated with the given client connection, but does not close the connection */ - goto __pyx_L60; - } - /* "src/pyrfc/data_container.pyx":141 - * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') - * else: - * try: # <<<<<<<<<<<<<< - * if len(value) != 8: - * format_ok = False +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_25reset_server_context(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_24reset_server_context[] = " Resets the SAP server context (\"user context / ABAP session context\")\n associated with the given client connection, but does not close the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof in case resetting the server context fails.\n (Better close the connection in that case.).\n :exc:`sapnwrf2.CommunicationError` if no conversion\n was found for the\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_25reset_server_context(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset_server_context (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_24reset_server_context(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_24reset_server_context(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("reset_server_context", 0); + + /* "pyrfc/_cyrfc.pyx":739 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * rc = RfcResetServerContext(self._handle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - /*else*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_17); - /*try:*/ { + __pyx_v_rc = RfcResetServerContext(__pyx_v_self->_handle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":142 - * else: - * try: - * if len(value) != 8: # <<<<<<<<<<<<<< - * format_ok = False - * else: + /* "pyrfc/_cyrfc.pyx":740 + * cdef RFC_ERROR_INFO errorInfo + * rc = RfcResetServerContext(self._handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 142, __pyx_L61_error) - __pyx_t_4 = ((__pyx_t_9 != 8) != 0); - if (__pyx_t_4) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":143 - * try: - * if len(value) != 8: - * format_ok = False # <<<<<<<<<<<<<< - * else: - * if len(value.rstrip()) > 0: + /* "pyrfc/_cyrfc.pyx":741 + * rc = RfcResetServerContext(self._handle, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * def get_connection_attributes(self): */ - __pyx_v_format_ok = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":142 - * else: - * try: - * if len(value) != 8: # <<<<<<<<<<<<<< - * format_ok = False - * else: + /* "pyrfc/_cyrfc.pyx":740 + * cdef RFC_ERROR_INFO errorInfo + * rc = RfcResetServerContext(self._handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - goto __pyx_L67; - } + } - /* "src/pyrfc/data_container.pyx":145 - * format_ok = False - * else: - * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< - * date(int(value[:4]), int(value[4:6]), int(value[6:8])) - * cValue = fillString(value) + /* "pyrfc/_cyrfc.pyx":726 + * self._error(&errorInfo) + * + * def reset_server_context(self): # <<<<<<<<<<<<<< + * """ Resets the SAP server context ("user context / ABAP session context") + * associated with the given client connection, but does not close the connection */ - /*else*/ { - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 145, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_19) : __Pyx_PyObject_CallNoArg(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 145, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 145, __pyx_L61_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_4 = ((__pyx_t_9 > 0) != 0); - if (__pyx_t_4) { - /* "src/pyrfc/data_container.pyx":146 - * else: - * if len(value.rstrip()) > 0: - * date(int(value[:4]), int(value[4:6]), int(value[6:8])) # <<<<<<<<<<<<<< - * cValue = fillString(value) - * except Exception as ex: + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.reset_server_context", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":743 + * self._error(&errorInfo) + * + * def get_connection_attributes(self): # <<<<<<<<<<<<<< + * """ Get connection details + * */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_date); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_19 = __Pyx_PyObject_GetSlice(__pyx_v_value, 0, 4, NULL, NULL, &__pyx_slice__9, 0, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_28 = __Pyx_PyNumber_Int(__pyx_t_19); if (unlikely(!__pyx_t_28)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = __Pyx_PyObject_GetSlice(__pyx_v_value, 4, 6, NULL, NULL, &__pyx_slice__10, 1, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = __Pyx_PyObject_GetSlice(__pyx_v_value, 6, 8, NULL, NULL, &__pyx_slice__11, 1, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_18 = __Pyx_PyNumber_Int(__pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_19, __pyx_t_28, __pyx_t_6, __pyx_t_18}; - __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_19, __pyx_t_28, __pyx_t_6, __pyx_t_18}; - __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_33 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_33); - if (__pyx_t_19) { - __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_19); __pyx_t_19 = NULL; - } - __Pyx_GIVEREF(__pyx_t_28); - PyTuple_SET_ITEM(__pyx_t_33, 0+__pyx_t_10, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_33, 1+__pyx_t_10, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_33, 2+__pyx_t_10, __pyx_t_18); - __pyx_t_28 = 0; - __pyx_t_6 = 0; - __pyx_t_18 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_33, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 146, __pyx_L61_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0; - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/data_container.pyx":145 - * format_ok = False - * else: - * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< - * date(int(value[:4]), int(value[4:6]), int(value[6:8])) - * cValue = fillString(value) - */ - } +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_27get_connection_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_26get_connection_attributes[] = " Get connection details\n\n :returns: Mapping of connection information keys:\n\n * active_unit: True if there is a filled and submitted unit w/o being confirmed or destroyed.\n * dest: RFC destination\n * host: Own host name\n * partnerHost: Partner host name\n * sysNumber: R/3 system number\n * sysId: R/3 system ID\n * client: Client (\"Mandant\")\n * user: User\n * language: Language\n * trace: Trace level (0-3)\n * isoLanguage: 2-byte ISO-Language\n * codepage: Own code page\n * partnerCodepage: Partner code page\n * rfcRole: C/S: RFC Client / RFC Server\n * type: 2/3/E/R: R/2,R/3,Ext,Reg.Ext\n * partnerType: 2/3/E/R: R/2,R/3,Ext,Reg.Ext\n * rel: My system release\n * partnerRe: Partner system release\n * kernelRel: Partner kernel release\n * cpicConvId: CPI-C Conversation ID\n * progName: Name calling APAB program (report, module pool)\n * partnerBytesPerChar: Bytes per char in backend codepage.\n * partnerSystemCodepage: Partner system code page\n * reserved: Reserved for later use\n\n Note: all values, except ``active_unit`` are right stripped string values.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if the RFC call fails.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_27get_connection_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_connection_attributes (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_26get_connection_attributes(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":147 - * if len(value.rstrip()) > 0: - * date(int(value[:4]), int(value[4:6]), int(value[6:8])) - * cValue = fillString(value) # <<<<<<<<<<<<<< - * except Exception as ex: - * format_ok = False - */ - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 147, __pyx_L61_error) - __pyx_v_cValue = __pyx_t_14; - } - __pyx_L67:; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":141 - * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') - * else: - * try: # <<<<<<<<<<<<<< - * if len(value) != 8: - * format_ok = False - */ - } - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - goto __pyx_L66_try_end; - __pyx_L61_error:; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_26get_connection_attributes(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_ATTRIBUTES __pyx_v_attributes; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_connection_attributes", 0); - /* "src/pyrfc/data_container.pyx":148 - * date(int(value[:4]), int(value[4:6]), int(value[6:8])) - * cValue = fillString(value) - * except Exception as ex: # <<<<<<<<<<<<<< - * format_ok = False - * if not format_ok: + /* "pyrfc/_cyrfc.pyx":781 + * cdef RFC_ATTRIBUTES attributes + * + * result = {} # <<<<<<<<<<<<<< + * + * if self.is_valid(): */ - __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_10) { - __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_33) < 0) __PYX_ERR(4, 148, __pyx_L63_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GOTREF(__pyx_t_33); - __Pyx_INCREF(__pyx_t_11); - __pyx_v_ex = __pyx_t_11; - /*try:*/ { + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":149 - * cValue = fillString(value) - * except Exception as ex: - * format_ok = False # <<<<<<<<<<<<<< - * if not format_ok: - * raise TypeError('date value required, received', value, 'of type', type(value)) + /* "pyrfc/_cyrfc.pyx":783 + * result = {} + * + * if self.is_valid(): # <<<<<<<<<<<<<< + * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) + * if rc != RFC_OK: */ - __pyx_v_format_ok = 0; - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_valid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 783, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { - /* "src/pyrfc/data_container.pyx":148 - * date(int(value[:4]), int(value[4:6]), int(value[6:8])) - * cValue = fillString(value) - * except Exception as ex: # <<<<<<<<<<<<<< - * format_ok = False - * if not format_ok: + /* "pyrfc/_cyrfc.pyx":784 + * + * if self.is_valid(): + * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - /*finally:*/ { - /*normal exit:*/{ - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - goto __pyx_L75; - } - __pyx_L75:; - } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - goto __pyx_L62_exception_handled; - } - goto __pyx_L63_except_error; - __pyx_L63_except_error:; + __pyx_v_rc = RfcGetConnectionAttributes(__pyx_v_self->_handle, (&__pyx_v_attributes), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":141 - * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') - * else: - * try: # <<<<<<<<<<<<<< - * if len(value) != 8: - * format_ok = False + /* "pyrfc/_cyrfc.pyx":785 + * if self.is_valid(): + * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); - goto __pyx_L3_error; - __pyx_L62_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); - __pyx_L66_try_end:; - } - } - __pyx_L60:; + __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_4) { - /* "src/pyrfc/data_container.pyx":150 - * except Exception as ex: - * format_ok = False - * if not format_ok: # <<<<<<<<<<<<<< - * raise TypeError('date value required, received', value, 'of type', type(value)) - * rc = RfcSetDate(container, cName, cValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":786 + * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * result = wrapConnectionAttributes(attributes) */ - __pyx_t_4 = ((!(__pyx_v_format_ok != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":151 - * format_ok = False - * if not format_ok: - * raise TypeError('date value required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * rc = RfcSetDate(container, cName, cValue, &errorInfo) - * free(cValue) + /* "pyrfc/_cyrfc.pyx":785 + * if self.is_valid(): + * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_t_33 = PyTuple_New(4); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 151, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_33); - __Pyx_INCREF(__pyx_kp_s_date_value_required_received); - __Pyx_GIVEREF(__pyx_kp_s_date_value_required_received); - PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_kp_s_date_value_required_received); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_33, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_33, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_33, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 151, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(4, 151, __pyx_L3_error) + } - /* "src/pyrfc/data_container.pyx":150 - * except Exception as ex: - * format_ok = False - * if not format_ok: # <<<<<<<<<<<<<< - * raise TypeError('date value required, received', value, 'of type', type(value)) - * rc = RfcSetDate(container, cName, cValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":788 + * self._error(&errorInfo) + * + * result = wrapConnectionAttributes(attributes) # <<<<<<<<<<<<<< + * result.update({ + * 'active_unit': self.active_unit or self.active_transaction */ - } + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapConnectionAttributes(__pyx_v_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":152 - * if not format_ok: - * raise TypeError('date value required, received', value, 'of type', type(value)) - * rc = RfcSetDate(container, cName, cValue, &errorInfo) # <<<<<<<<<<<<<< - * free(cValue) - * else: + /* "pyrfc/_cyrfc.pyx":789 + * + * result = wrapConnectionAttributes(attributes) + * result.update({ # <<<<<<<<<<<<<< + * 'active_unit': self.active_unit or self.active_transaction + * }) */ - __pyx_v_rc = RfcSetDate(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, (&__pyx_v_errorInfo)); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "src/pyrfc/data_container.pyx":153 - * raise TypeError('date value required, received', value, 'of type', type(value)) - * rc = RfcSetDate(container, cName, cValue, &errorInfo) - * free(cValue) # <<<<<<<<<<<<<< - * else: - * rc = RFC_OK + /* "pyrfc/_cyrfc.pyx":790 + * result = wrapConnectionAttributes(attributes) + * result.update({ + * 'active_unit': self.active_unit or self.active_transaction # <<<<<<<<<<<<<< + * }) + * return result */ - free(__pyx_v_cValue); + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!__pyx_v_self->active_unit) { + } else { + __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->active_unit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->active_transaction); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __pyx_t_6; + __pyx_t_6 = 0; + __pyx_L5_bool_binop_done:; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_active_unit, __pyx_t_5) < 0) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":136 - * free(cValue) - * elif typ == RFCTYPE_DATE: - * if value: # <<<<<<<<<<<<<< - * format_ok = True - * if type(value) is date: + /* "pyrfc/_cyrfc.pyx":783 + * result = {} + * + * if self.is_valid(): # <<<<<<<<<<<<<< + * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) + * if rc != RFC_OK: */ - goto __pyx_L59; - } + } - /* "src/pyrfc/data_container.pyx":155 - * free(cValue) - * else: - * rc = RFC_OK # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_TIME: - * if value: + /* "pyrfc/_cyrfc.pyx":792 + * 'active_unit': self.active_unit or self.active_transaction + * }) + * return result # <<<<<<<<<<<<<< + * + * def is_valid(self): */ - /*else*/ { - __pyx_v_rc = RFC_OK; - } - __pyx_L59:; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":135 - * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - * free(cValue) - * elif typ == RFCTYPE_DATE: # <<<<<<<<<<<<<< - * if value: - * format_ok = True + /* "pyrfc/_cyrfc.pyx":743 + * self._error(&errorInfo) + * + * def get_connection_attributes(self): # <<<<<<<<<<<<<< + * """ Get connection details + * */ - break; - case RFCTYPE_TIME: - /* "src/pyrfc/data_container.pyx":157 - * rc = RFC_OK - * elif typ == RFCTYPE_TIME: - * if value: # <<<<<<<<<<<<<< - * format_ok = True - * if type(value) is time: - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 157, __pyx_L3_error) - if (__pyx_t_4) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.get_connection_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":158 - * elif typ == RFCTYPE_TIME: - * if value: - * format_ok = True # <<<<<<<<<<<<<< - * if type(value) is time: - * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') +/* "pyrfc/_cyrfc.pyx":794 + * return result + * + * def is_valid(self): # <<<<<<<<<<<<<< + * """Checks an RFC connection. Can be used to check whether a client/server connection + * has already been closed, or whether the NW RFC library still "considers" the connection */ - __pyx_v_format_ok = 1; - /* "src/pyrfc/data_container.pyx":159 - * if value: - * format_ok = True - * if type(value) is time: # <<<<<<<<<<<<<< - * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') - * else: - */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_time); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 159, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) == __pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_29is_valid(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_28is_valid[] = "Checks an RFC connection. Can be used to check whether a client/server connection\n has already been closed, or whether the NW RFC library still \"considers\" the connection\n to be open.\n\n .. note::\n This does not guarantee that the connection is indeed still alive:\n A firewall may silently have closed the connection without notifying\n the endpoints. If you want to find out, whether the connection is still alive,\n you'll have to use the more expensive RfcPing().\n\n :returns: boolean\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_29is_valid(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_valid (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_28is_valid(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":160 - * format_ok = True - * if type(value) is time: - * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') # <<<<<<<<<<<<<< - * else: - * try: - */ - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = 0; - __pyx_t_32 = 127; - __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_hour); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_33); - __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_33, __pyx_kp_u_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_32; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_minute); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_33 = __Pyx_PyObject_Format(__pyx_t_7, __pyx_kp_u_02); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_33); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_33) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_33) : __pyx_t_32; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_33); - __Pyx_GIVEREF(__pyx_t_33); - PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_33); - __pyx_t_33 = 0; - __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_second); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_33); - __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_33, __pyx_kp_u_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0; - __pyx_t_32 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_32) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_32; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __pyx_t_9, __pyx_t_32); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_7); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 160, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_cValue = __pyx_t_14; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":159 - * if value: - * format_ok = True - * if type(value) is time: # <<<<<<<<<<<<<< - * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') - * else: - */ - goto __pyx_L78; - } +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_28is_valid(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_INT __pyx_v_isValid; + RFC_RC __pyx_v_rc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("is_valid", 0); - /* "src/pyrfc/data_container.pyx":162 - * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') - * else: - * try: # <<<<<<<<<<<<<< - * if len(value) != 6: - * format_ok = False + /* "pyrfc/_cyrfc.pyx":810 + * cdef RFC_INT isValid + * + * rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) # <<<<<<<<<<<<<< + * + * if rc != RFC_OK or errorInfo.code != RFC_OK: */ - /*else*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_15); - /*try:*/ { + __pyx_v_rc = RfcIsConnectionHandleValid(__pyx_v_self->_handle, (&__pyx_v_isValid), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":163 - * else: - * try: - * if len(value) != 6: # <<<<<<<<<<<<<< - * format_ok = False - * else: + /* "pyrfc/_cyrfc.pyx":812 + * rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) + * + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * return False + * return True */ - __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 163, __pyx_L79_error) - __pyx_t_5 = ((__pyx_t_9 != 6) != 0); - if (__pyx_t_5) { + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":164 - * try: - * if len(value) != 6: - * format_ok = False # <<<<<<<<<<<<<< - * else: - * if len(value.rstrip()) > 0: + /* "pyrfc/_cyrfc.pyx":813 + * + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * return False # <<<<<<<<<<<<<< + * return True + * */ - __pyx_v_format_ok = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_False); + __pyx_r = Py_False; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":163 - * else: - * try: - * if len(value) != 6: # <<<<<<<<<<<<<< - * format_ok = False - * else: + /* "pyrfc/_cyrfc.pyx":812 + * rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) + * + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * return False + * return True */ - goto __pyx_L85; - } + } - /* "src/pyrfc/data_container.pyx":166 - * format_ok = False - * else: - * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< - * time(int(value[:2]), int(value[2:4]), int(value[4:6])) - * cValue = fillString(value) + /* "pyrfc/_cyrfc.pyx":814 + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * return False + * return True # <<<<<<<<<<<<<< + * + * # def c_handle_test(self, p_handle): */ - /*else*/ { - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 166, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_33 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_33 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_33)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_33); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - } - } - __pyx_t_7 = (__pyx_t_33) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_33) : __Pyx_PyObject_CallNoArg(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 166, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 166, __pyx_L79_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_5 = ((__pyx_t_9 > 0) != 0); - if (__pyx_t_5) { - - /* "src/pyrfc/data_container.pyx":167 - * else: - * if len(value.rstrip()) > 0: - * time(int(value[:2]), int(value[2:4]), int(value[4:6])) # <<<<<<<<<<<<<< - * cValue = fillString(value) - * except Exception as ex: - */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_time); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_33 = __Pyx_PyObject_GetSlice(__pyx_v_value, 0, 2, NULL, NULL, &__pyx_slice__12, 0, 1, 1); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_33); - __pyx_t_18 = __Pyx_PyNumber_Int(__pyx_t_33); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0; - __pyx_t_33 = __Pyx_PyObject_GetSlice(__pyx_v_value, 2, 4, NULL, NULL, &__pyx_slice__13, 1, 1, 1); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_33); - __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_33); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0; - __pyx_t_33 = __Pyx_PyObject_GetSlice(__pyx_v_value, 4, 6, NULL, NULL, &__pyx_slice__10, 1, 1, 1); if (unlikely(!__pyx_t_33)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_33); - __pyx_t_28 = __Pyx_PyNumber_Int(__pyx_t_33); if (unlikely(!__pyx_t_28)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0; - __pyx_t_33 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_33 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_33)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_33); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_33, __pyx_t_18, __pyx_t_6, __pyx_t_28}; - __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_33, __pyx_t_18, __pyx_t_6, __pyx_t_28}; - __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - } else - #endif - { - __pyx_t_19 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_19); - if (__pyx_t_33) { - __Pyx_GIVEREF(__pyx_t_33); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_33); __pyx_t_33 = NULL; - } - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_t_18); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_28); - PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_10, __pyx_t_28); - __pyx_t_18 = 0; - __pyx_t_6 = 0; - __pyx_t_28 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 167, __pyx_L79_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "src/pyrfc/data_container.pyx":166 - * format_ok = False - * else: - * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< - * time(int(value[:2]), int(value[2:4]), int(value[4:6])) - * cValue = fillString(value) - */ - } - - /* "src/pyrfc/data_container.pyx":168 - * if len(value.rstrip()) > 0: - * time(int(value[:2]), int(value[2:4]), int(value[4:6])) - * cValue = fillString(value) # <<<<<<<<<<<<<< - * except Exception as ex: - * format_ok = False - */ - __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(4, 168, __pyx_L79_error) - __pyx_v_cValue = __pyx_t_14; - } - __pyx_L85:; - - /* "src/pyrfc/data_container.pyx":162 - * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') - * else: - * try: # <<<<<<<<<<<<<< - * if len(value) != 6: - * format_ok = False - */ - } - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - goto __pyx_L84_try_end; - __pyx_L79_error:; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "src/pyrfc/data_container.pyx":169 - * time(int(value[:2]), int(value[2:4]), int(value[4:6])) - * cValue = fillString(value) - * except Exception as ex: # <<<<<<<<<<<<<< - * format_ok = False - * - */ - __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_10) { - __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_19) < 0) __PYX_ERR(4, 169, __pyx_L81_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GOTREF(__pyx_t_19); - __Pyx_INCREF(__pyx_t_11); - __pyx_v_ex = __pyx_t_11; - /*try:*/ { - - /* "src/pyrfc/data_container.pyx":170 - * cValue = fillString(value) - * except Exception as ex: - * format_ok = False # <<<<<<<<<<<<<< - * - * if not format_ok: - */ - __pyx_v_format_ok = 0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_True); + __pyx_r = Py_True; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":169 - * time(int(value[:2]), int(value[2:4]), int(value[4:6])) - * cValue = fillString(value) - * except Exception as ex: # <<<<<<<<<<<<<< - * format_ok = False + /* "pyrfc/_cyrfc.pyx":794 + * return result * + * def is_valid(self): # <<<<<<<<<<<<<< + * """Checks an RFC connection. Can be used to check whether a client/server connection + * has already been closed, or whether the NW RFC library still "considers" the connection */ - /*finally:*/ { - /*normal exit:*/{ - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - goto __pyx_L93; - } - __pyx_L93:; - } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - goto __pyx_L80_exception_handled; - } - goto __pyx_L81_except_error; - __pyx_L81_except_error:; - - /* "src/pyrfc/data_container.pyx":162 - * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') - * else: - * try: # <<<<<<<<<<<<<< - * if len(value) != 6: - * format_ok = False - */ - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15); - goto __pyx_L3_error; - __pyx_L80_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15); - __pyx_L84_try_end:; - } - } - __pyx_L78:; - /* "src/pyrfc/data_container.pyx":172 - * format_ok = False - * - * if not format_ok: # <<<<<<<<<<<<<< - * raise TypeError('time value required, received', value, 'of type', type(value)) - * rc = RfcSetTime(container, cName, cValue, &errorInfo) - */ - __pyx_t_5 = ((!(__pyx_v_format_ok != 0)) != 0); - if (unlikely(__pyx_t_5)) { + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":173 +/* "pyrfc/_cyrfc.pyx":823 + * # print("c:handle", "ok" if c_handle - self._handle == 0 else "error") * - * if not format_ok: - * raise TypeError('time value required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< - * rc = RfcSetTime(container, cName, cValue, &errorInfo) - * free(cValue) - */ - __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 173, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_INCREF(__pyx_kp_s_time_value_required_received); - __Pyx_GIVEREF(__pyx_kp_s_time_value_required_received); - PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_s_time_value_required_received); - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); - PyTuple_SET_ITEM(__pyx_t_19, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_19, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 173, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(4, 173, __pyx_L3_error) - - /* "src/pyrfc/data_container.pyx":172 - * format_ok = False + * def get_function_description(self, func_name): # <<<<<<<<<<<<<< + * """ Returns a function description of a function module. * - * if not format_ok: # <<<<<<<<<<<<<< - * raise TypeError('time value required, received', value, 'of type', type(value)) - * rc = RfcSetTime(container, cName, cValue, &errorInfo) - */ - } - - /* "src/pyrfc/data_container.pyx":174 - * if not format_ok: - * raise TypeError('time value required, received', value, 'of type', type(value)) - * rc = RfcSetTime(container, cName, cValue, &errorInfo) # <<<<<<<<<<<<<< - * free(cValue) - * else: - */ - __pyx_v_rc = RfcSetTime(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/data_container.pyx":175 - * raise TypeError('time value required, received', value, 'of type', type(value)) - * rc = RfcSetTime(container, cName, cValue, &errorInfo) - * free(cValue) # <<<<<<<<<<<<<< - * else: - * rc = RFC_OK - */ - free(__pyx_v_cValue); - - /* "src/pyrfc/data_container.pyx":157 - * rc = RFC_OK - * elif typ == RFCTYPE_TIME: - * if value: # <<<<<<<<<<<<<< - * format_ok = True - * if type(value) is time: */ - goto __pyx_L77; - } - /* "src/pyrfc/data_container.pyx":177 - * free(cValue) - * else: - * rc = RFC_OK # <<<<<<<<<<<<<< - * else: - * raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) - */ - /*else*/ { - __pyx_v_rc = RFC_OK; - } - __pyx_L77:; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_31get_function_description(PyObject *__pyx_v_self, PyObject *__pyx_v_func_name); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_30get_function_description[] = " Returns a function description of a function module.\n\n :param func_name: Name of the function module whose description\n will be returned.\n :type func_name: string\n\n :return: A :class:`FunctionDescription` object.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_31get_function_description(PyObject *__pyx_v_self, PyObject *__pyx_v_func_name) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_function_description (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_30get_function_description(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_func_name)); - /* "src/pyrfc/data_container.pyx":156 - * else: - * rc = RFC_OK - * elif typ == RFCTYPE_TIME: # <<<<<<<<<<<<<< - * if value: - * format_ok = True - */ - break; - default: + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":179 - * rc = RFC_OK - * else: - * raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) # <<<<<<<<<<<<<< - * except TypeError as e: - * # This way the field name will be attached in reverse direction - */ - __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 179, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_7 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_typ); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 179, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_28 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_cName, NULL); if (unlikely(!__pyx_t_28)) __PYX_ERR(4, 179, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 179, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_28); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_28); - __pyx_t_7 = 0; - __pyx_t_28 = 0; - __pyx_t_28 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_RFC_type_d_when_filling, __pyx_t_6); if (unlikely(!__pyx_t_28)) __PYX_ERR(4, 179, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_19); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_19, function); - } - } - __pyx_t_11 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_19, __pyx_t_6, __pyx_t_28) : __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_28); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 179, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(4, 179, __pyx_L3_error) - break; - } +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_30get_function_description(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_func_name) { + RFC_ERROR_INFO __pyx_v_errorInfo; + SAP_UC *__pyx_v_funcName; + RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + SAP_UC *__pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_function_description", 0); - /* "src/pyrfc/data_container.pyx":56 - * global _LOCALE_RADIX - * # print ("fill", wrapString(cName), value, type(value)) - * try: # <<<<<<<<<<<<<< - * if typ == RFCTYPE_STRUCTURE: - * if type(value) is not dict: + /* "pyrfc/_cyrfc.pyx":833 + * """ + * cdef RFC_ERROR_INFO errorInfo + * funcName = fillString(func_name.upper()) # <<<<<<<<<<<<<< + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_name, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_28); __pyx_t_28 = 0; - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 833, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_funcName = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":180 - * else: - * raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) - * except TypeError as e: # <<<<<<<<<<<<<< - * # This way the field name will be attached in reverse direction - * # to the argument list of the exception. This helps users to find + /* "pyrfc/_cyrfc.pyx":834 + * cdef RFC_ERROR_INFO errorInfo + * funcName = fillString(func_name.upper()) + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< + * free(funcName) + * if not funcDesc: */ - __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); - if (__pyx_t_10) { - __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_19, &__pyx_t_28) < 0) __PYX_ERR(4, 180, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GOTREF(__pyx_t_19); - __Pyx_GOTREF(__pyx_t_28); - __Pyx_INCREF(__pyx_t_19); - __pyx_v_e = __pyx_t_19; - /*try:*/ { + __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":184 - * # to the argument list of the exception. This helps users to find - * # mistakes easier in complex mapping scenarios. - * e.args += (wrapString(cName), ) # <<<<<<<<<<<<<< - * raise - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":835 + * funcName = fillString(func_name.upper()) + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) # <<<<<<<<<<<<<< + * if not funcDesc: + * self._error(&errorInfo) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 184, __pyx_L100_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_cName, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 184, __pyx_L100_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(4, 184, __pyx_L100_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_18); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 184, __pyx_L100_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_args, __pyx_t_7) < 0) __PYX_ERR(4, 184, __pyx_L100_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + free(__pyx_v_funcName); - /* "src/pyrfc/data_container.pyx":185 - * # mistakes easier in complex mapping scenarios. - * e.args += (wrapString(cName), ) - * raise # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":836 + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return wrapFunctionDescription(funcDesc) */ - __Pyx_GIVEREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_19); - __Pyx_XGIVEREF(__pyx_t_28); - __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_19, __pyx_t_28); - __pyx_t_11 = 0; __pyx_t_19 = 0; __pyx_t_28 = 0; - __PYX_ERR(4, 185, __pyx_L100_error) - } + __pyx_t_5 = ((!(__pyx_v_funcDesc != 0)) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":180 - * else: - * raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) - * except TypeError as e: # <<<<<<<<<<<<<< - * # This way the field name will be attached in reverse direction - * # to the argument list of the exception. This helps users to find + /* "pyrfc/_cyrfc.pyx":837 + * free(funcName) + * if not funcDesc: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * return wrapFunctionDescription(funcDesc) + * */ - /*finally:*/ { - __pyx_L100_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __pyx_t_10 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_34 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); - } - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17); - __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; - __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_34; - goto __pyx_L5_except_error; - } - } - } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":56 - * global _LOCALE_RADIX - * # print ("fill", wrapString(cName), value, type(value)) - * try: # <<<<<<<<<<<<<< - * if typ == RFCTYPE_STRUCTURE: - * if type(value) is not dict: + /* "pyrfc/_cyrfc.pyx":836 + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return wrapFunctionDescription(funcDesc) */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L8_try_end:; } - /* "src/pyrfc/data_container.pyx":186 - * e.args += (wrapString(cName), ) - * raise - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * - */ - __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_5)) { - - /* "src/pyrfc/data_container.pyx":187 - * raise - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":838 + * if not funcDesc: + * self._error(&errorInfo) + * return wrapFunctionDescription(funcDesc) # <<<<<<<<<<<<<< * - * cdef SAP_RAW* fillBytes(pystr) except NULL: + * def call(self, func_name, options=None, **params): */ - __pyx_t_28 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_28)) __PYX_ERR(4, 187, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_28); - __Pyx_Raise(__pyx_t_28, 0, 0, 0); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __PYX_ERR(4, 187, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapFunctionDescription(__pyx_v_funcDesc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":186 - * e.args += (wrapString(cName), ) - * raise - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":823 + * # print("c:handle", "ok" if c_handle - self._handle == 0 else "error") * - */ - } - - /* "src/pyrfc/data_container.pyx":47 - * i += 1 + * def get_function_description(self, func_name): # <<<<<<<<<<<<<< + * """ Returns a function description of a function module. * - * cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_28); - __Pyx_XDECREF(__pyx_t_33); - __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.get_function_description", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_ex); - __Pyx_XDECREF(__pyx_v_svalue); - __Pyx_XDECREF(__pyx_v_locale_radix); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XDECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":189 - * raise wrapError(&errorInfo) +/* "pyrfc/_cyrfc.pyx":840 + * return wrapFunctionDescription(funcDesc) + * + * def call(self, func_name, options=None, **params): # <<<<<<<<<<<<<< + * """ Invokes a remote-enabled function module via RFC. * - * cdef SAP_RAW* fillBytes(pystr) except NULL: # <<<<<<<<<<<<<< - * cdef size_t size = len(pystr) - * cdef SAP_RAW* bytes = malloc(size) */ -static SAP_RAW *__pyx_f_5pyrfc_6_cyrfc_fillBytes(PyObject *__pyx_v_pystr) { - size_t __pyx_v_size; - SAP_RAW *__pyx_v_bytes; - SAP_RAW *__pyx_r; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - char *__pyx_t_2; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_33call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_32call[] = " Invokes a remote-enabled function module via RFC.\n\n :param func_name: Name of the function module that will be invoked.\n :type func_name: string\n\n :param options: Call options for single remote ABAP function call. Allowed keys:\n\n - ``not_requested`` Allows to deactivate certain parameters in the function module interface.\n This is particularly useful for BAPIs which have many large tables, the Python client is not interested in.\n Deactivate those, to reduce network traffic and memory consumption in your application considerably.\n\n This functionality can be used for input and output parameters. If the parameter is an input, no data for\n that parameter will be sent to the backend. If it's an output, the backend will be informed not to return\n data for that parameter.\n\n - ``timeout`` Cancel RFC connection if ongoing RFC call not completed within ``timeout`` seconds.\n Timeout can be also set as client connection configuration option, in which case is valid for all RFC calls.\n\n Examples: https://github.com/SAP/PyRFC/tree/main/examples/timeout\n\n :type options: dictionary\n\n :param params: Parameter of the function module. All non optional\n IMPORT, CHANGING, and TABLE parameters must be provided.\n :type params: keyword arguments\n\n :return: Dictionary with all EXPORT, CHANGING, and TABLE parameters.\n The IMPORT parameters are also given, if :attr:`Connection.config.return_import_params`\n is set to ``True``.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the RFC call fails.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_33call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_func_name = 0; + PyObject *__pyx_v_options = 0; + PyObject *__pyx_v_params = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillBytes", 0); - - /* "src/pyrfc/data_container.pyx":190 - * - * cdef SAP_RAW* fillBytes(pystr) except NULL: - * cdef size_t size = len(pystr) # <<<<<<<<<<<<<< - * cdef SAP_RAW* bytes = malloc(size) - * memcpy(bytes, pystr, size) - */ - __pyx_t_1 = PyObject_Length(__pyx_v_pystr); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 190, __pyx_L1_error) - __pyx_v_size = __pyx_t_1; - - /* "src/pyrfc/data_container.pyx":191 - * cdef SAP_RAW* fillBytes(pystr) except NULL: - * cdef size_t size = len(pystr) - * cdef SAP_RAW* bytes = malloc(size) # <<<<<<<<<<<<<< - * memcpy(bytes, pystr, size) - * return bytes - */ - __pyx_v_bytes = ((SAP_RAW *)malloc(__pyx_v_size)); - - /* "src/pyrfc/data_container.pyx":192 - * cdef size_t size = len(pystr) - * cdef SAP_RAW* bytes = malloc(size) - * memcpy(bytes, pystr, size) # <<<<<<<<<<<<<< - * return bytes - * - */ - __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_pystr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 192, __pyx_L1_error) - (void)(memcpy(__pyx_v_bytes, ((char *)__pyx_t_2), __pyx_v_size)); - - /* "src/pyrfc/data_container.pyx":193 - * cdef SAP_RAW* bytes = malloc(size) - * memcpy(bytes, pystr, size) - * return bytes # <<<<<<<<<<<<<< - * - * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): - */ - __pyx_r = __pyx_v_bytes; - goto __pyx_L0; - - /* "src/pyrfc/data_container.pyx":189 - * raise wrapError(&errorInfo) - * - * cdef SAP_RAW* fillBytes(pystr) except NULL: # <<<<<<<<<<<<<< - * cdef size_t size = len(pystr) - * cdef SAP_RAW* bytes = malloc(size) - */ + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("call (wrapper)", 0); + __pyx_v_params = PyDict_New(); if (unlikely(!__pyx_v_params)) return NULL; + __Pyx_GOTREF(__pyx_v_params); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_options,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 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_func_name)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_params, values, pos_args, "call") < 0)) __PYX_ERR(0, 840, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_func_name = values[0]; + __pyx_v_options = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("call", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 840, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_params); __pyx_v_params = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.call", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_32call(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_func_name, __pyx_v_options, __pyx_v_params); /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.fillBytes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; + __Pyx_XDECREF(__pyx_v_params); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":195 - * return bytes - * - * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * group2error = { - * ABAPApplicationError: ABAP_APPLICATION_FAILURE, - */ - -static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillError(PyObject *__pyx_v_exception, RFC_ERROR_INFO *__pyx_v_errorInfo) { - PyObject *__pyx_v_group2error = NULL; - PyObject *__pyx_v_str = NULL; - SAP_UC *__pyx_v_sapuc; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_32call(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_options, PyObject *__pyx_v_params) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_ERROR_INFO __pyx_v_openErrorInfo; + SAP_UC *__pyx_v_cName; + SAP_UC *__pyx_v_funcName; + RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; + RFC_FUNCTION_HANDLE __pyx_v_funcCont; + int __pyx_v_isActive; + PyObject *__pyx_v_skip_parameters = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_cancel_timer = NULL; + PyObject *__pyx_v_timeout = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_closed_handle = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - RFC_ERROR_GROUP __pyx_t_6; - SAP_UC *__pyx_t_7; - long __pyx_t_8; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + SAP_UC *__pyx_t_8; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - RFC_RC __pyx_t_11; - RFC_RC __pyx_t_12; + Py_UCS4 __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + Py_ssize_t __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + char const *__pyx_t_17; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillError", 0); - - /* "src/pyrfc/data_container.pyx":197 - * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): - * group2error = { - * ABAPApplicationError: ABAP_APPLICATION_FAILURE, # <<<<<<<<<<<<<< - * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, - * LogonError: LOGON_FAILURE, - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ABAPApplicationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_APPLICATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/data_container.pyx":198 - * group2error = { - * ABAPApplicationError: ABAP_APPLICATION_FAILURE, - * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, # <<<<<<<<<<<<<< - * LogonError: LOGON_FAILURE, - * CommunicationError: COMMUNICATION_FAILURE, - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ABAPRuntimeError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_RUNTIME_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/data_container.pyx":199 - * ABAPApplicationError: ABAP_APPLICATION_FAILURE, - * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, - * LogonError: LOGON_FAILURE, # <<<<<<<<<<<<<< - * CommunicationError: COMMUNICATION_FAILURE, - * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LogonError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(LOGON_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_RefNannySetupContext("call", 0); + __Pyx_INCREF(__pyx_v_options); - /* "src/pyrfc/data_container.pyx":200 - * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, - * LogonError: LOGON_FAILURE, - * CommunicationError: COMMUNICATION_FAILURE, # <<<<<<<<<<<<<< - * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, - * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, + /* "pyrfc/_cyrfc.pyx":878 + * cdef RFC_ERROR_INFO openErrorInfo + * cdef SAP_UC *cName + * if type(func_name) is not str: # <<<<<<<<<<<<<< + * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) + * cdef SAP_UC *funcName = fillString(func_name) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CommunicationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(COMMUNICATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_func_name)) != ((PyObject *)(&PyString_Type))); + __pyx_t_2 = (__pyx_t_1 != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/data_container.pyx":201 - * LogonError: LOGON_FAILURE, - * CommunicationError: COMMUNICATION_FAILURE, - * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, # <<<<<<<<<<<<<< - * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, - * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE + /* "pyrfc/_cyrfc.pyx":879 + * cdef SAP_UC *cName + * if type(func_name) is not str: + * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) # <<<<<<<<<<<<<< + * cdef SAP_UC *funcName = fillString(func_name) + * if self._handle == NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 201, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_RUNTIME_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 201, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_kp_s_Remote_function_module_name_must, __pyx_v_func_name, ((PyObject *)Py_TYPE(__pyx_v_func_name))}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_kp_s_Remote_function_module_name_must, __pyx_v_func_name, ((PyObject *)Py_TYPE(__pyx_v_func_name))}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + { + __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Remote_function_module_name_must); + __Pyx_GIVEREF(__pyx_kp_s_Remote_function_module_name_must); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Remote_function_module_name_must); + __Pyx_INCREF(__pyx_v_func_name); + __Pyx_GIVEREF(__pyx_v_func_name); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_func_name); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_func_name))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_func_name))); + PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, ((PyObject *)Py_TYPE(__pyx_v_func_name))); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 879, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 879, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":202 - * CommunicationError: COMMUNICATION_FAILURE, - * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, - * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, # <<<<<<<<<<<<<< - * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE - * } + /* "pyrfc/_cyrfc.pyx":878 + * cdef RFC_ERROR_INFO openErrorInfo + * cdef SAP_UC *cName + * if type(func_name) is not str: # <<<<<<<<<<<<<< + * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) + * cdef SAP_UC *funcName = fillString(func_name) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ExternalApplicationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_APPLICATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } - /* "src/pyrfc/data_container.pyx":203 - * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, - * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, - * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE # <<<<<<<<<<<<<< - * } - * if type(exception) not in group2error: + /* "pyrfc/_cyrfc.pyx":880 + * if type(func_name) is not str: + * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) + * cdef SAP_UC *funcName = fillString(func_name) # <<<<<<<<<<<<<< + * if self._handle == NULL: + * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExternalAuthorizationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_AUTHORIZATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_group2error = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(0, 880, __pyx_L1_error) + __pyx_v_funcName = __pyx_t_8; - /* "src/pyrfc/data_container.pyx":205 - * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE - * } - * if type(exception) not in group2error: # <<<<<<<<<<<<<< - * raise RFCError("Not a valid error group.") - * + /* "pyrfc/_cyrfc.pyx":881 + * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) + * cdef SAP_UC *funcName = fillString(func_name) + * if self._handle == NULL: # <<<<<<<<<<<<<< + * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_exception)), __pyx_v_group2error, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 205, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - if (unlikely(__pyx_t_5)) { + __pyx_t_2 = ((__pyx_v_self->_handle == NULL) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/data_container.pyx":206 - * } - * if type(exception) not in group2error: - * raise RFCError("Not a valid error group.") # <<<<<<<<<<<<<< - * - * errorInfo.group = group2error.get(type(exception)) + /* "pyrfc/_cyrfc.pyx":882 + * cdef SAP_UC *funcName = fillString(func_name) + * if self._handle == NULL: + * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") # <<<<<<<<<<<<<< + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Remote_function_module); + __pyx_t_9 += 24; + __Pyx_GIVEREF(__pyx_kp_u_Remote_function_module); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_Remote_function_module); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_10; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u_invocation_rejected_because_the); + __pyx_t_9 += 54; + __Pyx_GIVEREF(__pyx_kp_u_invocation_rejected_because_the); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u_invocation_rejected_because_the); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_Not_a_valid_error_group) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Not_a_valid_error_group); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(4, 206, __pyx_L1_error) + __PYX_ERR(0, 882, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":205 - * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE - * } - * if type(exception) not in group2error: # <<<<<<<<<<<<<< - * raise RFCError("Not a valid error group.") - * + /* "pyrfc/_cyrfc.pyx":881 + * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) + * cdef SAP_UC *funcName = fillString(func_name) + * if self._handle == NULL: # <<<<<<<<<<<<<< + * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) */ } - /* "src/pyrfc/data_container.pyx":208 - * raise RFCError("Not a valid error group.") - * - * errorInfo.group = group2error.get(type(exception)) # <<<<<<<<<<<<<< - * - * if exception.message: # fixed length, exactly 512 chars + /* "pyrfc/_cyrfc.pyx":883 + * if self._handle == NULL: + * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< + * free(funcName) + * if not funcDesc: */ - __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_group2error, ((PyObject *)Py_TYPE(__pyx_v_exception)), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = ((RFC_ERROR_GROUP)__Pyx_PyInt_As_RFC_ERROR_GROUP(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 208, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_errorInfo->group = __pyx_t_6; + __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":210 - * errorInfo.group = group2error.get(type(exception)) - * - * if exception.message: # fixed length, exactly 512 chars # <<<<<<<<<<<<<< - * # str = exception.message[0:512].ljust(512) - * str = exception.message[0:512] + /* "pyrfc/_cyrfc.pyx":884 + * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) # <<<<<<<<<<<<<< + * if not funcDesc: + * self._error(&errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + free(__pyx_v_funcName); - /* "src/pyrfc/data_container.pyx":212 - * if exception.message: # fixed length, exactly 512 chars - * # str = exception.message[0:512].ljust(512) - * str = exception.message[0:512] # <<<<<<<<<<<<<< - * sapuc = fillString(str) - * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) + /* "pyrfc/_cyrfc.pyx":885 + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0x200, NULL, NULL, &__pyx_slice__14, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_str = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_2 = ((!(__pyx_v_funcDesc != 0)) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":213 - * # str = exception.message[0:512].ljust(512) - * str = exception.message[0:512] - * sapuc = fillString(str) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":886 + * free(funcName) + * if not funcDesc: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: */ - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_str); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 213, __pyx_L1_error) - __pyx_v_sapuc = __pyx_t_7; + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":214 - * str = exception.message[0:512] - * sapuc = fillString(str) - * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) # <<<<<<<<<<<<<< - * free(sapuc) - * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + /* "pyrfc/_cyrfc.pyx":885 + * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) */ - __pyx_t_8 = 0x200; - __pyx_t_9 = PyObject_Length(__pyx_v_str); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 214, __pyx_L1_error) - __pyx_t_10 = (__pyx_t_9 + 1); - if (((__pyx_t_8 < __pyx_t_10) != 0)) { - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_10; - } - strncpyU(__pyx_v_errorInfo->message, __pyx_v_sapuc, __pyx_t_9); + } - /* "src/pyrfc/data_container.pyx":215 - * sapuc = fillString(str) - * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) - * free(sapuc) # <<<<<<<<<<<<<< - * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR - * if exception.key: # fixed length, exactly 128 chars + /* "pyrfc/_cyrfc.pyx":887 + * if not funcDesc: + * self._error(&errorInfo) + * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) # <<<<<<<<<<<<<< + * if not funcCont: + * self._error(&errorInfo) */ - free(__pyx_v_sapuc); + __pyx_v_funcCont = RfcCreateFunction(__pyx_v_funcDesc, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":210 - * errorInfo.group = group2error.get(type(exception)) - * - * if exception.message: # fixed length, exactly 512 chars # <<<<<<<<<<<<<< - * # str = exception.message[0:512].ljust(512) - * str = exception.message[0:512] + /* "pyrfc/_cyrfc.pyx":888 + * self._error(&errorInfo) + * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * cdef int isActive = 0 */ - } + __pyx_t_2 = ((!(__pyx_v_funcCont != 0)) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":216 - * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) - * free(sapuc) - * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR # <<<<<<<<<<<<<< - * if exception.key: # fixed length, exactly 128 chars - * str = exception.key[0:128] + /* "pyrfc/_cyrfc.pyx":889 + * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * cdef int isActive = 0 + * options = options or {} */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 216, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(4, 216, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __pyx_t_12; - } else { - __pyx_t_11 = RFC_UNKNOWN_ERROR; - } - __pyx_v_errorInfo->code = __pyx_t_11; - /* "src/pyrfc/data_container.pyx":217 - * free(sapuc) - * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR - * if exception.key: # fixed length, exactly 128 chars # <<<<<<<<<<<<<< - * str = exception.key[0:128] - * sapuc = fillString(str) + /* "pyrfc/_cyrfc.pyx":888 + * self._error(&errorInfo) + * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * cdef int isActive = 0 */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 217, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_5) { + } - /* "src/pyrfc/data_container.pyx":218 - * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR - * if exception.key: # fixed length, exactly 128 chars - * str = exception.key[0:128] # <<<<<<<<<<<<<< - * sapuc = fillString(str) - * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + /* "pyrfc/_cyrfc.pyx":890 + * if not funcCont: + * self._error(&errorInfo) + * cdef int isActive = 0 # <<<<<<<<<<<<<< + * options = options or {} + * try: # now we have a function module */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0x80, NULL, NULL, &__pyx_slice__15, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_str, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_isActive = 0; - /* "src/pyrfc/data_container.pyx":219 - * if exception.key: # fixed length, exactly 128 chars - * str = exception.key[0:128] - * sapuc = fillString(str) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":891 + * self._error(&errorInfo) + * cdef int isActive = 0 + * options = options or {} # <<<<<<<<<<<<<< + * try: # now we have a function module + * if 'not_requested' in options: */ - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_str); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 219, __pyx_L1_error) - __pyx_v_sapuc = __pyx_t_7; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_options); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 891, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __Pyx_INCREF(__pyx_v_options); + __pyx_t_3 = __pyx_v_options; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = __pyx_t_4; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_L7_bool_binop_done:; + __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":220 - * str = exception.key[0:128] - * sapuc = fillString(str) - * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) # <<<<<<<<<<<<<< - * free(sapuc) - * if exception.msg_class: + /* "pyrfc/_cyrfc.pyx":892 + * cdef int isActive = 0 + * options = options or {} + * try: # now we have a function module # <<<<<<<<<<<<<< + * if 'not_requested' in options: + * skip_parameters = options['not_requested'] */ - __pyx_t_8 = 0x80; - __pyx_t_9 = PyObject_Length(__pyx_v_str); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 220, __pyx_L1_error) - __pyx_t_10 = (__pyx_t_9 + 1); - if (((__pyx_t_8 < __pyx_t_10) != 0)) { - __pyx_t_9 = __pyx_t_8; - } else { - __pyx_t_9 = __pyx_t_10; - } - strncpyU(__pyx_v_errorInfo->key, __pyx_v_sapuc, __pyx_t_9); + /*try:*/ { - /* "src/pyrfc/data_container.pyx":221 - * sapuc = fillString(str) - * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) - * free(sapuc) # <<<<<<<<<<<<<< - * if exception.msg_class: - * sapuc = fillString(exception.msg_class[0:20]) + /* "pyrfc/_cyrfc.pyx":893 + * options = options or {} + * try: # now we have a function module + * if 'not_requested' in options: # <<<<<<<<<<<<<< + * skip_parameters = options['not_requested'] + * if type(skip_parameters) is not list: */ - free(__pyx_v_sapuc); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_not_requested, __pyx_v_options, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 893, __pyx_L10_error) + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":217 - * free(sapuc) - * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR - * if exception.key: # fixed length, exactly 128 chars # <<<<<<<<<<<<<< - * str = exception.key[0:128] - * sapuc = fillString(str) + /* "pyrfc/_cyrfc.pyx":894 + * try: # now we have a function module + * if 'not_requested' in options: + * skip_parameters = options['not_requested'] # <<<<<<<<<<<<<< + * if type(skip_parameters) is not list: + * skip_parameters = [skip_parameters] */ - } + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_n_s_not_requested); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_skip_parameters = __pyx_t_3; + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":222 - * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) - * free(sapuc) - * if exception.msg_class: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_class[0:20]) - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + /* "pyrfc/_cyrfc.pyx":895 + * if 'not_requested' in options: + * skip_parameters = options['not_requested'] + * if type(skip_parameters) is not list: # <<<<<<<<<<<<<< + * skip_parameters = [skip_parameters] + * for name in skip_parameters: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 222, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 222, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_skip_parameters)) != ((PyObject *)(&PyList_Type))); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":223 - * free(sapuc) - * if exception.msg_class: - * sapuc = fillString(exception.msg_class[0:20]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":896 + * skip_parameters = options['not_requested'] + * if type(skip_parameters) is not list: + * skip_parameters = [skip_parameters] # <<<<<<<<<<<<<< + * for name in skip_parameters: + * cName = fillString(name) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 20, NULL, NULL, &__pyx_slice__16, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 223, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_sapuc = __pyx_t_7; + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_skip_parameters); + __Pyx_GIVEREF(__pyx_v_skip_parameters); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_skip_parameters); + __Pyx_DECREF_SET(__pyx_v_skip_parameters, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":224 - * if exception.msg_class: - * sapuc = fillString(exception.msg_class[0:20]) - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if exception.msg_type: + /* "pyrfc/_cyrfc.pyx":895 + * if 'not_requested' in options: + * skip_parameters = options['not_requested'] + * if type(skip_parameters) is not list: # <<<<<<<<<<<<<< + * skip_parameters = [skip_parameters] + * for name in skip_parameters: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 20, NULL, NULL, &__pyx_slice__16, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_errorInfo->abapMsgClass, __pyx_v_sapuc, (__pyx_t_9 + 1)); + } - /* "src/pyrfc/data_container.pyx":225 - * sapuc = fillString(exception.msg_class[0:20]) - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if exception.msg_type: - * sapuc = fillString(exception.msg_type[0:1]) + /* "pyrfc/_cyrfc.pyx":897 + * if type(skip_parameters) is not list: + * skip_parameters = [skip_parameters] + * for name in skip_parameters: # <<<<<<<<<<<<<< + * cName = fillString(name) + * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) */ - free(__pyx_v_sapuc); + if (likely(PyList_CheckExact(__pyx_v_skip_parameters)) || PyTuple_CheckExact(__pyx_v_skip_parameters)) { + __pyx_t_3 = __pyx_v_skip_parameters; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_skip_parameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 897, __pyx_L10_error) + } + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 897, __pyx_L10_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 897, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 897, __pyx_L10_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 897, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_11(__pyx_t_3); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 897, __pyx_L10_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/pyrfc/data_container.pyx":222 - * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) - * free(sapuc) - * if exception.msg_class: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_class[0:20]) - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + /* "pyrfc/_cyrfc.pyx":898 + * skip_parameters = [skip_parameters] + * for name in skip_parameters: + * cName = fillString(name) # <<<<<<<<<<<<<< + * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) + * free(cName) */ - } + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(0, 898, __pyx_L10_error) + __pyx_v_cName = __pyx_t_8; - /* "src/pyrfc/data_container.pyx":226 - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) - * free(sapuc) - * if exception.msg_type: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_type[0:1]) - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + /* "pyrfc/_cyrfc.pyx":899 + * for name in skip_parameters: + * cName = fillString(name) + * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) # <<<<<<<<<<<<<< + * free(cName) + * if rc != RFC_OK: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 226, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 226, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + __pyx_v_rc = RfcSetParameterActive(__pyx_v_funcCont, __pyx_v_cName, __pyx_v_isActive, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":227 - * free(sapuc) - * if exception.msg_type: - * sapuc = fillString(exception.msg_type[0:1]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":900 + * cName = fillString(name) + * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) + * free(cName) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 1, NULL, NULL, &__pyx_slice__17, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 227, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_sapuc = __pyx_t_7; + free(__pyx_v_cName); - /* "src/pyrfc/data_container.pyx":228 - * if exception.msg_type: - * sapuc = fillString(exception.msg_type[0:1]) - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if exception.msg_number: + /* "pyrfc/_cyrfc.pyx":901 + * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) + * free(cName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * # set connection timeout, starts before writing input parameters to container */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 1, NULL, NULL, &__pyx_slice__17, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 228, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_errorInfo->abapMsgType, __pyx_v_sapuc, (__pyx_t_9 + 1)); + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":229 - * sapuc = fillString(exception.msg_type[0:1]) - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if exception.msg_number: - * sapuc = fillString(exception.msg_number[0:3]) + /* "pyrfc/_cyrfc.pyx":902 + * free(cName) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * # set connection timeout, starts before writing input parameters to container + * cancel_timer = None */ - free(__pyx_v_sapuc); + __pyx_t_4 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 902, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/data_container.pyx":226 - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) - * free(sapuc) - * if exception.msg_type: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_type[0:1]) - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + /* "pyrfc/_cyrfc.pyx":901 + * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) + * free(cName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * # set connection timeout, starts before writing input parameters to container */ - } + } - /* "src/pyrfc/data_container.pyx":230 - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) - * free(sapuc) - * if exception.msg_number: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_number[0:3]) - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + /* "pyrfc/_cyrfc.pyx":897 + * if type(skip_parameters) is not list: + * skip_parameters = [skip_parameters] + * for name in skip_parameters: # <<<<<<<<<<<<<< + * cName = fillString(name) + * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 230, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":231 - * free(sapuc) - * if exception.msg_number: - * sapuc = fillString(exception.msg_number[0:3]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":893 + * options = options or {} + * try: # now we have a function module + * if 'not_requested' in options: # <<<<<<<<<<<<<< + * skip_parameters = options['not_requested'] + * if type(skip_parameters) is not list: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 3, NULL, NULL, &__pyx_slice__18, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 231, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_sapuc = __pyx_t_7; + } - /* "src/pyrfc/data_container.pyx":232 - * if exception.msg_number: - * sapuc = fillString(exception.msg_number[0:3]) - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if exception.msg_v1: + /* "pyrfc/_cyrfc.pyx":904 + * self._error(&errorInfo) + * # set connection timeout, starts before writing input parameters to container + * cancel_timer = None # <<<<<<<<<<<<<< + * timeout = options.get('timeout', self.__config['timeout']) + * if timeout is not None: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 3, NULL, NULL, &__pyx_slice__18, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 232, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_errorInfo->abapMsgNumber, __pyx_v_sapuc, (__pyx_t_9 + 1)); + __Pyx_INCREF(Py_None); + __pyx_v_cancel_timer = Py_None; - /* "src/pyrfc/data_container.pyx":233 - * sapuc = fillString(exception.msg_number[0:3]) - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if exception.msg_v1: - * sapuc = fillString(exception.msg_v1[0:50]) + /* "pyrfc/_cyrfc.pyx":905 + * # set connection timeout, starts before writing input parameters to container + * cancel_timer = None + * timeout = options.get('timeout', self.__config['timeout']) # <<<<<<<<<<<<<< + * if timeout is not None: + * cancel_timer = Timer(timeout, cancel_connection, (self,)) */ - free(__pyx_v_sapuc); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 905, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__pyx_v_self->__config == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 905, __pyx_L10_error) + } + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_timeout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 905, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_timeout, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 905, __pyx_L10_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_timeout, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 905, __pyx_L10_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 905, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_INCREF(__pyx_n_s_timeout); + __Pyx_GIVEREF(__pyx_n_s_timeout); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_n_s_timeout); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 905, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_timeout = __pyx_t_3; + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":230 - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) - * free(sapuc) - * if exception.msg_number: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_number[0:3]) - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + /* "pyrfc/_cyrfc.pyx":906 + * cancel_timer = None + * timeout = options.get('timeout', self.__config['timeout']) + * if timeout is not None: # <<<<<<<<<<<<<< + * cancel_timer = Timer(timeout, cancel_connection, (self,)) + * cancel_timer.start() */ - } + __pyx_t_2 = (__pyx_v_timeout != Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":234 - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) - * free(sapuc) - * if exception.msg_v1: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v1[0:50]) - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + /* "pyrfc/_cyrfc.pyx":907 + * timeout = options.get('timeout', self.__config['timeout']) + * if timeout is not None: + * cancel_timer = Timer(timeout, cancel_connection, (self,)) # <<<<<<<<<<<<<< + * cancel_timer.start() + * for name, value in params.iteritems(): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 234, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Timer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 907, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_cancel_connection); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 907, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_7 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_timeout, __pyx_t_12, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 907, __pyx_L10_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_timeout, __pyx_t_12, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 907, __pyx_L10_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_13 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 907, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_INCREF(__pyx_v_timeout); + __Pyx_GIVEREF(__pyx_v_timeout); + PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_v_timeout); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_6, __pyx_t_5); + __pyx_t_12 = 0; + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 907, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_cancel_timer, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":235 - * free(sapuc) - * if exception.msg_v1: - * sapuc = fillString(exception.msg_v1[0:50]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":908 + * if timeout is not None: + * cancel_timer = Timer(timeout, cancel_connection, (self,)) + * cancel_timer.start() # <<<<<<<<<<<<<< + * for name, value in params.iteritems(): + * fillFunctionParameter(funcDesc, funcCont, name, value) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 235, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_sapuc = __pyx_t_7; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cancel_timer, __pyx_n_s_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 908, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":236 - * if exception.msg_v1: - * sapuc = fillString(exception.msg_v1[0:50]) - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if exception.msg_v2: + /* "pyrfc/_cyrfc.pyx":906 + * cancel_timer = None + * timeout = options.get('timeout', self.__config['timeout']) + * if timeout is not None: # <<<<<<<<<<<<<< + * cancel_timer = Timer(timeout, cancel_connection, (self,)) + * cancel_timer.start() */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 236, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_errorInfo->abapMsgV1, __pyx_v_sapuc, (__pyx_t_9 + 1)); + } - /* "src/pyrfc/data_container.pyx":237 - * sapuc = fillString(exception.msg_v1[0:50]) - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if exception.msg_v2: - * sapuc = fillString(exception.msg_v2[0:50]) - */ - free(__pyx_v_sapuc); - - /* "src/pyrfc/data_container.pyx":234 - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) - * free(sapuc) - * if exception.msg_v1: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v1[0:50]) - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) - */ - } - - /* "src/pyrfc/data_container.pyx":238 - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) - * free(sapuc) - * if exception.msg_v2: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v2[0:50]) - * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + /* "pyrfc/_cyrfc.pyx":909 + * cancel_timer = Timer(timeout, cancel_connection, (self,)) + * cancel_timer.start() + * for name, value in params.iteritems(): # <<<<<<<<<<<<<< + * fillFunctionParameter(funcDesc, funcCont, name, value) + * # save old handle for troubleshooting */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 238, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + __pyx_t_9 = 0; + __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_params, 1, __pyx_n_s_iteritems, (&__pyx_t_14), (&__pyx_t_6)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 909, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; + while (1) { + __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_14, &__pyx_t_9, &__pyx_t_4, &__pyx_t_13, NULL, __pyx_t_6); + if (unlikely(__pyx_t_15 == 0)) break; + if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 909, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_13); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_13); + __pyx_t_13 = 0; - /* "src/pyrfc/data_container.pyx":239 - * free(sapuc) - * if exception.msg_v2: - * sapuc = fillString(exception.msg_v2[0:50]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":910 + * cancel_timer.start() + * for name, value in params.iteritems(): + * fillFunctionParameter(funcDesc, funcCont, name, value) # <<<<<<<<<<<<<< + * # save old handle for troubleshooting + * with nogil: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 239, __pyx_L1_error) + __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcCont, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 910, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_sapuc = __pyx_t_7; - /* "src/pyrfc/data_container.pyx":240 - * if exception.msg_v2: - * sapuc = fillString(exception.msg_v2[0:50]) - * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if exception.msg_v3: + /* "pyrfc/_cyrfc.pyx":912 + * fillFunctionParameter(funcDesc, funcCont, name, value) + * # save old handle for troubleshooting + * with nogil: # <<<<<<<<<<<<<< + * rc = RfcInvoke(self._handle, funcCont, &errorInfo) + * if cancel_timer is not None: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 240, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 240, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_errorInfo->abapMsgV2, __pyx_v_sapuc, (__pyx_t_9 + 1)); + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "src/pyrfc/data_container.pyx":241 - * sapuc = fillString(exception.msg_v2[0:50]) - * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if exception.msg_v3: - * sapuc = fillString(exception.msg_v3[0:50]) + /* "pyrfc/_cyrfc.pyx":913 + * # save old handle for troubleshooting + * with nogil: + * rc = RfcInvoke(self._handle, funcCont, &errorInfo) # <<<<<<<<<<<<<< + * if cancel_timer is not None: + * cancel_timer.cancel() */ - free(__pyx_v_sapuc); + __pyx_v_rc = RfcInvoke(__pyx_v_self->_handle, __pyx_v_funcCont, (&__pyx_v_errorInfo)); + } - /* "src/pyrfc/data_container.pyx":238 - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) - * free(sapuc) - * if exception.msg_v2: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v2[0:50]) - * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + /* "pyrfc/_cyrfc.pyx":912 + * fillFunctionParameter(funcDesc, funcCont, name, value) + * # save old handle for troubleshooting + * with nogil: # <<<<<<<<<<<<<< + * rc = RfcInvoke(self._handle, funcCont, &errorInfo) + * if cancel_timer is not None: */ - } + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L22; + } + __pyx_L22:; + } + } - /* "src/pyrfc/data_container.pyx":242 - * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) - * free(sapuc) - * if exception.msg_v3: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v3[0:50]) - * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + /* "pyrfc/_cyrfc.pyx":914 + * with nogil: + * rc = RfcInvoke(self._handle, funcCont, &errorInfo) + * if cancel_timer is not None: # <<<<<<<<<<<<<< + * cancel_timer.cancel() + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 242, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 242, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + __pyx_t_1 = (__pyx_v_cancel_timer != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":243 - * free(sapuc) - * if exception.msg_v3: - * sapuc = fillString(exception.msg_v3[0:50]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":915 + * rc = RfcInvoke(self._handle, funcCont, &errorInfo) + * if cancel_timer is not None: + * cancel_timer.cancel() # <<<<<<<<<<<<<< + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + * if rc != RFC_OK: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 243, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_sapuc = __pyx_t_7; + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_cancel_timer, __pyx_n_s_cancel); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 915, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + } + } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 915, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":244 - * if exception.msg_v3: - * sapuc = fillString(exception.msg_v3[0:50]) - * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if exception.msg_v4: + /* "pyrfc/_cyrfc.pyx":914 + * with nogil: + * rc = RfcInvoke(self._handle, funcCont, &errorInfo) + * if cancel_timer is not None: # <<<<<<<<<<<<<< + * cancel_timer.cancel() + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 244, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_errorInfo->abapMsgV3, __pyx_v_sapuc, (__pyx_t_9 + 1)); + } - /* "src/pyrfc/data_container.pyx":245 - * sapuc = fillString(exception.msg_v3[0:50]) - * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if exception.msg_v4: - * sapuc = fillString(exception.msg_v4[0:50]) + /* "pyrfc/_cyrfc.pyx":917 + * cancel_timer.cancel() + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * if errorInfo.code in ( + * RFC_COMMUNICATION_FAILURE, */ - free(__pyx_v_sapuc); + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":242 - * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) - * free(sapuc) - * if exception.msg_v3: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v3[0:50]) - * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + /* "pyrfc/_cyrfc.pyx":918 + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + * if rc != RFC_OK: + * if errorInfo.code in ( # <<<<<<<<<<<<<< + * RFC_COMMUNICATION_FAILURE, + * RFC_ABAP_RUNTIME_FAILURE, */ - } + switch (__pyx_v_errorInfo.code) { + case RFC_COMMUNICATION_FAILURE: - /* "src/pyrfc/data_container.pyx":246 - * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) - * free(sapuc) - * if exception.msg_v4: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v4[0:50]) - * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) + /* "pyrfc/_cyrfc.pyx":919 + * if rc != RFC_OK: + * if errorInfo.code in ( + * RFC_COMMUNICATION_FAILURE, # <<<<<<<<<<<<<< + * RFC_ABAP_RUNTIME_FAILURE, + * RFC_ABAP_MESSAGE, */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v4); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(4, 246, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + case RFC_ABAP_RUNTIME_FAILURE: - /* "src/pyrfc/data_container.pyx":247 - * free(sapuc) - * if exception.msg_v4: - * sapuc = fillString(exception.msg_v4[0:50]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":920 + * if errorInfo.code in ( + * RFC_COMMUNICATION_FAILURE, + * RFC_ABAP_RUNTIME_FAILURE, # <<<<<<<<<<<<<< + * RFC_ABAP_MESSAGE, + * RFC_EXTERNAL_FAILURE */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v4); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(4, 247, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_sapuc = __pyx_t_7; + case RFC_ABAP_MESSAGE: - /* "src/pyrfc/data_container.pyx":248 - * if exception.msg_v4: - * sapuc = fillString(exception.msg_v4[0:50]) - * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * + /* "pyrfc/_cyrfc.pyx":921 + * RFC_COMMUNICATION_FAILURE, + * RFC_ABAP_RUNTIME_FAILURE, + * RFC_ABAP_MESSAGE, # <<<<<<<<<<<<<< + * RFC_EXTERNAL_FAILURE + * ) or errorInfo.group in ( */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__19, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(4, 248, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_errorInfo->abapMsgV4, __pyx_v_sapuc, (__pyx_t_9 + 1)); + case RFC_EXTERNAL_FAILURE: - /* "src/pyrfc/data_container.pyx":249 - * sapuc = fillString(exception.msg_v4[0:50]) - * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * - * cdef SAP_UC* fillString(pyuc) except NULL: + /* "pyrfc/_cyrfc.pyx":918 + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + * if rc != RFC_OK: + * if errorInfo.code in ( # <<<<<<<<<<<<<< + * RFC_COMMUNICATION_FAILURE, + * RFC_ABAP_RUNTIME_FAILURE, */ - free(__pyx_v_sapuc); + __pyx_t_1 = 1; + break; + default: + __pyx_t_1 = 0; + break; + } + __pyx_t_16 = (__pyx_t_1 != 0); + if (!__pyx_t_16) { + } else { + __pyx_t_2 = __pyx_t_16; + goto __pyx_L26_bool_binop_done; + } - /* "src/pyrfc/data_container.pyx":246 - * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) - * free(sapuc) - * if exception.msg_v4: # <<<<<<<<<<<<<< - * sapuc = fillString(exception.msg_v4[0:50]) - * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) + /* "pyrfc/_cyrfc.pyx":923 + * RFC_ABAP_MESSAGE, + * RFC_EXTERNAL_FAILURE + * ) or errorInfo.group in ( # <<<<<<<<<<<<<< + * ABAP_RUNTIME_FAILURE, + * LOGON_FAILURE, */ - } + switch (__pyx_v_errorInfo.group) { + case ABAP_RUNTIME_FAILURE: - /* "src/pyrfc/data_container.pyx":195 - * return bytes - * - * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * group2error = { - * ABAPApplicationError: ABAP_APPLICATION_FAILURE, + /* "pyrfc/_cyrfc.pyx":924 + * RFC_EXTERNAL_FAILURE + * ) or errorInfo.group in ( + * ABAP_RUNTIME_FAILURE, # <<<<<<<<<<<<<< + * LOGON_FAILURE, + * COMMUNICATION_FAILURE, */ + case LOGON_FAILURE: - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.fillError", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_group2error); - __Pyx_XDECREF(__pyx_v_str); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/data_container.pyx":251 - * free(sapuc) - * - * cdef SAP_UC* fillString(pyuc) except NULL: # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":925 + * ) or errorInfo.group in ( + * ABAP_RUNTIME_FAILURE, + * LOGON_FAILURE, # <<<<<<<<<<<<<< + * COMMUNICATION_FAILURE, + * EXTERNAL_RUNTIME_FAILURE): */ + case COMMUNICATION_FAILURE: -static SAP_UC *__pyx_f_5pyrfc_6_cyrfc_fillString(PyObject *__pyx_v_pyuc) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - PyObject *__pyx_v_ucbytes = NULL; - unsigned int __pyx_v_ucbytes_len; - unsigned int __pyx_v_sapuc_size; - SAP_UC *__pyx_v_sapuc; - unsigned int __pyx_v_result_len; - SAP_UC *__pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - int __pyx_t_5; - unsigned char const *__pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillString", 0); - - /* "src/pyrfc/data_container.pyx":254 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * ucbytes = pyuc.encode() # <<<<<<<<<<<<<< - * cdef unsigned ucbytes_len = len(ucbytes) - * cdef unsigned sapuc_size = ucbytes_len + 1 + /* "pyrfc/_cyrfc.pyx":926 + * ABAP_RUNTIME_FAILURE, + * LOGON_FAILURE, + * COMMUNICATION_FAILURE, # <<<<<<<<<<<<<< + * EXTERNAL_RUNTIME_FAILURE): + * # Connection closed, re-open */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pyuc, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_ucbytes = __pyx_t_1; - __pyx_t_1 = 0; + case EXTERNAL_RUNTIME_FAILURE: - /* "src/pyrfc/data_container.pyx":255 - * cdef RFC_ERROR_INFO errorInfo - * ucbytes = pyuc.encode() - * cdef unsigned ucbytes_len = len(ucbytes) # <<<<<<<<<<<<<< - * cdef unsigned sapuc_size = ucbytes_len + 1 - * cdef SAP_UC* sapuc = mallocU(sapuc_size) + /* "pyrfc/_cyrfc.pyx":923 + * RFC_ABAP_MESSAGE, + * RFC_EXTERNAL_FAILURE + * ) or errorInfo.group in ( # <<<<<<<<<<<<<< + * ABAP_RUNTIME_FAILURE, + * LOGON_FAILURE, */ - __pyx_t_4 = PyObject_Length(__pyx_v_ucbytes); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 255, __pyx_L1_error) - __pyx_v_ucbytes_len = ((unsigned int)__pyx_t_4); + __pyx_t_16 = 1; + break; + default: + __pyx_t_16 = 0; + break; + } + __pyx_t_1 = (__pyx_t_16 != 0); + __pyx_t_2 = __pyx_t_1; + __pyx_L26_bool_binop_done:; - /* "src/pyrfc/data_container.pyx":256 - * ucbytes = pyuc.encode() - * cdef unsigned ucbytes_len = len(ucbytes) - * cdef unsigned sapuc_size = ucbytes_len + 1 # <<<<<<<<<<<<<< - * cdef SAP_UC* sapuc = mallocU(sapuc_size) - * sapuc[0] = 0 + /* "pyrfc/_cyrfc.pyx":918 + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + * if rc != RFC_OK: + * if errorInfo.code in ( # <<<<<<<<<<<<<< + * RFC_COMMUNICATION_FAILURE, + * RFC_ABAP_RUNTIME_FAILURE, */ - __pyx_v_sapuc_size = (__pyx_v_ucbytes_len + 1); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":257 - * cdef unsigned ucbytes_len = len(ucbytes) - * cdef unsigned sapuc_size = ucbytes_len + 1 - * cdef SAP_UC* sapuc = mallocU(sapuc_size) # <<<<<<<<<<<<<< - * sapuc[0] = 0 - * cdef unsigned result_len = 0 + /* "pyrfc/_cyrfc.pyx":929 + * EXTERNAL_RUNTIME_FAILURE): + * # Connection closed, re-open + * closed_handle = self.handle # <<<<<<<<<<<<<< + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) + * if openErrorInfo.code != RFC_OK: */ - __pyx_v_sapuc = mallocU(__pyx_v_sapuc_size); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_closed_handle = __pyx_t_3; + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":258 - * cdef unsigned sapuc_size = ucbytes_len + 1 - * cdef SAP_UC* sapuc = mallocU(sapuc_size) - * sapuc[0] = 0 # <<<<<<<<<<<<<< - * cdef unsigned result_len = 0 - * if ucbytes_len > 0: + /* "pyrfc/_cyrfc.pyx":930 + * # Connection closed, re-open + * closed_handle = self.handle + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) # <<<<<<<<<<<<<< + * if openErrorInfo.code != RFC_OK: + * self._handle = NULL */ - (__pyx_v_sapuc[0]) = 0; + __pyx_v_self->_handle = RfcOpenConnection(__pyx_v_self->_connection->_params, __pyx_v_self->_connection->_params_count, (&__pyx_v_openErrorInfo)); - /* "src/pyrfc/data_container.pyx":259 - * cdef SAP_UC* sapuc = mallocU(sapuc_size) - * sapuc[0] = 0 - * cdef unsigned result_len = 0 # <<<<<<<<<<<<<< - * if ucbytes_len > 0: - * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + /* "pyrfc/_cyrfc.pyx":931 + * closed_handle = self.handle + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) + * if openErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * self._handle = NULL + * # Communication error returned as error */ - __pyx_v_result_len = 0; + __pyx_t_2 = ((__pyx_v_openErrorInfo.code != RFC_OK) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":260 - * sapuc[0] = 0 - * cdef unsigned result_len = 0 - * if ucbytes_len > 0: # <<<<<<<<<<<<<< - * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":932 + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) + * if openErrorInfo.code != RFC_OK: + * self._handle = NULL # <<<<<<<<<<<<<< + * # Communication error returned as error + * errorInfo = openErrorInfo */ - __pyx_t_5 = ((__pyx_v_ucbytes_len > 0) != 0); - if (__pyx_t_5) { + __pyx_v_self->_handle = NULL; - /* "src/pyrfc/data_container.pyx":261 - * cdef unsigned result_len = 0 - * if ucbytes_len > 0: - * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":934 + * self._handle = NULL + * # Communication error returned as error + * errorInfo = openErrorInfo # <<<<<<<<<<<<<< + * elif errorInfo.code == RFC_CANCELED: + * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") */ - __pyx_t_6 = __Pyx_PyObject_AsUString(__pyx_v_ucbytes); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(4, 261, __pyx_L1_error) - __pyx_v_rc = RfcUTF8ToSAPUC(__pyx_t_6, __pyx_v_ucbytes_len, __pyx_v_sapuc, (&__pyx_v_sapuc_size), (&__pyx_v_result_len), (&__pyx_v_errorInfo)); + __pyx_v_errorInfo = __pyx_v_openErrorInfo; - /* "src/pyrfc/data_container.pyx":262 - * if ucbytes_len > 0: - * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return sapuc + /* "pyrfc/_cyrfc.pyx":931 + * closed_handle = self.handle + * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) + * if openErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * self._handle = NULL + * # Communication error returned as error */ - __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_5)) { + goto __pyx_L28; + } - /* "src/pyrfc/data_container.pyx":263 - * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return sapuc - * + /* "pyrfc/_cyrfc.pyx":935 + * # Communication error returned as error + * errorInfo = openErrorInfo + * elif errorInfo.code == RFC_CANCELED: # <<<<<<<<<<<<<< + * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") + * self._error(&errorInfo) */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(4, 263, __pyx_L1_error) + __pyx_t_2 = ((__pyx_v_errorInfo.code == RFC_CANCELED) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":262 - * if ucbytes_len > 0: - * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return sapuc + /* "pyrfc/_cyrfc.pyx":936 + * errorInfo = openErrorInfo + * elif errorInfo.code == RFC_CANCELED: + * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: */ - } - - /* "src/pyrfc/data_container.pyx":260 - * sapuc[0] = 0 - * cdef unsigned result_len = 0 - * if ucbytes_len > 0: # <<<<<<<<<<<<<< - * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) - * if rc != RFC_OK: + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 936, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Connection_was_canceled); + __pyx_t_14 += 25; + __Pyx_GIVEREF(__pyx_kp_u_Connection_was_canceled); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Connection_was_canceled); + __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_v_closed_handle, __pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 936, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) : __pyx_t_10; + __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_13); + __pyx_t_13 = 0; + __Pyx_INCREF(__pyx_kp_u_New_handle); + __pyx_t_14 += 14; + __Pyx_GIVEREF(__pyx_kp_u_New_handle); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_New_handle); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 936, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_13, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 936, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_10; + __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_14, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 936, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_4); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(0, 936, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + memcpy(&(__pyx_v_errorInfo.message[0]), __pyx_t_8, sizeof(__pyx_v_errorInfo.message[0]) * (0x200 - 0)); + + /* "pyrfc/_cyrfc.pyx":935 + * # Communication error returned as error + * errorInfo = openErrorInfo + * elif errorInfo.code == RFC_CANCELED: # <<<<<<<<<<<<<< + * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") + * self._error(&errorInfo) + */ + } + __pyx_L28:; + + /* "pyrfc/_cyrfc.pyx":918 + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + * if rc != RFC_OK: + * if errorInfo.code in ( # <<<<<<<<<<<<<< + * RFC_COMMUNICATION_FAILURE, + * RFC_ABAP_RUNTIME_FAILURE, + */ + } + + /* "pyrfc/_cyrfc.pyx":937 + * elif errorInfo.code == RFC_CANCELED: + * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: + * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) + */ + __pyx_t_4 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 937, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pyrfc/_cyrfc.pyx":917 + * cancel_timer.cancel() + * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * if errorInfo.code in ( + * RFC_COMMUNICATION_FAILURE, + */ + } + + /* "pyrfc/_cyrfc.pyx":938 + * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") + * self._error(&errorInfo) + * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: # <<<<<<<<<<<<<< + * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) + * else: + */ + __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 938, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RETURN_IMPORT_PARAMS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 938, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = PyNumber_And(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 938, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 938, __pyx_L10_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (__pyx_t_2) { + + /* "pyrfc/_cyrfc.pyx":939 + * self._error(&errorInfo) + * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: + * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) # <<<<<<<<<<<<<< + * else: + * return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_13 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 939, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapResult(__pyx_v_funcDesc, __pyx_v_funcCont, ((RFC_DIRECTION)0), __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L9_return; + + /* "pyrfc/_cyrfc.pyx":938 + * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") + * self._error(&errorInfo) + * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: # <<<<<<<<<<<<<< + * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) + * else: + */ + } + + /* "pyrfc/_cyrfc.pyx":941 + * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) + * else: + * return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) # <<<<<<<<<<<<<< + * finally: + * RfcDestroyFunction(funcCont, NULL) */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 941, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_wrapResult(__pyx_v_funcDesc, __pyx_v_funcCont, RFC_IMPORT, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 941, __pyx_L10_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_13; + __pyx_t_13 = 0; + goto __pyx_L9_return; + } } - /* "src/pyrfc/data_container.pyx":264 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return sapuc # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":943 + * return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) + * finally: + * RfcDestroyFunction(funcCont, NULL) # <<<<<<<<<<<<<< * - * ################################################################################ + * ########################################################################## */ - __pyx_r = __pyx_v_sapuc; - goto __pyx_L0; + /*finally:*/ { + __pyx_L10_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); + __Pyx_XGOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_t_19); + __Pyx_XGOTREF(__pyx_t_20); + __Pyx_XGOTREF(__pyx_t_21); + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_23); + __pyx_t_6 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_17 = __pyx_filename; + { + (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); + } + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); + __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_17; + goto __pyx_L1_error; + } + __pyx_L9_return: { + __pyx_t_23 = __pyx_r; + __pyx_r = 0; + (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); + __pyx_r = __pyx_t_23; + __pyx_t_23 = 0; + goto __pyx_L0; + } + } - /* "src/pyrfc/data_container.pyx":251 - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":840 + * return wrapFunctionDescription(funcDesc) + * + * def call(self, func_name, options=None, **params): # <<<<<<<<<<<<<< + * """ Invokes a remote-enabled function module via RFC. * - * cdef SAP_UC* fillString(pyuc) except NULL: # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.fillString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.call", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ucbytes); + __Pyx_XDECREF(__pyx_v_skip_parameters); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_cancel_timer); + __Pyx_XDECREF(__pyx_v_timeout); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_closed_handle); + __Pyx_XDECREF(__pyx_v_options); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":271 - * # wrapper functions take C values and returns Python values +/* "pyrfc/_cyrfc.pyx":948 + * # HELPER METHODS + * + * def type_desc_get(self, type_name): # <<<<<<<<<<<<<< + * """Removes the Type Description from SAP NW RFC Lib cache * - * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): # <<<<<<<<<<<<<< - * return { - * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapConnectionAttributes(RFC_ATTRIBUTES __pyx_v_attributes) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_35type_desc_get(PyObject *__pyx_v_self, PyObject *__pyx_v_type_name); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_34type_desc_get[] = "Removes the Type Description from SAP NW RFC Lib cache\n\n :param type_name: system id (connection parameters sysid)\n :type type_name: string\n\n :returns: error code\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_35type_desc_get(PyObject *__pyx_v_self, PyObject *__pyx_v_type_name) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("type_desc_get (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_34type_desc_get(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_type_name)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_34type_desc_get(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_type_name) { + RFC_ERROR_INFO __pyx_v_errorInfo; + SAP_UC *__pyx_v_typeName; + RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + SAP_UC *__pyx_t_4; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapConnectionAttributes", 0); - - /* "src/pyrfc/data_container.pyx":272 - * - * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): - * return { # <<<<<<<<<<<<<< - * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') - * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') - */ - __Pyx_XDECREF(__pyx_r); + __Pyx_RefNannySetupContext("type_desc_get", 0); - /* "src/pyrfc/data_container.pyx":273 - * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): - * return { - * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') - * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":957 + * """ + * cdef RFC_ERROR_INFO errorInfo + * typeName = fillString(type_name.upper()) # <<<<<<<<<<<<<< + * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) + * free(typeName) */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(25); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_64; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.dest, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_name, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dest, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 957, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_typeName = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":274 - * return { - * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') - * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') - * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":958 + * cdef RFC_ERROR_INFO errorInfo + * typeName = fillString(type_name.upper()) + * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) # <<<<<<<<<<<<<< + * free(typeName) + * if typeDesc == NULL: */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_100; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.host, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_host, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_typeDesc = RfcGetTypeDesc(__pyx_v_self->_handle, __pyx_v_typeName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":275 - * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') - * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') - * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') - * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":959 + * typeName = fillString(type_name.upper()) + * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) + * free(typeName) # <<<<<<<<<<<<<< + * if typeDesc == NULL: + * self._error(&errorInfo) */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_100; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerHost, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 275, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerHost, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + free(__pyx_v_typeName); - /* "src/pyrfc/data_container.pyx":276 - * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') - * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') - * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') - * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":960 + * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) + * free(typeName) + * if typeDesc == NULL: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return wrapTypeDescription(typeDesc) */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_2; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.sysNumber, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sysNumber, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((__pyx_v_typeDesc == NULL) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":277 - * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') - * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') - * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') - * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":961 + * free(typeName) + * if typeDesc == NULL: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * return wrapTypeDescription(typeDesc) + * */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_8; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.sysId, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sysId, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":278 - * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') - * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') - * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') - * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":960 + * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) + * free(typeName) + * if typeDesc == NULL: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return wrapTypeDescription(typeDesc) */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_3; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.client, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_client, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":279 - * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') - * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') - * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') - * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":962 + * if typeDesc == NULL: + * self._error(&errorInfo) + * return wrapTypeDescription(typeDesc) # <<<<<<<<<<<<<< + * + * def type_desc_remove(self, sysid, type_name): */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_12; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.user, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_user, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(__pyx_v_typeDesc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 962, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":280 - * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') - * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') - * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') - * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":948 + * # HELPER METHODS + * + * def type_desc_get(self, type_name): # <<<<<<<<<<<<<< + * """Removes the Type Description from SAP NW RFC Lib cache + * */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_2; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.language, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 280, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 280, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 280, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_language, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":281 - * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') - * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') - * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') - * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_1; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.trace, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_trace, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.type_desc_get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":282 - * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') - * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') - * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') - * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') +/* "pyrfc/_cyrfc.pyx":964 + * return wrapTypeDescription(typeDesc) + * + * def type_desc_remove(self, sysid, type_name): # <<<<<<<<<<<<<< + * """Removes the Type Description from SAP NW RFC Lib cache + * */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_2; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.isoLanguage, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_isoLanguage, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":283 - * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') - * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') - * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') - * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_4; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.codepage, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_37type_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_36type_desc_remove[] = "Removes the Type Description from SAP NW RFC Lib cache\n\n :param sysid: system id (connection parameters sysid)\n :type sysid: string\n\n :param type_name: Name of the type to be removed\n :type func_name: string\n\n :returns: error code\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_37type_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sysid = 0; + PyObject *__pyx_v_type_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("type_desc_remove (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sysid,&__pyx_n_s_type_name,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_sysid)) != 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_type_name)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("type_desc_remove", 1, 2, 2, 1); __PYX_ERR(0, 964, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "type_desc_remove") < 0)) __PYX_ERR(0, 964, __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_sysid = values[0]; + __pyx_v_type_name = values[1]; } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_codepage, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("type_desc_remove", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 964, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.type_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_36type_desc_remove(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_sysid, __pyx_v_type_name); - /* "src/pyrfc/data_container.pyx":284 - * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') - * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') - * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') - * , 'type': wrapString(attributes.type, 1).rstrip('\0') - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_4; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerCodepage, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 284, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerCodepage, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":285 - * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') - * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') - * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'type': wrapString(attributes.type, 1).rstrip('\0') - * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_1; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.rfcRole, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rfcRole, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_36type_desc_remove(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_sysid, PyObject *__pyx_v_type_name) { + RFC_ERROR_INFO __pyx_v_errorInfo; + SAP_UC *__pyx_v_sysId; + SAP_UC *__pyx_v_typeName; + RFC_RC __pyx_v_rc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + SAP_UC *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("type_desc_remove", 0); - /* "src/pyrfc/data_container.pyx":286 - * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') - * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') - * , 'type': wrapString(attributes.type, 1).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') - * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":976 + * """ + * cdef RFC_ERROR_INFO errorInfo + * sysId = fillString(sysid) # <<<<<<<<<<<<<< + * typeName = fillString(type_name) + * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) */ - __pyx_t_4.__pyx_n = 1; - __pyx_t_4.uclen = __pyx_int_1; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.type, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_type, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_sysid); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 976, __pyx_L1_error) + __pyx_v_sysId = __pyx_t_1; - /* "src/pyrfc/data_container.pyx":287 - * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') - * , 'type': wrapString(attributes.type, 1).rstrip('\0') - * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') - * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":977 + * cdef RFC_ERROR_INFO errorInfo + * sysId = fillString(sysid) + * typeName = fillString(type_name) # <<<<<<<<<<<<<< + * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) + * free(sysId) */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_1; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerType, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerType, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_type_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 977, __pyx_L1_error) + __pyx_v_typeName = __pyx_t_1; - /* "src/pyrfc/data_container.pyx":288 - * , 'type': wrapString(attributes.type, 1).rstrip('\0') - * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') - * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') - * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":978 + * sysId = fillString(sysid) + * typeName = fillString(type_name) + * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) # <<<<<<<<<<<<<< + * free(sysId) + * free(typeName) */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_4; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.rel, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rel, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_rc = RfcRemoveTypeDesc(__pyx_v_sysId, __pyx_v_typeName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":289 - * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') - * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') - * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') - * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":979 + * typeName = fillString(type_name) + * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) + * free(sysId) # <<<<<<<<<<<<<< + * free(typeName) + * if rc != RFC_OK: */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_4; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerRel, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 289, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerRel, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + free(__pyx_v_sysId); - /* "src/pyrfc/data_container.pyx":290 - * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') - * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') - * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') - * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":980 + * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) + * free(sysId) + * free(typeName) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_4; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.kernelRel, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_kernelRel, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + free(__pyx_v_typeName); - /* "src/pyrfc/data_container.pyx":291 - * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') - * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') - * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') - * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":981 + * free(sysId) + * free(typeName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return rc */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_8; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.cpicConvId, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cpicConvId, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":292 - * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') - * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') - * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') - * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":982 + * free(typeName) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * return rc + * */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_128; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.progName, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_progName, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 982, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":293 - * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') - * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') - * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') - * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":981 + * free(sysId) + * free(typeName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return rc */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_1; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerBytesPerChar, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerBytesPerChar, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":294 - * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') - * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') - * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') - * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":983 + * if rc != RFC_OK: + * self._error(&errorInfo) + * return rc # <<<<<<<<<<<<<< + * + * def func_desc_remove(self, sysid, func_name): */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_4; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerSystemCodepage, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 294, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerSystemCodepage, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":295 - * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') - * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') - * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') - * , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_15; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerIP, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerIP, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/data_container.pyx":296 - * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') - * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') - * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') # <<<<<<<<<<<<<< - * , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') - * } - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_45; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerIPv6, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerIPv6, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/data_container.pyx":297 - * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') - * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') - * , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') # <<<<<<<<<<<<<< - * } - * - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_17; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.reserved, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__20) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__20); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 297, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reserved, __pyx_t_2) < 0) __PYX_ERR(4, 273, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "src/pyrfc/data_container.pyx":271 - * # wrapper functions take C values and returns Python values - * - * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): # <<<<<<<<<<<<<< - * return { - * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') + /* "pyrfc/_cyrfc.pyx":964 + * return wrapTypeDescription(typeDesc) + * + * def type_desc_remove(self, sysid, type_name): # <<<<<<<<<<<<<< + * """Removes the Type Description from SAP NW RFC Lib cache + * */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapConnectionAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.type_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":301 - * +/* "pyrfc/_cyrfc.pyx":985 + * return rc * - * cdef wrapTypeDescription(RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< - * """ Parses a RFC_TYPE_DESC_HANDLE + * def func_desc_remove(self, sysid, func_name): # <<<<<<<<<<<<<< + * """Removes the Function Description from SAP NW RFC Lib cache * */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc) { - RFC_RC __pyx_v_rc; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_39func_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_38func_desc_remove[] = "Removes the Function Description from SAP NW RFC Lib cache\n\n :param sysid: system id (connection parameters sysid)\n :type sysid: string\n\n :param func_name: Name of the function module to be removed\n :type func_name: string\n\n :returns: error code\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_39func_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sysid = 0; + PyObject *__pyx_v_func_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("func_desc_remove (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sysid,&__pyx_n_s_func_name,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_sysid)) != 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_func_name)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("func_desc_remove", 1, 2, 2, 1); __PYX_ERR(0, 985, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "func_desc_remove") < 0)) __PYX_ERR(0, 985, __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_sysid = values[0]; + __pyx_v_func_name = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("func_desc_remove", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 985, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.func_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_38func_desc_remove(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_sysid, __pyx_v_func_name); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_38func_desc_remove(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_sysid, PyObject *__pyx_v_func_name) { RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_FIELD_DESC __pyx_v_fieldDesc; - RFC_ABAP_NAME __pyx_v_typeName; - unsigned int __pyx_v_nuc_length; - unsigned int __pyx_v_uc_length; - unsigned int __pyx_v_i; - unsigned int __pyx_v_fieldCount; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_type_desc = NULL; - PyObject *__pyx_v_field_description = NULL; + SAP_UC *__pyx_v_sysId; + SAP_UC *__pyx_v_funcName; + RFC_RC __pyx_v_rc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + SAP_UC *__pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - unsigned int __pyx_t_9; - unsigned int __pyx_t_10; - unsigned int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapTypeDescription", 0); - - /* "src/pyrfc/data_container.pyx":314 - * cdef unsigned i, fieldCount - * - * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetTypeName(__pyx_v_typeDesc, __pyx_v_typeName, (&__pyx_v_errorInfo)); + __Pyx_RefNannySetupContext("func_desc_remove", 0); - /* "src/pyrfc/data_container.pyx":315 - * - * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * name = wrapString(typeName) + /* "pyrfc/_cyrfc.pyx":997 + * """ + * cdef RFC_ERROR_INFO errorInfo + * sysId = fillString(sysid) # <<<<<<<<<<<<<< + * funcName = fillString(func_name) + * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_sysid); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 997, __pyx_L1_error) + __pyx_v_sysId = __pyx_t_1; - /* "src/pyrfc/data_container.pyx":316 - * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * name = wrapString(typeName) - * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) + /* "pyrfc/_cyrfc.pyx":998 + * cdef RFC_ERROR_INFO errorInfo + * sysId = fillString(sysid) + * funcName = fillString(func_name) # <<<<<<<<<<<<<< + * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) + * free(sysId) */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 316, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 998, __pyx_L1_error) + __pyx_v_funcName = __pyx_t_1; - /* "src/pyrfc/data_container.pyx":315 - * - * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * name = wrapString(typeName) + /* "pyrfc/_cyrfc.pyx":999 + * sysId = fillString(sysid) + * funcName = fillString(func_name) + * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) # <<<<<<<<<<<<<< + * free(sysId) + * free(funcName) */ - } + __pyx_v_rc = RfcRemoveFunctionDesc(__pyx_v_sysId, __pyx_v_funcName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":317 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * name = wrapString(typeName) # <<<<<<<<<<<<<< - * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1000 + * funcName = fillString(func_name) + * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) + * free(sysId) # <<<<<<<<<<<<<< + * free(funcName) + * if rc != RFC_OK: */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_typeName, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_name = __pyx_t_2; - __pyx_t_2 = 0; + free(__pyx_v_sysId); - /* "src/pyrfc/data_container.pyx":318 - * raise wrapError(&errorInfo) - * name = wrapString(typeName) - * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1001 + * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) + * free(sysId) + * free(funcName) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_v_rc = RfcGetTypeLength(__pyx_v_typeDesc, (&__pyx_v_nuc_length), (&__pyx_v_uc_length), (&__pyx_v_errorInfo)); + free(__pyx_v_funcName); - /* "src/pyrfc/data_container.pyx":319 - * name = wrapString(typeName) - * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * type_desc = TypeDescription(name, nuc_length, uc_length) + /* "pyrfc/_cyrfc.pyx":1002 + * free(sysId) + * free(funcName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return rc */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":320 - * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * type_desc = TypeDescription(name, nuc_length, uc_length) + /* "pyrfc/_cyrfc.pyx":1003 + * free(funcName) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * return rc * */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 320, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":319 - * name = wrapString(typeName) - * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * type_desc = TypeDescription(name, nuc_length, uc_length) + /* "pyrfc/_cyrfc.pyx":1002 + * free(sysId) + * free(funcName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return rc */ } - /* "src/pyrfc/data_container.pyx":321 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * type_desc = TypeDescription(name, nuc_length, uc_length) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1004 + * if rc != RFC_OK: + * self._error(&errorInfo) + * return rc # <<<<<<<<<<<<<< * - * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) + * ########################################################################## */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_TypeDescription_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 321, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nuc_length); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_uc_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_name, __pyx_t_4, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 321, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_name, __pyx_t_4, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 321, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_name); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_type_desc = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":323 - * type_desc = TypeDescription(name, nuc_length, uc_length) + /* "pyrfc/_cyrfc.pyx":985 + * return rc + * + * def func_desc_remove(self, sysid, func_name): # <<<<<<<<<<<<<< + * """Removes the Function Description from SAP NW RFC Lib cache * - * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) */ - __pyx_v_rc = RfcGetFieldCount(__pyx_v_typeDesc, (&__pyx_v_fieldCount), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":324 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.func_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1009 + * # TRANSACTIONAL / QUEUED RFC * - * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * for i in range(fieldCount): + * def _get_transaction_id(self): # <<<<<<<<<<<<<< + * """ Returns a unique 24 char transaction ID (GUID).""" + * cdef RFC_RC rc */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":325 - * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * for i in range(fieldCount): - * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) - */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 325, __pyx_L1_error) +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_41_get_transaction_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_40_get_transaction_id[] = " Returns a unique 24 char transaction ID (GUID)."; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_41_get_transaction_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_transaction_id (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_40_get_transaction_id(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_40_get_transaction_id(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_TID __pyx_v_tid; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_transaction_id", 0); - /* "src/pyrfc/data_container.pyx":324 + /* "pyrfc/_cyrfc.pyx":1015 + * cdef RFC_TID tid * - * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * for i in range(fieldCount): + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((!__pyx_t_2) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":326 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * for i in range(fieldCount): # <<<<<<<<<<<<<< - * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1016 + * + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) * if rc != RFC_OK: */ - __pyx_t_9 = __pyx_v_fieldCount; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":327 - * raise wrapError(&errorInfo) - * for i in range(fieldCount): - * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1015 + * cdef RFC_TID tid + * + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) + */ + } + + /* "pyrfc/_cyrfc.pyx":1017 + * if not self.alive: + * self._open() + * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) # <<<<<<<<<<<<<< * if rc != RFC_OK: - * raise wrapError(&errorInfo) + * self._error(&errorInfo) */ - __pyx_v_rc = RfcGetFieldDescByIndex(__pyx_v_typeDesc, __pyx_v_i, (&__pyx_v_fieldDesc), (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetTransactionID(__pyx_v_self->_handle, __pyx_v_tid, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":328 - * for i in range(fieldCount): - * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1018 + * self._open() + * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * field_description = { + * self._error(&errorInfo) + * return wrapString(tid, RFC_TID_LN) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":329 - * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1019 + * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * field_description = { - * 'name': wrapString(fieldDesc.name), + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * return wrapString(tid, RFC_TID_LN) + * */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 329, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1019, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":328 - * for i in range(fieldCount): - * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1018 + * self._open() + * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * field_description = { + * self._error(&errorInfo) + * return wrapString(tid, RFC_TID_LN) */ - } + } - /* "src/pyrfc/data_container.pyx":331 - * raise wrapError(&errorInfo) - * field_description = { - * 'name': wrapString(fieldDesc.name), # <<<<<<<<<<<<<< - * 'field_type': RfcFieldType(fieldDesc.type).name, - * 'nuc_length': fieldDesc.nucLength, + /* "pyrfc/_cyrfc.pyx":1020 + * if rc != RFC_OK: + * self._error(&errorInfo) + * return wrapString(tid, RFC_TID_LN) # <<<<<<<<<<<<<< + * + * def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_fieldDesc.name, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_name, __pyx_t_3) < 0) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_int(RFC_TID_LN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.uclen = __pyx_t_1; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_tid, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":332 - * field_description = { - * 'name': wrapString(fieldDesc.name), - * 'field_type': RfcFieldType(fieldDesc.type).name, # <<<<<<<<<<<<<< - * 'nuc_length': fieldDesc.nucLength, - * 'nuc_offset': fieldDesc.nucOffset, - */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_fieldDesc.type); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_field_type, __pyx_t_8) < 0) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "src/pyrfc/data_container.pyx":333 - * 'name': wrapString(fieldDesc.name), - * 'field_type': RfcFieldType(fieldDesc.type).name, - * 'nuc_length': fieldDesc.nucLength, # <<<<<<<<<<<<<< - * 'nuc_offset': fieldDesc.nucOffset, - * 'uc_length': fieldDesc.ucLength, - */ - __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.nucLength); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nuc_length, __pyx_t_8) < 0) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "src/pyrfc/data_container.pyx":334 - * 'field_type': RfcFieldType(fieldDesc.type).name, - * 'nuc_length': fieldDesc.nucLength, - * 'nuc_offset': fieldDesc.nucOffset, # <<<<<<<<<<<<<< - * 'uc_length': fieldDesc.ucLength, - * 'uc_offset': fieldDesc.ucOffset, - */ - __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.nucOffset); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 334, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nuc_offset, __pyx_t_8) < 0) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "src/pyrfc/data_container.pyx":335 - * 'nuc_length': fieldDesc.nucLength, - * 'nuc_offset': fieldDesc.nucOffset, - * 'uc_length': fieldDesc.ucLength, # <<<<<<<<<<<<<< - * 'uc_offset': fieldDesc.ucOffset, - * 'decimals': fieldDesc.decimals - */ - __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.ucLength); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uc_length, __pyx_t_8) < 0) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "src/pyrfc/data_container.pyx":336 - * 'nuc_offset': fieldDesc.nucOffset, - * 'uc_length': fieldDesc.ucLength, - * 'uc_offset': fieldDesc.ucOffset, # <<<<<<<<<<<<<< - * 'decimals': fieldDesc.decimals - * } - */ - __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.ucOffset); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uc_offset, __pyx_t_8) < 0) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "src/pyrfc/data_container.pyx":337 - * 'uc_length': fieldDesc.ucLength, - * 'uc_offset': fieldDesc.ucOffset, - * 'decimals': fieldDesc.decimals # <<<<<<<<<<<<<< - * } - * if fieldDesc.typeDescHandle is NULL: - */ - __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.decimals); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_decimals, __pyx_t_8) < 0) __PYX_ERR(4, 331, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_field_description, ((PyObject*)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "src/pyrfc/data_container.pyx":339 - * 'decimals': fieldDesc.decimals - * } - * if fieldDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< - * field_description['type_description'] = None - * else: - */ - __pyx_t_1 = ((__pyx_v_fieldDesc.typeDescHandle == NULL) != 0); - if (__pyx_t_1) { - - /* "src/pyrfc/data_container.pyx":340 - * } - * if fieldDesc.typeDescHandle is NULL: - * field_description['type_description'] = None # <<<<<<<<<<<<<< - * else: - * field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) - */ - if (unlikely(PyDict_SetItem(__pyx_v_field_description, __pyx_n_s_type_description, Py_None) < 0)) __PYX_ERR(4, 340, __pyx_L1_error) - - /* "src/pyrfc/data_container.pyx":339 - * 'decimals': fieldDesc.decimals - * } - * if fieldDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< - * field_description['type_description'] = None - * else: - */ - goto __pyx_L9; - } - - /* "src/pyrfc/data_container.pyx":342 - * field_description['type_description'] = None - * else: - * field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) # <<<<<<<<<<<<<< - * # Add field to object - * type_desc.add_field(**field_description) - */ - /*else*/ { - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(__pyx_v_fieldDesc.typeDescHandle); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(PyDict_SetItem(__pyx_v_field_description, __pyx_n_s_type_description, __pyx_t_2) < 0)) __PYX_ERR(4, 342, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L9:; - - /* "src/pyrfc/data_container.pyx":344 - * field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) - * # Add field to object - * type_desc.add_field(**field_description) # <<<<<<<<<<<<<< - * - * return type_desc - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_add_field); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 344, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyDict_Copy(__pyx_v_field_description); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 344, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 344, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "src/pyrfc/data_container.pyx":346 - * type_desc.add_field(**field_description) - * - * return type_desc # <<<<<<<<<<<<<< - * - * cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_type_desc); - __pyx_r = __pyx_v_type_desc; - goto __pyx_L0; - - /* "src/pyrfc/data_container.pyx":301 - * - * - * cdef wrapTypeDescription(RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< - * """ Parses a RFC_TYPE_DESC_HANDLE + /* "pyrfc/_cyrfc.pyx":1009 + * # TRANSACTIONAL / QUEUED RFC * + * def _get_transaction_id(self): # <<<<<<<<<<<<<< + * """ Returns a unique 24 char transaction ID (GUID).""" + * cdef RFC_RC rc */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapTypeDescription", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._get_transaction_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_type_desc); - __Pyx_XDECREF(__pyx_v_field_description); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":348 - * return type_desc +/* "pyrfc/_cyrfc.pyx":1022 + * return wrapString(tid, RFC_TID_LN) * - * cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): # <<<<<<<<<<<<<< + * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) + * cdef RFC_RC rc */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_43_create_and_submit_transaction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_43_create_and_submit_transaction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_transaction_id = 0; + PyObject *__pyx_v_calls = 0; + PyObject *__pyx_v_queue_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_create_and_submit_transaction (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transaction_id,&__pyx_n_s_calls,&__pyx_n_s_queue_name,0}; + PyObject* values[3] = {0,0,0}; + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 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_transaction_id)) != 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_calls)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_create_and_submit_transaction", 0, 2, 3, 1); __PYX_ERR(0, 1022, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_name); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_and_submit_transaction") < 0)) __PYX_ERR(0, 1022, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_transaction_id = values[0]; + __pyx_v_calls = values[1]; + __pyx_v_queue_name = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_create_and_submit_transaction", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1022, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_42_create_and_submit_transaction(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_transaction_id, __pyx_v_calls, __pyx_v_queue_name); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_42_create_and_submit_transaction(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_transaction_id, PyObject *__pyx_v_calls, PyObject *__pyx_v_queue_name) { RFC_RC __pyx_v_rc; RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_ABAP_NAME __pyx_v_functionName; - unsigned int __pyx_v_i; - unsigned int __pyx_v_paramCount; - RFC_PARAMETER_DESC __pyx_v_paramDesc; + SAP_UC *__pyx_v_queueName; + RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; + RFC_FUNCTION_HANDLE __pyx_v_funcCont; + SAP_UC *__pyx_v_tid; + PyObject *__pyx_v_func_name = NULL; + PyObject *__pyx_v_params = NULL; + SAP_UC *__pyx_v_funcName; PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_func_desc = NULL; - PyObject *__pyx_v_parameter_description = NULL; + PyObject *__pyx_v_value = NULL; + CYTHON_UNUSED PyObject *__pyx_v_e = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - unsigned int __pyx_t_5; - unsigned int __pyx_t_6; - unsigned int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + SAP_UC *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *(*__pyx_t_14)(PyObject *); + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + char const *__pyx_t_19; + PyObject *__pyx_t_20 = NULL; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapFunctionDescription", 0); + __Pyx_RefNannySetupContext("_create_and_submit_transaction", 0); - /* "src/pyrfc/data_container.pyx":355 - * cdef RFC_PARAMETER_DESC paramDesc + /* "pyrfc/_cyrfc.pyx":1030 + * cdef RFC_FUNCTION_HANDLE funcCont + * + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() * - * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) */ - __pyx_v_rc = RfcGetFunctionName(__pyx_v_funcDesc, __pyx_v_functionName, (&__pyx_v_errorInfo)); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1030, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((!__pyx_t_2) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":356 + /* "pyrfc/_cyrfc.pyx":1031 * - * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * name = wrapString(functionName) + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * + * tid = fillString(transaction_id) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":357 - * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * name = wrapString(functionName) - * func_desc = FunctionDescription(name) + /* "pyrfc/_cyrfc.pyx":1030 + * cdef RFC_FUNCTION_HANDLE funcCont + * + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 357, __pyx_L1_error) + } - /* "src/pyrfc/data_container.pyx":356 + /* "pyrfc/_cyrfc.pyx":1033 + * self._open() * - * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * name = wrapString(functionName) + * tid = fillString(transaction_id) # <<<<<<<<<<<<<< + * queueName = NULL + * if queue_name: */ - } + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_transaction_id); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1033, __pyx_L1_error) + __pyx_v_tid = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":358 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * name = wrapString(functionName) # <<<<<<<<<<<<<< - * func_desc = FunctionDescription(name) + /* "pyrfc/_cyrfc.pyx":1034 * + * tid = fillString(transaction_id) + * queueName = NULL # <<<<<<<<<<<<<< + * if queue_name: + * queueName = fillString(queue_name) */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_functionName, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_name = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_queueName = NULL; - /* "src/pyrfc/data_container.pyx":359 - * raise wrapError(&errorInfo) - * name = wrapString(functionName) - * func_desc = FunctionDescription(name) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1035 + * tid = fillString(transaction_id) + * queueName = NULL + * if queue_name: # <<<<<<<<<<<<<< + * queueName = fillString(queue_name) + * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_queue_name); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1035, __pyx_L1_error) + if (__pyx_t_3) { + + /* "pyrfc/_cyrfc.pyx":1036 + * queueName = NULL + * if queue_name: + * queueName = fillString(queue_name) # <<<<<<<<<<<<<< + * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) * - * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FunctionDescription_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_queue_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1036, __pyx_L1_error) + __pyx_v_queueName = __pyx_t_4; + + /* "pyrfc/_cyrfc.pyx":1035 + * tid = fillString(transaction_id) + * queueName = NULL + * if queue_name: # <<<<<<<<<<<<<< + * queueName = fillString(queue_name) + * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) + */ } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_name); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_func_desc = __pyx_t_2; - __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":361 - * func_desc = FunctionDescription(name) + /* "pyrfc/_cyrfc.pyx":1037 + * if queue_name: + * queueName = fillString(queue_name) + * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) # <<<<<<<<<<<<<< * - * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + * if queue_name: */ - __pyx_v_rc = RfcGetParameterCount(__pyx_v_funcDesc, (&__pyx_v_paramCount), (&__pyx_v_errorInfo)); + __pyx_v_self->_tHandle = RfcCreateTransaction(__pyx_v_self->_handle, __pyx_v_tid, __pyx_v_queueName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":362 + /* "pyrfc/_cyrfc.pyx":1039 + * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) * - * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * for i in range(paramCount): + * if queue_name: # <<<<<<<<<<<<<< + * free(queueName) + * free(tid) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_queue_name); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1039, __pyx_L1_error) + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":363 - * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * for i in range(paramCount): - * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1040 + * + * if queue_name: + * free(queueName) # <<<<<<<<<<<<<< + * free(tid) + * if self._tHandle == NULL: */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 363, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 363, __pyx_L1_error) + free(__pyx_v_queueName); - /* "src/pyrfc/data_container.pyx":362 + /* "pyrfc/_cyrfc.pyx":1039 + * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) * - * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * for i in range(paramCount): + * if queue_name: # <<<<<<<<<<<<<< + * free(queueName) + * free(tid) */ } - /* "src/pyrfc/data_container.pyx":364 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * for i in range(paramCount): # <<<<<<<<<<<<<< - * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1041 + * if queue_name: + * free(queueName) + * free(tid) # <<<<<<<<<<<<<< + * if self._tHandle == NULL: + * self._error(&errorInfo) */ - __pyx_t_5 = __pyx_v_paramCount; - __pyx_t_6 = __pyx_t_5; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + free(__pyx_v_tid); - /* "src/pyrfc/data_container.pyx":365 - * raise wrapError(&errorInfo) - * for i in range(paramCount): - * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1042 + * free(queueName) + * free(tid) + * if self._tHandle == NULL: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * self.active_transaction = True */ - __pyx_v_rc = RfcGetParameterDescByIndex(__pyx_v_funcDesc, __pyx_v_i, (&__pyx_v_paramDesc), (&__pyx_v_errorInfo)); + __pyx_t_3 = ((__pyx_v_self->_tHandle == NULL) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":366 - * for i in range(paramCount): - * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * parameter_description = { + /* "pyrfc/_cyrfc.pyx":1043 + * free(tid) + * if self._tHandle == NULL: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * self.active_transaction = True + * */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":367 - * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * parameter_description = { - * 'name': wrapString(paramDesc.name), + /* "pyrfc/_cyrfc.pyx":1042 + * free(queueName) + * free(tid) + * if self._tHandle == NULL: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * self.active_transaction = True */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 367, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 367, __pyx_L1_error) + } - /* "src/pyrfc/data_container.pyx":366 - * for i in range(paramCount): - * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * parameter_description = { + /* "pyrfc/_cyrfc.pyx":1044 + * if self._tHandle == NULL: + * self._error(&errorInfo) + * self.active_transaction = True # <<<<<<<<<<<<<< + * + * try: */ - } + __pyx_v_self->active_transaction = 1; - /* "src/pyrfc/data_container.pyx":369 - * raise wrapError(&errorInfo) - * parameter_description = { - * 'name': wrapString(paramDesc.name), # <<<<<<<<<<<<<< - * 'parameter_type': RfcFieldType(paramDesc.type).name, - * 'direction': RfcParameterDirection(paramDesc.direction).name, - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.name, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_name, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/data_container.pyx":370 - * parameter_description = { - * 'name': wrapString(paramDesc.name), - * 'parameter_type': RfcFieldType(paramDesc.type).name, # <<<<<<<<<<<<<< - * 'direction': RfcParameterDirection(paramDesc.direction).name, - * 'nuc_length': paramDesc.nucLength, + /* "pyrfc/_cyrfc.pyx":1046 + * self.active_transaction = True + * + * try: # <<<<<<<<<<<<<< + * for func_name, params in calls: + * funcName = fillString(func_name) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_paramDesc.type); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_parameter_type, __pyx_t_4) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + /*try:*/ { - /* "src/pyrfc/data_container.pyx":371 - * 'name': wrapString(paramDesc.name), - * 'parameter_type': RfcFieldType(paramDesc.type).name, - * 'direction': RfcParameterDirection(paramDesc.direction).name, # <<<<<<<<<<<<<< - * 'nuc_length': paramDesc.nucLength, - * 'uc_length': paramDesc.ucLength, + /* "pyrfc/_cyrfc.pyx":1047 + * + * try: + * for func_name, params in calls: # <<<<<<<<<<<<<< + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyInt_From_RFC_DIRECTION(__pyx_v_paramDesc.direction); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + if (likely(PyList_CheckExact(__pyx_v_calls)) || PyTuple_CheckExact(__pyx_v_calls)) { + __pyx_t_1 = __pyx_v_calls; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_calls); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1047, __pyx_L7_error) } - } - __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_direction, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/data_container.pyx":372 - * 'parameter_type': RfcFieldType(paramDesc.type).name, - * 'direction': RfcParameterDirection(paramDesc.direction).name, - * 'nuc_length': paramDesc.nucLength, # <<<<<<<<<<<<<< - * 'uc_length': paramDesc.ucLength, - * 'decimals': paramDesc.decimals, - */ - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_paramDesc.nucLength); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 372, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nuc_length, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1047, __pyx_L7_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1047, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1047, __pyx_L7_error) + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1047, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + #endif + } + } else { + __pyx_t_10 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_10)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1047, __pyx_L7_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_10); + } + if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { + PyObject* sequence = __pyx_t_10; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1047, __pyx_L7_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_11 = PyList_GET_ITEM(sequence, 0); + __pyx_t_12 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + #else + __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1047, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1047, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_12); + #endif + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_13 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1047, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext; + index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L15_unpacking_failed; + __Pyx_GOTREF(__pyx_t_11); + index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L15_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) __PYX_ERR(0, 1047, __pyx_L7_error) + __pyx_t_14 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L16_unpacking_done; + __pyx_L15_unpacking_failed:; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1047, __pyx_L7_error) + __pyx_L16_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_11); + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_12); + __pyx_t_12 = 0; - /* "src/pyrfc/data_container.pyx":373 - * 'direction': RfcParameterDirection(paramDesc.direction).name, - * 'nuc_length': paramDesc.nucLength, - * 'uc_length': paramDesc.ucLength, # <<<<<<<<<<<<<< - * 'decimals': paramDesc.decimals, - * 'default_value': wrapString(paramDesc.defaultValue), + /* "pyrfc/_cyrfc.pyx":1048 + * try: + * for func_name, params in calls: + * funcName = fillString(func_name) # <<<<<<<<<<<<<< + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) */ - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_paramDesc.ucLength); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 373, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uc_length, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1048, __pyx_L7_error) + __pyx_v_funcName = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":374 - * 'nuc_length': paramDesc.nucLength, - * 'uc_length': paramDesc.ucLength, - * 'decimals': paramDesc.decimals, # <<<<<<<<<<<<<< - * 'default_value': wrapString(paramDesc.defaultValue), - * 'parameter_text': wrapString(paramDesc.parameterText), + /* "pyrfc/_cyrfc.pyx":1049 + * for func_name, params in calls: + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< + * free(funcName) + * if not funcDesc: */ - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_paramDesc.decimals); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_decimals, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":375 - * 'uc_length': paramDesc.ucLength, - * 'decimals': paramDesc.decimals, - * 'default_value': wrapString(paramDesc.defaultValue), # <<<<<<<<<<<<<< - * 'parameter_text': wrapString(paramDesc.parameterText), - * 'optional': bool(paramDesc.optional) + /* "pyrfc/_cyrfc.pyx":1050 + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) # <<<<<<<<<<<<<< + * if not funcDesc: + * self._error(&errorInfo) */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.defaultValue, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 375, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_default_value, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + free(__pyx_v_funcName); - /* "src/pyrfc/data_container.pyx":376 - * 'decimals': paramDesc.decimals, - * 'default_value': wrapString(paramDesc.defaultValue), - * 'parameter_text': wrapString(paramDesc.parameterText), # <<<<<<<<<<<<<< - * 'optional': bool(paramDesc.optional) - * # skip: void* extendedDescription; + /* "pyrfc/_cyrfc.pyx":1051 + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.parameterText, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 376, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_parameter_text, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = ((!(__pyx_v_funcDesc != 0)) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":377 - * 'default_value': wrapString(paramDesc.defaultValue), - * 'parameter_text': wrapString(paramDesc.parameterText), - * 'optional': bool(paramDesc.optional) # <<<<<<<<<<<<<< - * # skip: void* extendedDescription; - * # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. + /* "pyrfc/_cyrfc.pyx":1052 + * free(funcName) + * if not funcDesc: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: */ - __pyx_t_3 = __Pyx_PyInt_From_SAP_RAW(__pyx_v_paramDesc.optional); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 377, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 377, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_optional, __pyx_t_3) < 0) __PYX_ERR(4, 369, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_parameter_description, ((PyObject*)__pyx_t_2)); - __pyx_t_2 = 0; + __pyx_t_10 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1052, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "src/pyrfc/data_container.pyx":381 - * # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. - * } - * if paramDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< - * parameter_description['type_description'] = None - * else: + /* "pyrfc/_cyrfc.pyx":1051 + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) */ - __pyx_t_1 = ((__pyx_v_paramDesc.typeDescHandle == NULL) != 0); - if (__pyx_t_1) { + } - /* "src/pyrfc/data_container.pyx":382 - * } - * if paramDesc.typeDescHandle is NULL: - * parameter_description['type_description'] = None # <<<<<<<<<<<<<< - * else: - * parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) + /* "pyrfc/_cyrfc.pyx":1053 + * if not funcDesc: + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) # <<<<<<<<<<<<<< + * if not funcCont: + * self._error(&errorInfo) */ - if (unlikely(PyDict_SetItem(__pyx_v_parameter_description, __pyx_n_s_type_description, Py_None) < 0)) __PYX_ERR(4, 382, __pyx_L1_error) + __pyx_v_funcCont = RfcCreateFunction(__pyx_v_funcDesc, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":381 - * # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. - * } - * if paramDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< - * parameter_description['type_description'] = None - * else: + /* "pyrfc/_cyrfc.pyx":1054 + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * try: */ - goto __pyx_L8; - } + __pyx_t_3 = ((!(__pyx_v_funcCont != 0)) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":384 - * parameter_description['type_description'] = None - * else: - * parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) # <<<<<<<<<<<<<< - * func_desc.add_parameter(**parameter_description) - * + /* "pyrfc/_cyrfc.pyx":1055 + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * try: + * for name, value in params.iteritems(): */ - /*else*/ { - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(__pyx_v_paramDesc.typeDescHandle); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 384, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (unlikely(PyDict_SetItem(__pyx_v_parameter_description, __pyx_n_s_type_description, __pyx_t_2) < 0)) __PYX_ERR(4, 384, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L8:; + __pyx_t_10 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1055, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "src/pyrfc/data_container.pyx":385 - * else: - * parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) - * func_desc.add_parameter(**parameter_description) # <<<<<<<<<<<<<< - * - * return func_desc + /* "pyrfc/_cyrfc.pyx":1054 + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * try: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_desc, __pyx_n_s_add_parameter); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyDict_Copy(__pyx_v_parameter_description); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } + } - /* "src/pyrfc/data_container.pyx":387 - * func_desc.add_parameter(**parameter_description) - * - * return func_desc # <<<<<<<<<<<<<< - * - * + /* "pyrfc/_cyrfc.pyx":1056 + * if not funcCont: + * self._error(&errorInfo) + * try: # <<<<<<<<<<<<<< + * for name, value in params.iteritems(): + * fillFunctionParameter(funcDesc, funcCont, name, value) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_func_desc); - __pyx_r = __pyx_v_func_desc; - goto __pyx_L0; + /*try:*/ { - /* "src/pyrfc/data_container.pyx":348 - * return type_desc - * - * cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":1057 + * self._error(&errorInfo) + * try: + * for name, value in params.iteritems(): # <<<<<<<<<<<<<< + * fillFunctionParameter(funcDesc, funcCont, name, value) + * # Add RFC call to transaction */ + __pyx_t_15 = 0; + if (unlikely(__pyx_v_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(0, 1057, __pyx_L22_error) + } + __pyx_t_12 = __Pyx_dict_iterator(__pyx_v_params, 0, __pyx_n_s_iteritems, (&__pyx_t_16), (&__pyx_t_17)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1057, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_10); + __pyx_t_10 = __pyx_t_12; + __pyx_t_12 = 0; + while (1) { + __pyx_t_18 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_16, &__pyx_t_15, &__pyx_t_12, &__pyx_t_11, NULL, __pyx_t_17); + if (unlikely(__pyx_t_18 == 0)) break; + if (unlikely(__pyx_t_18 == -1)) __PYX_ERR(0, 1057, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_12); + __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); + __pyx_t_11 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapFunctionDescription", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_func_desc); - __Pyx_XDECREF(__pyx_v_parameter_description); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/data_container.pyx":390 - * - * - * cdef wrapResult( # <<<<<<<<<<<<<< - * RFC_FUNCTION_DESC_HANDLE funcDesc, - * RFC_FUNCTION_HANDLE container, + /* "pyrfc/_cyrfc.pyx":1058 + * try: + * for name, value in params.iteritems(): + * fillFunctionParameter(funcDesc, funcCont, name, value) # <<<<<<<<<<<<<< + * # Add RFC call to transaction + * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) */ + __pyx_t_11 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcCont, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1058, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapResult(RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc, RFC_FUNCTION_HANDLE __pyx_v_container, RFC_DIRECTION __pyx_v_filter_parameter_direction, PyObject *__pyx_v_config) { - unsigned int __pyx_v_i; - unsigned int __pyx_v_paramCount; - RFC_PARAMETER_DESC __pyx_v_paramDesc; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - unsigned int __pyx_t_2; - unsigned int __pyx_t_3; - unsigned int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapResult", 0); - - /* "src/pyrfc/data_container.pyx":406 - * cdef unsigned i, paramCount - * cdef RFC_PARAMETER_DESC paramDesc - * RfcGetParameterCount(funcDesc, ¶mCount, NULL) # <<<<<<<<<<<<<< - * result = {} - * for i in range(paramCount): + /* "pyrfc/_cyrfc.pyx":1060 + * fillFunctionParameter(funcDesc, funcCont, name, value) + * # Add RFC call to transaction + * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - (void)(RfcGetParameterCount(__pyx_v_funcDesc, (&__pyx_v_paramCount), NULL)); + __pyx_v_rc = RfcInvokeInTransaction(__pyx_v_self->_tHandle, __pyx_v_funcCont, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":407 - * cdef RFC_PARAMETER_DESC paramDesc - * RfcGetParameterCount(funcDesc, ¶mCount, NULL) - * result = {} # <<<<<<<<<<<<<< - * for i in range(paramCount): - * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) + /* "pyrfc/_cyrfc.pyx":1061 + * # Add RFC call to transaction + * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * finally: */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_result = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":408 - * RfcGetParameterCount(funcDesc, ¶mCount, NULL) - * result = {} - * for i in range(paramCount): # <<<<<<<<<<<<<< - * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) - * if paramDesc.direction != filter_parameter_direction: + /* "pyrfc/_cyrfc.pyx":1062 + * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * finally: + * RfcDestroyFunction(funcCont, NULL) */ - __pyx_t_2 = __pyx_v_paramCount; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_10 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1062, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "src/pyrfc/data_container.pyx":409 - * result = {} - * for i in range(paramCount): - * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) # <<<<<<<<<<<<<< - * if paramDesc.direction != filter_parameter_direction: - * result[wrapString(paramDesc.name)] = wrapVariable( + /* "pyrfc/_cyrfc.pyx":1061 + * # Add RFC call to transaction + * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * finally: */ - (void)(RfcGetParameterDescByIndex(__pyx_v_funcDesc, __pyx_v_i, (&__pyx_v_paramDesc), NULL)); + } + } - /* "src/pyrfc/data_container.pyx":410 - * for i in range(paramCount): - * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) - * if paramDesc.direction != filter_parameter_direction: # <<<<<<<<<<<<<< - * result[wrapString(paramDesc.name)] = wrapVariable( - * paramDesc.type, + /* "pyrfc/_cyrfc.pyx":1064 + * self._error(&errorInfo) + * finally: + * RfcDestroyFunction(funcCont, NULL) # <<<<<<<<<<<<<< + * # execute + * with nogil: */ - __pyx_t_5 = ((__pyx_v_paramDesc.direction != __pyx_v_filter_parameter_direction) != 0); - if (__pyx_t_5) { + /*finally:*/ { + /*normal exit:*/{ + (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); + goto __pyx_L23; + } + __pyx_L22_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_20); + __Pyx_XGOTREF(__pyx_t_21); + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_23); + __Pyx_XGOTREF(__pyx_t_24); + __Pyx_XGOTREF(__pyx_t_25); + __pyx_t_17 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename; + { + (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_XGIVEREF(__pyx_t_24); + __Pyx_XGIVEREF(__pyx_t_25); + __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25); + } + __Pyx_XGIVEREF(__pyx_t_20); + __Pyx_XGIVEREF(__pyx_t_21); + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_22); + __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; + __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19; + goto __pyx_L7_error; + } + __pyx_L23:; + } - /* "src/pyrfc/data_container.pyx":411 - * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) - * if paramDesc.direction != filter_parameter_direction: - * result[wrapString(paramDesc.name)] = wrapVariable( # <<<<<<<<<<<<<< - * paramDesc.type, - * container, + /* "pyrfc/_cyrfc.pyx":1047 + * + * try: + * for func_name, params in calls: # <<<<<<<<<<<<<< + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapVariable(__pyx_v_paramDesc.type, __pyx_v_container, __pyx_v_paramDesc.name, __pyx_v_paramDesc.nucLength, __pyx_v_paramDesc.typeDescHandle, __pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.name, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyDict_SetItem(__pyx_v_result, __pyx_t_6, __pyx_t_1) < 0)) __PYX_ERR(4, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":410 - * for i in range(paramCount): - * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) - * if paramDesc.direction != filter_parameter_direction: # <<<<<<<<<<<<<< - * result[wrapString(paramDesc.name)] = wrapVariable( - * paramDesc.type, + /* "pyrfc/_cyrfc.pyx":1066 + * RfcDestroyFunction(funcCont, NULL) + * # execute + * with nogil: # <<<<<<<<<<<<<< + * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: */ - } - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "src/pyrfc/data_container.pyx":419 - * config - * ) - * return result # <<<<<<<<<<<<<< - * - * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): + /* "pyrfc/_cyrfc.pyx":1067 + * # execute + * with nogil: + * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_v_rc = RfcSubmitTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); + } + + /* "pyrfc/_cyrfc.pyx":1066 + * RfcDestroyFunction(funcCont, NULL) + * # execute + * with nogil: # <<<<<<<<<<<<<< + * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L33; + } + __pyx_L33:; + } + } - /* "src/pyrfc/data_container.pyx":390 + /* "pyrfc/_cyrfc.pyx":1068 + * with nogil: + * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) * + */ + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_3) { + + /* "pyrfc/_cyrfc.pyx":1069 + * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< * - * cdef wrapResult( # <<<<<<<<<<<<<< - * RFC_FUNCTION_DESC_HANDLE funcDesc, - * RFC_FUNCTION_HANDLE container, + * except RFCError as e: */ + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapResult", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":1068 + * with nogil: + * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * + */ + } -/* "src/pyrfc/data_container.pyx":421 - * return result + /* "pyrfc/_cyrfc.pyx":1046 + * self.active_transaction = True * - * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): # <<<<<<<<<<<<<< - * return { - * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), + * try: # <<<<<<<<<<<<<< + * for func_name, params in calls: + * funcName = fillString(func_name) */ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L12_try_end; + __pyx_L7_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier(RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapUnitIdentifier", 0); + /* "pyrfc/_cyrfc.pyx":1071 + * self._error(&errorInfo) + * + * except RFCError as e: # <<<<<<<<<<<<<< + * # clean up actions + * RfcDestroyTransaction(self._tHandle, NULL) + */ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_10, &__pyx_t_11); + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1071, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_10, __pyx_t_11); + __pyx_t_1 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; + if (__pyx_t_18) { + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_1) < 0) __PYX_ERR(0, 1071, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_10); + __pyx_v_e = __pyx_t_10; - /* "src/pyrfc/data_container.pyx":422 + /* "pyrfc/_cyrfc.pyx":1073 + * except RFCError as e: + * # clean up actions + * RfcDestroyTransaction(self._tHandle, NULL) # <<<<<<<<<<<<<< + * raise * - * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): - * return { # <<<<<<<<<<<<<< - * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), - * 'id': wrapString(uIdentifier.unitID) */ - __Pyx_XDECREF(__pyx_r); + (void)(RfcDestroyTransaction(__pyx_v_self->_tHandle, NULL)); - /* "src/pyrfc/data_container.pyx":423 - * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): - * return { - * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), # <<<<<<<<<<<<<< - * 'id': wrapString(uIdentifier.unitID) - * } + /* "pyrfc/_cyrfc.pyx":1074 + * # clean up actions + * RfcDestroyTransaction(self._tHandle, NULL) + * raise # <<<<<<<<<<<<<< + * + * def _destroy_transaction(self): */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3.__pyx_n = 1; - __pyx_t_3.uclen = __pyx_int_1; - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString((&__pyx_v_uIdentifier.unitType), &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_n_s_Q, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 423, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_queued, __pyx_t_4) < 0) __PYX_ERR(4, 423, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_10, __pyx_t_1); + __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 1074, __pyx_L9_except_error) + } + goto __pyx_L9_except_error; + __pyx_L9_except_error:; - /* "src/pyrfc/data_container.pyx":424 - * return { - * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), - * 'id': wrapString(uIdentifier.unitID) # <<<<<<<<<<<<<< - * } + /* "pyrfc/_cyrfc.pyx":1046 + * self.active_transaction = True * + * try: # <<<<<<<<<<<<<< + * for func_name, params in calls: + * funcName = fillString(func_name) */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uIdentifier.unitID, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_id, __pyx_t_4) < 0) __PYX_ERR(4, 423, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + goto __pyx_L1_error; + __pyx_L12_try_end:; + } - /* "src/pyrfc/data_container.pyx":421 - * return result + /* "pyrfc/_cyrfc.pyx":1022 + * return wrapString(tid, RFC_TID_LN) * - * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): # <<<<<<<<<<<<<< - * return { - * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), + * def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): # <<<<<<<<<<<<<< + * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) + * cdef RFC_RC rc */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapUnitIdentifier", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_func_name); + __Pyx_XDECREF(__pyx_v_params); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_e); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":427 - * } +/* "pyrfc/_cyrfc.pyx":1076 + * raise * - * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): # <<<<<<<<<<<<<< - * unit_attributes = {} - * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 + * def _destroy_transaction(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *__pyx_v_uattr) { - PyObject *__pyx_v_unit_attributes = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_45_destroy_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_45_destroy_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_destroy_transaction (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_44_destroy_transaction(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_44_destroy_transaction(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_2; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapUnitAttributes", 0); - - /* "src/pyrfc/data_container.pyx":428 - * - * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): - * unit_attributes = {} # <<<<<<<<<<<<<< - * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 - * unit_attributes['sat_trace'] = uattr.satTrace != 0 - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_unit_attributes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "src/pyrfc/data_container.pyx":429 - * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): - * unit_attributes = {} - * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 # <<<<<<<<<<<<<< - * unit_attributes['sat_trace'] = uattr.satTrace != 0 - * unit_attributes['unit_history'] = uattr.unitHistory != 0 - */ - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->kernelTrace != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_kernel_trace, __pyx_t_1) < 0)) __PYX_ERR(4, 429, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/data_container.pyx":430 - * unit_attributes = {} - * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 - * unit_attributes['sat_trace'] = uattr.satTrace != 0 # <<<<<<<<<<<<<< - * unit_attributes['unit_history'] = uattr.unitHistory != 0 - * unit_attributes['lock'] = uattr.lock != 0 - */ - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->satTrace != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 430, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_sat_trace, __pyx_t_1) < 0)) __PYX_ERR(4, 430, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("_destroy_transaction", 0); - /* "src/pyrfc/data_container.pyx":431 - * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 - * unit_attributes['sat_trace'] = uattr.satTrace != 0 - * unit_attributes['unit_history'] = uattr.unitHistory != 0 # <<<<<<<<<<<<<< - * unit_attributes['lock'] = uattr.lock != 0 - * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 + /* "pyrfc/_cyrfc.pyx":1079 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_transaction: # <<<<<<<<<<<<<< + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: */ - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->unitHistory != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_unit_history, __pyx_t_1) < 0)) __PYX_ERR(4, 431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = ((!(__pyx_v_self->active_transaction != 0)) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":432 - * unit_attributes['sat_trace'] = uattr.satTrace != 0 - * unit_attributes['unit_history'] = uattr.unitHistory != 0 - * unit_attributes['lock'] = uattr.lock != 0 # <<<<<<<<<<<<<< - * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 - * unit_attributes['user'] = wrapString(uattr.user, 12, True) + /* "pyrfc/_cyrfc.pyx":1080 + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_transaction: + * raise RFCError("No transaction handle for this connection available.") # <<<<<<<<<<<<<< + * if not self.alive: + * self._open() */ - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->lock != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 432, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_lock, __pyx_t_1) < 0)) __PYX_ERR(4, 432, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1080, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_transaction_handle_for_this_c) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_transaction_handle_for_this_c); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1080, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1080, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":433 - * unit_attributes['unit_history'] = uattr.unitHistory != 0 - * unit_attributes['lock'] = uattr.lock != 0 - * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 # <<<<<<<<<<<<<< - * unit_attributes['user'] = wrapString(uattr.user, 12, True) - * unit_attributes['client'] = wrapString(uattr.client, 3, True) + /* "pyrfc/_cyrfc.pyx":1079 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_transaction: # <<<<<<<<<<<<<< + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: */ - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->noCommitCheck != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 433, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_no_commit_check, __pyx_t_1) < 0)) __PYX_ERR(4, 433, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "src/pyrfc/data_container.pyx":434 - * unit_attributes['lock'] = uattr.lock != 0 - * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 - * unit_attributes['user'] = wrapString(uattr.user, 12, True) # <<<<<<<<<<<<<< - * unit_attributes['client'] = wrapString(uattr.client, 3, True) - * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) + /* "pyrfc/_cyrfc.pyx":1081 + * if not self.active_transaction: + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) */ - __pyx_t_2.__pyx_n = 2; - __pyx_t_2.uclen = __pyx_int_12; - __pyx_t_2.rstrip = Py_True; - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->user, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_user, __pyx_t_1) < 0)) __PYX_ERR(4, 434, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1081, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1081, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((!__pyx_t_1) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":435 - * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 - * unit_attributes['user'] = wrapString(uattr.user, 12, True) - * unit_attributes['client'] = wrapString(uattr.client, 3, True) # <<<<<<<<<<<<<< - * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) - * unit_attributes['program'] = wrapString(uattr.program, 40, True) + /* "pyrfc/_cyrfc.pyx":1082 + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False */ - __pyx_t_2.__pyx_n = 2; - __pyx_t_2.uclen = __pyx_int_3; - __pyx_t_2.rstrip = Py_True; - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->client, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 435, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_client, __pyx_t_1) < 0)) __PYX_ERR(4, 435, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1082, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":436 - * unit_attributes['user'] = wrapString(uattr.user, 12, True) - * unit_attributes['client'] = wrapString(uattr.client, 3, True) - * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) # <<<<<<<<<<<<<< - * unit_attributes['program'] = wrapString(uattr.program, 40, True) - * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) + /* "pyrfc/_cyrfc.pyx":1081 + * if not self.active_transaction: + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) */ - __pyx_t_2.__pyx_n = 2; - __pyx_t_2.uclen = __pyx_int_20; - __pyx_t_2.rstrip = Py_True; - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->tCode, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 436, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_t_code, __pyx_t_1) < 0)) __PYX_ERR(4, 436, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "src/pyrfc/data_container.pyx":437 - * unit_attributes['client'] = wrapString(uattr.client, 3, True) - * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) - * unit_attributes['program'] = wrapString(uattr.program, 40, True) # <<<<<<<<<<<<<< - * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) - * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) + /* "pyrfc/_cyrfc.pyx":1083 + * if not self.alive: + * self._open() + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< + * self.active_transaction = False + * if rc != RFC_OK: */ - __pyx_t_2.__pyx_n = 2; - __pyx_t_2.uclen = __pyx_int_40; - __pyx_t_2.rstrip = Py_True; - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->program, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_program, __pyx_t_1) < 0)) __PYX_ERR(4, 437, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rc = RfcDestroyTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":438 - * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) - * unit_attributes['program'] = wrapString(uattr.program, 40, True) - * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) # <<<<<<<<<<<<<< - * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) - * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) + /* "pyrfc/_cyrfc.pyx":1084 + * self._open() + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_t_2.__pyx_n = 2; - __pyx_t_2.uclen = __pyx_int_40; - __pyx_t_2.rstrip = Py_True; - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->hostname, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_hostname, __pyx_t_1) < 0)) __PYX_ERR(4, 438, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->active_transaction = 0; - /* "src/pyrfc/data_container.pyx":439 - * unit_attributes['program'] = wrapString(uattr.program, 40, True) - * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) - * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) # <<<<<<<<<<<<<< - * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) - * return unit_attributes + /* "pyrfc/_cyrfc.pyx":1085 + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_t_2.__pyx_n = 2; - __pyx_t_2.uclen = __pyx_int_8; - __pyx_t_2.rstrip = Py_True; - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->sendingDate, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 439, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_sending_date, __pyx_t_1) < 0)) __PYX_ERR(4, 439, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":440 - * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) - * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) - * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) # <<<<<<<<<<<<<< - * return unit_attributes + /* "pyrfc/_cyrfc.pyx":1086 + * self.active_transaction = False + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< * + * def _confirm_transaction(self): */ - __pyx_t_2.__pyx_n = 2; - __pyx_t_2.uclen = __pyx_int_6; - __pyx_t_2.rstrip = Py_True; - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->sendingTime, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_sending_time, __pyx_t_1) < 0)) __PYX_ERR(4, 440, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":441 - * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) - * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) - * return unit_attributes # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1085 + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) * - * cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_unit_attributes); - __pyx_r = __pyx_v_unit_attributes; - goto __pyx_L0; + } - /* "src/pyrfc/data_container.pyx":427 - * } + /* "pyrfc/_cyrfc.pyx":1076 + * raise * - * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): # <<<<<<<<<<<<<< - * unit_attributes = {} - * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 + * def _destroy_transaction(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapUnitAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._destroy_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_unit_attributes); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":443 - * return unit_attributes +/* "pyrfc/_cyrfc.pyx":1088 + * self._error(&errorInfo) * - * cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): # <<<<<<<<<<<<<< - * cdef unsigned i, fieldCount - * cdef RFC_FIELD_DESC fieldDesc + * def _confirm_transaction(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapStructure(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_STRUCTURE_HANDLE __pyx_v_container, PyObject *__pyx_v_config) { - unsigned int __pyx_v_i; - unsigned int __pyx_v_fieldCount; - RFC_FIELD_DESC __pyx_v_fieldDesc; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_r = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_47_confirm_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_47_confirm_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - unsigned int __pyx_t_2; - unsigned int __pyx_t_3; - unsigned int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapStructure", 0); + __Pyx_RefNannySetupContext("_confirm_transaction (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_46_confirm_transaction(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":446 - * cdef unsigned i, fieldCount - * cdef RFC_FIELD_DESC fieldDesc - * RfcGetFieldCount(typeDesc, &fieldCount, NULL) # <<<<<<<<<<<<<< - * result = {} - * for i in range(fieldCount): + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_46_confirm_transaction(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_confirm_transaction", 0); + + /* "pyrfc/_cyrfc.pyx":1091 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_transaction: # <<<<<<<<<<<<<< + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: */ - (void)(RfcGetFieldCount(__pyx_v_typeDesc, (&__pyx_v_fieldCount), NULL)); + __pyx_t_1 = ((!(__pyx_v_self->active_transaction != 0)) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":447 - * cdef RFC_FIELD_DESC fieldDesc - * RfcGetFieldCount(typeDesc, &fieldCount, NULL) - * result = {} # <<<<<<<<<<<<<< - * for i in range(fieldCount): - * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) + /* "pyrfc/_cyrfc.pyx":1092 + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_transaction: + * raise RFCError("No transaction handle for this connection available.") # <<<<<<<<<<<<<< + * if not self.alive: + * self._open() */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_result = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1092, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_transaction_handle_for_this_c) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_transaction_handle_for_this_c); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1092, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1092, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":448 - * RfcGetFieldCount(typeDesc, &fieldCount, NULL) - * result = {} - * for i in range(fieldCount): # <<<<<<<<<<<<<< - * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) - * result[wrapString(fieldDesc.name)] = wrapVariable( + /* "pyrfc/_cyrfc.pyx":1091 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_transaction: # <<<<<<<<<<<<<< + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: */ - __pyx_t_2 = __pyx_v_fieldCount; - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + } - /* "src/pyrfc/data_container.pyx":449 - * result = {} - * for i in range(fieldCount): - * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) # <<<<<<<<<<<<<< - * result[wrapString(fieldDesc.name)] = wrapVariable( - * fieldDesc.type, + /* "pyrfc/_cyrfc.pyx":1093 + * if not self.active_transaction: + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) */ - (void)(RfcGetFieldDescByIndex(__pyx_v_typeDesc, __pyx_v_i, (&__pyx_v_fieldDesc), NULL)); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((!__pyx_t_1) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":450 - * for i in range(fieldCount): - * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) - * result[wrapString(fieldDesc.name)] = wrapVariable( # <<<<<<<<<<<<<< - * fieldDesc.type, - * container, + /* "pyrfc/_cyrfc.pyx":1094 + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapVariable(__pyx_v_fieldDesc.type, __pyx_v_container, __pyx_v_fieldDesc.name, __pyx_v_fieldDesc.nucLength, __pyx_v_fieldDesc.typeDescHandle, __pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_fieldDesc.name, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(PyObject_SetItem(__pyx_v_result, __pyx_t_5, __pyx_t_1) < 0)) __PYX_ERR(4, 450, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1094, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":458 - * config - * ) - * if len(result) == 1: # <<<<<<<<<<<<<< - * if '' in result: - * result = result[''] + /* "pyrfc/_cyrfc.pyx":1093 + * if not self.active_transaction: + * raise RFCError("No transaction handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) */ - __pyx_t_6 = PyObject_Length(__pyx_v_result); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(4, 458, __pyx_L1_error) - __pyx_t_7 = ((__pyx_t_6 == 1) != 0); - if (__pyx_t_7) { + } - /* "src/pyrfc/data_container.pyx":459 - * ) - * if len(result) == 1: - * if '' in result: # <<<<<<<<<<<<<< - * result = result[''] - * return result + /* "pyrfc/_cyrfc.pyx":1095 + * if not self.alive: + * self._open() + * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__5, __pyx_v_result, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(4, 459, __pyx_L1_error) - __pyx_t_8 = (__pyx_t_7 != 0); - if (__pyx_t_8) { + __pyx_v_rc = RfcConfirmTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":460 - * if len(result) == 1: - * if '' in result: - * result = result[''] # <<<<<<<<<<<<<< - * return result - * + /* "pyrfc/_cyrfc.pyx":1096 + * self._open() + * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) */ - __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_result, __pyx_kp_s__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":459 - * ) - * if len(result) == 1: - * if '' in result: # <<<<<<<<<<<<<< - * result = result[''] - * return result + /* "pyrfc/_cyrfc.pyx":1097 + * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False */ - } + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1097, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":458 - * config - * ) - * if len(result) == 1: # <<<<<<<<<<<<<< - * if '' in result: - * result = result[''] + /* "pyrfc/_cyrfc.pyx":1096 + * self._open() + * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) */ } - /* "src/pyrfc/data_container.pyx":461 - * if '' in result: - * result = result[''] - * return result # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1098 + * if rc != RFC_OK: + * self._error(&errorInfo) + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< + * self.active_transaction = False + * if rc != RFC_OK: + */ + __pyx_v_rc = RfcDestroyTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":1099 + * self._error(&errorInfo) + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) + */ + __pyx_v_self->active_transaction = 0; + + /* "pyrfc/_cyrfc.pyx":1100 + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) * - * # # Used for debugging tables, cf. wrapTable() */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; - goto __pyx_L0; + __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":443 - * return unit_attributes + /* "pyrfc/_cyrfc.pyx":1101 + * self.active_transaction = False + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< * - * cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): # <<<<<<<<<<<<<< - * cdef unsigned i, fieldCount - * cdef RFC_FIELD_DESC fieldDesc + * ########################################################################## + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":1100 + * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + * self.active_transaction = False + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * + */ + } + + /* "pyrfc/_cyrfc.pyx":1088 + * self._error(&errorInfo) + * + * def _confirm_transaction(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapStructure", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._confirm_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":474 - * # return wrapStructure(self.typeDesc, self.container) +/* "pyrfc/_cyrfc.pyx":1106 + * # BACKGROUND RFC * - * cdef wrapTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, config): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef unsigned rowCount + * def _get_unit_id(self): # <<<<<<<<<<<<<< + * """Returns a unique 32 char bgRFC unit ID (GUID).""" + * cdef RFC_RC rc */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapTable(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_TABLE_HANDLE __pyx_v_container, PyObject *__pyx_v_config) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_49_get_unit_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_48_get_unit_id[] = "Returns a unique 32 char bgRFC unit ID (GUID)."; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_49_get_unit_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_unit_id (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_48_get_unit_id(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_48_get_unit_id(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; RFC_ERROR_INFO __pyx_v_errorInfo; - unsigned int __pyx_v_rowCount; - PyObject *__pyx_v_table = NULL; + RFC_UNITID __pyx_v_uid; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapTable", 0); + __Pyx_RefNannySetupContext("_get_unit_id", 0); - /* "src/pyrfc/data_container.pyx":482 - * # tc.container = container - * # return tc - * RfcGetRowCount(container, &rowCount, &errorInfo) # <<<<<<<<<<<<<< - * table = [None] * rowCount - * while rowCount > 0: + /* "pyrfc/_cyrfc.pyx":1112 + * cdef RFC_UNITID uid + * + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcGetUnitID(self._handle, uid, &errorInfo) */ - (void)(RfcGetRowCount(__pyx_v_container, (&__pyx_v_rowCount), (&__pyx_v_errorInfo))); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1112, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((!__pyx_t_2) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":483 - * # return tc - * RfcGetRowCount(container, &rowCount, &errorInfo) - * table = [None] * rowCount # <<<<<<<<<<<<<< - * while rowCount > 0: - * rowCount -= 1 + /* "pyrfc/_cyrfc.pyx":1113 + * + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * rc = RfcGetUnitID(self._handle, uid, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_1 = PyList_New(1 * (__pyx_v_rowCount)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_rowCount; __pyx_temp++) { - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyList_SET_ITEM(__pyx_t_1, __pyx_temp, Py_None); - } - } - __pyx_v_table = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":484 - * RfcGetRowCount(container, &rowCount, &errorInfo) - * table = [None] * rowCount - * while rowCount > 0: # <<<<<<<<<<<<<< - * rowCount -= 1 - * RfcMoveTo(container, rowCount, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1112 + * cdef RFC_UNITID uid + * + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcGetUnitID(self._handle, uid, &errorInfo) */ - while (1) { - __pyx_t_2 = ((__pyx_v_rowCount > 0) != 0); - if (!__pyx_t_2) break; + } - /* "src/pyrfc/data_container.pyx":485 - * table = [None] * rowCount - * while rowCount > 0: - * rowCount -= 1 # <<<<<<<<<<<<<< - * RfcMoveTo(container, rowCount, &errorInfo) - * table[rowCount] = wrapStructure(typeDesc, container, config) + /* "pyrfc/_cyrfc.pyx":1114 + * if not self.alive: + * self._open() + * rc = RfcGetUnitID(self._handle, uid, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_v_rowCount = (__pyx_v_rowCount - 1); + __pyx_v_rc = RfcGetUnitID(__pyx_v_self->_handle, __pyx_v_uid, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":486 - * while rowCount > 0: - * rowCount -= 1 - * RfcMoveTo(container, rowCount, &errorInfo) # <<<<<<<<<<<<<< - * table[rowCount] = wrapStructure(typeDesc, container, config) - * RfcDeleteCurrentRow(container, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1115 + * self._open() + * rc = RfcGetUnitID(self._handle, uid, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return wrapString(uid, RFC_UNITID_LN) */ - (void)(RfcMoveTo(__pyx_v_container, __pyx_v_rowCount, (&__pyx_v_errorInfo))); + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":487 - * rowCount -= 1 - * RfcMoveTo(container, rowCount, &errorInfo) - * table[rowCount] = wrapStructure(typeDesc, container, config) # <<<<<<<<<<<<<< - * RfcDeleteCurrentRow(container, &errorInfo) - * return table + /* "pyrfc/_cyrfc.pyx":1116 + * rc = RfcGetUnitID(self._handle, uid, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * return wrapString(uid, RFC_UNITID_LN) + * */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapStructure(__pyx_v_typeDesc, __pyx_v_container, __pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 487, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_SetItemInt(__pyx_v_table, __pyx_v_rowCount, __pyx_t_1, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 1) < 0)) __PYX_ERR(4, 487, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":488 - * RfcMoveTo(container, rowCount, &errorInfo) - * table[rowCount] = wrapStructure(typeDesc, container, config) - * RfcDeleteCurrentRow(container, &errorInfo) # <<<<<<<<<<<<<< - * return table - * + /* "pyrfc/_cyrfc.pyx":1115 + * self._open() + * rc = RfcGetUnitID(self._handle, uid, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * return wrapString(uid, RFC_UNITID_LN) */ - (void)(RfcDeleteCurrentRow(__pyx_v_container, (&__pyx_v_errorInfo))); } - /* "src/pyrfc/data_container.pyx":489 - * table[rowCount] = wrapStructure(typeDesc, container, config) - * RfcDeleteCurrentRow(container, &errorInfo) - * return table # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1117 + * if rc != RFC_OK: + * self._error(&errorInfo) + * return wrapString(uid, RFC_UNITID_LN) # <<<<<<<<<<<<<< * - * cdef wrapVariable( + * def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_table); - __pyx_r = __pyx_v_table; + __pyx_t_1 = __Pyx_PyInt_From_int(RFC_UNITID_LN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.uclen = __pyx_t_1; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uid, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":474 - * # return wrapStructure(self.typeDesc, self.container) + /* "pyrfc/_cyrfc.pyx":1106 + * # BACKGROUND RFC * - * cdef wrapTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, config): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef unsigned rowCount + * def _get_unit_id(self): # <<<<<<<<<<<<<< + * """Returns a unique 32 char bgRFC unit ID (GUID).""" + * cdef RFC_RC rc */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapTable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._get_unit_id", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_table); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":491 - * return table +/* "pyrfc/_cyrfc.pyx":1119 + * return wrapString(uid, RFC_UNITID_LN) * - * cdef wrapVariable( # <<<<<<<<<<<<<< - * RFCTYPE typ, - * RFC_FUNCTION_HANDLE container, + * def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< + * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) + * cdef RFC_RC rc */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapVariable(RFCTYPE __pyx_v_typ, RFC_FUNCTION_HANDLE __pyx_v_container, SAP_UC *__pyx_v_cName, unsigned int __pyx_v_cLen, RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, PyObject *__pyx_v_config) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_STRUCTURE_HANDLE __pyx_v_structure; - RFC_TABLE_HANDLE __pyx_v_table; - RFC_CHAR *__pyx_v_charValue; - SAP_UC *__pyx_v_stringValue; - RFC_NUM *__pyx_v_numValue; - SAP_RAW *__pyx_v_byteValue; - RFC_FLOAT __pyx_v_floatValue; - RFC_INT __pyx_v_intValue; - RFC_INT1 __pyx_v_int1Value; - RFC_INT2 __pyx_v_int2Value; - RFC_INT8 __pyx_v_int8Value; - RFC_DATE __pyx_v_dateValue; - RFC_TIME __pyx_v_timeValue; - unsigned int __pyx_v_resultLen; - unsigned int __pyx_v_strLen; - PyObject *__pyx_v_utcValue = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - char const *__pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - char const *__pyx_t_15; - char const *__pyx_t_16; - char const *__pyx_t_17; - char const *__pyx_t_18; - PyObject *__pyx_t_19 = NULL; - char const *__pyx_t_20; - char const *__pyx_t_21; - char const *__pyx_t_22; - int __pyx_t_23; - int __pyx_t_24; - PyObject *__pyx_t_25 = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_51_create_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_51_create_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_unit_id = 0; + PyObject *__pyx_v_calls = 0; + PyObject *__pyx_v_queue_names = 0; + PyObject *__pyx_v_attributes = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapVariable", 0); - - /* "src/pyrfc/data_container.pyx":515 - * cdef RFC_TIME timeValue - * cdef unsigned resultLen, strLen - * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< - * rc = RfcGetStructure(container, cName, &structure, &errorInfo) - * if rc != RFC_OK: - */ - switch (__pyx_v_typ) { - case RFCTYPE_STRUCTURE: - - /* "src/pyrfc/data_container.pyx":516 - * cdef unsigned resultLen, strLen - * if typ == RFCTYPE_STRUCTURE: - * rc = RfcGetStructure(container, cName, &structure, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetStructure(__pyx_v_container, __pyx_v_cName, (&__pyx_v_structure), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/data_container.pyx":517 - * if typ == RFCTYPE_STRUCTURE: - * rc = RfcGetStructure(container, cName, &structure, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapStructure(typeDesc, structure, config) - */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { - - /* "src/pyrfc/data_container.pyx":518 - * rc = RfcGetStructure(container, cName, &structure, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return wrapStructure(typeDesc, structure, config) - * elif typ == RFCTYPE_TABLE: - */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 518, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 518, __pyx_L1_error) - - /* "src/pyrfc/data_container.pyx":517 - * if typ == RFCTYPE_STRUCTURE: - * rc = RfcGetStructure(container, cName, &structure, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapStructure(typeDesc, structure, config) - */ - } - - /* "src/pyrfc/data_container.pyx":519 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return wrapStructure(typeDesc, structure, config) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_TABLE: - * rc = RfcGetTable(container, cName, &table, &errorInfo) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapStructure(__pyx_v_typeDesc, __pyx_v_structure, __pyx_v_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_create_and_submit_unit (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unit_id,&__pyx_n_s_calls,&__pyx_n_s_queue_names,&__pyx_n_s_attributes,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 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_unit_id)) != 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_calls)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_create_and_submit_unit", 0, 2, 4, 1); __PYX_ERR(0, 1119, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_names); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_and_submit_unit") < 0)) __PYX_ERR(0, 1119, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_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); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_unit_id = values[0]; + __pyx_v_calls = values[1]; + __pyx_v_queue_names = values[2]; + __pyx_v_attributes = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_create_and_submit_unit", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1119, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_50_create_and_submit_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes); - /* "src/pyrfc/data_container.pyx":515 - * cdef RFC_TIME timeValue - * cdef unsigned resultLen, strLen - * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< - * rc = RfcGetStructure(container, cName, &structure, &errorInfo) - * if rc != RFC_OK: - */ - break; - case RFCTYPE_TABLE: + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":521 - * return wrapStructure(typeDesc, structure, config) - * elif typ == RFCTYPE_TABLE: - * rc = RfcGetTable(container, cName, &table, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetTable(__pyx_v_container, __pyx_v_cName, (&__pyx_v_table), (&__pyx_v_errorInfo)); +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_50_create_and_submit_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit_id, PyObject *__pyx_v_calls, PyObject *__pyx_v_queue_names, PyObject *__pyx_v_attributes) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + int __pyx_v_queueNameCount; + SAP_UC **__pyx_v_queueNames; + RFC_UNIT_ATTRIBUTES __pyx_v_unitAttr; + RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; + RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; + RFC_FUNCTION_HANDLE __pyx_v_funcCont; + SAP_UC *__pyx_v_sapuc; + SAP_UC *__pyx_v_uid; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_queue_name = NULL; + PyObject *__pyx_v_func_name = NULL; + PyObject *__pyx_v_params = NULL; + SAP_UC *__pyx_v_funcName; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + CYTHON_UNUSED PyObject *__pyx_v_e = NULL; + PyObject *__pyx_v_unit_identifier = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + SAP_UC *__pyx_t_4; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + short __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *(*__pyx_t_17)(PyObject *); + Py_ssize_t __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + char const *__pyx_t_21; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; + PyObject *__pyx_t_26 = NULL; + PyObject *__pyx_t_27 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_create_and_submit_unit", 0); + __Pyx_INCREF(__pyx_v_queue_names); - /* "src/pyrfc/data_container.pyx":522 - * elif typ == RFCTYPE_TABLE: - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapTable(typeDesc, table, config) + /* "pyrfc/_cyrfc.pyx":1132 + * cdef SAP_UC* sapuc + * + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((!__pyx_t_2) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":523 - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return wrapTable(typeDesc, table, config) - * elif typ == RFCTYPE_CHAR: + /* "pyrfc/_cyrfc.pyx":1133 + * + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * + * # uid */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 523, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 523, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":522 - * elif typ == RFCTYPE_TABLE: - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapTable(typeDesc, table, config) + /* "pyrfc/_cyrfc.pyx":1132 + * cdef SAP_UC* sapuc + * + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * */ - } + } - /* "src/pyrfc/data_container.pyx":524 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return wrapTable(typeDesc, table, config) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_CHAR: - * charValue = mallocU(cLen) + /* "pyrfc/_cyrfc.pyx":1136 + * + * # uid + * uid = fillString(unit_id) # <<<<<<<<<<<<<< + * # queue + * queue_names = queue_names or [] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapTable(__pyx_v_typeDesc, __pyx_v_table, __pyx_v_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 524, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_unit_id); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1136, __pyx_L1_error) + __pyx_v_uid = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":520 - * raise wrapError(&errorInfo) - * return wrapStructure(typeDesc, structure, config) - * elif typ == RFCTYPE_TABLE: # <<<<<<<<<<<<<< - * rc = RfcGetTable(container, cName, &table, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1138 + * uid = fillString(unit_id) + * # queue + * queue_names = queue_names or [] # <<<<<<<<<<<<<< + * if len(queue_names) == 0: + * queueNameCount = 0 */ - break; - case RFCTYPE_CHAR: + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_queue_names); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1138, __pyx_L1_error) + if (!__pyx_t_3) { + } else { + __Pyx_INCREF(__pyx_v_queue_names); + __pyx_t_1 = __pyx_v_queue_names; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_5); + __pyx_t_1 = __pyx_t_5; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_L4_bool_binop_done:; + __Pyx_DECREF_SET(__pyx_v_queue_names, __pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":526 - * return wrapTable(typeDesc, table, config) - * elif typ == RFCTYPE_CHAR: - * charValue = mallocU(cLen) # <<<<<<<<<<<<<< - * try: - * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1139 + * # queue + * queue_names = queue_names or [] + * if len(queue_names) == 0: # <<<<<<<<<<<<<< + * queueNameCount = 0 + * queueNames = NULL */ - __pyx_v_charValue = mallocU(__pyx_v_cLen); + __pyx_t_6 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1139, __pyx_L1_error) + __pyx_t_3 = ((__pyx_t_6 == 0) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":527 - * elif typ == RFCTYPE_CHAR: - * charValue = mallocU(cLen) - * try: # <<<<<<<<<<<<<< - * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1140 + * queue_names = queue_names or [] + * if len(queue_names) == 0: + * queueNameCount = 0 # <<<<<<<<<<<<<< + * queueNames = NULL + * else: */ - /*try:*/ { + __pyx_v_queueNameCount = 0; - /* "src/pyrfc/data_container.pyx":528 - * charValue = mallocU(cLen) - * try: - * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1141 + * if len(queue_names) == 0: + * queueNameCount = 0 + * queueNames = NULL # <<<<<<<<<<<<<< + * else: + * queueNameCount = int(len(queue_names)) */ - __pyx_v_rc = RfcGetChars(__pyx_v_container, __pyx_v_cName, __pyx_v_charValue, __pyx_v_cLen, (&__pyx_v_errorInfo)); + __pyx_v_queueNames = NULL; - /* "src/pyrfc/data_container.pyx":529 - * try: - * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapString(charValue, cLen, config & _MASK_RSTRIP) + /* "pyrfc/_cyrfc.pyx":1139 + * # queue + * queue_names = queue_names or [] + * if len(queue_names) == 0: # <<<<<<<<<<<<<< + * queueNameCount = 0 + * queueNames = NULL */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + goto __pyx_L6; + } - /* "src/pyrfc/data_container.pyx":530 - * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return wrapString(charValue, cLen, config & _MASK_RSTRIP) - * finally: + /* "pyrfc/_cyrfc.pyx":1143 + * queueNames = NULL + * else: + * queueNameCount = int(len(queue_names)) # <<<<<<<<<<<<<< + * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) + * for i, queue_name in enumerate(queue_names): */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 530, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 530, __pyx_L6_error) + /*else*/ { + __pyx_t_6 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1143, __pyx_L1_error) + __pyx_v_queueNameCount = ((int)__pyx_t_6); - /* "src/pyrfc/data_container.pyx":529 - * try: - * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapString(charValue, cLen, config & _MASK_RSTRIP) + /* "pyrfc/_cyrfc.pyx":1144 + * else: + * queueNameCount = int(len(queue_names)) + * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) # <<<<<<<<<<<<<< + * for i, queue_name in enumerate(queue_names): + * queueNames[i] = fillString(queue_name) */ - } + __pyx_v_queueNames = ((SAP_UC **)mallocU((__pyx_v_queueNameCount * (sizeof(SAP_UC *))))); - /* "src/pyrfc/data_container.pyx":531 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return wrapString(charValue, cLen, config & _MASK_RSTRIP) # <<<<<<<<<<<<<< - * finally: - * free(charValue) + /* "pyrfc/_cyrfc.pyx":1145 + * queueNameCount = int(len(queue_names)) + * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) + * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< + * queueNames[i] = fillString(queue_name) + * # attributes */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_cLen); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 531, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 531, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_And(__pyx_v_config, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 531, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5.__pyx_n = 2; - __pyx_t_5.uclen = __pyx_t_2; - __pyx_t_5.rstrip = __pyx_t_4; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_charValue, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 531, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L5_return; + __Pyx_INCREF(__pyx_int_0); + __pyx_t_1 = __pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_queue_names)) || PyTuple_CheckExact(__pyx_v_queue_names)) { + __pyx_t_5 = __pyx_v_queue_names; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_queue_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1145, __pyx_L1_error) } - - /* "src/pyrfc/data_container.pyx":533 - * return wrapString(charValue, cLen, config & _MASK_RSTRIP) - * finally: - * free(charValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_STRING: - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - */ - /*finally:*/ { - __pyx_L6_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename; - { - free(__pyx_v_charValue); + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1145, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1145, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_5); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1145, __pyx_L1_error) + } + break; } - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8; - goto __pyx_L1_error; - } - __pyx_L5_return: { - __pyx_t_14 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_charValue); - __pyx_r = __pyx_t_14; - __pyx_t_14 = 0; - goto __pyx_L0; + __Pyx_GOTREF(__pyx_t_8); } - } + __Pyx_XDECREF_SET(__pyx_v_queue_name, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_8; + __pyx_t_8 = 0; - /* "src/pyrfc/data_container.pyx":525 - * raise wrapError(&errorInfo) - * return wrapTable(typeDesc, table, config) - * elif typ == RFCTYPE_CHAR: # <<<<<<<<<<<<<< - * charValue = mallocU(cLen) - * try: + /* "pyrfc/_cyrfc.pyx":1146 + * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) + * for i, queue_name in enumerate(queue_names): + * queueNames[i] = fillString(queue_name) # <<<<<<<<<<<<<< + * # attributes + * # set default values */ - break; - case RFCTYPE_STRING: + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_queue_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1146, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1146, __pyx_L1_error) + (__pyx_v_queueNames[__pyx_t_9]) = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":535 - * free(charValue) - * elif typ == RFCTYPE_STRING: - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) # <<<<<<<<<<<<<< - * try: - * stringValue = mallocU(strLen+1) + /* "pyrfc/_cyrfc.pyx":1145 + * queueNameCount = int(len(queue_names)) + * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) + * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< + * queueNames[i] = fillString(queue_name) + * # attributes */ - __pyx_v_rc = RfcGetStringLength(__pyx_v_container, __pyx_v_cName, (&__pyx_v_strLen), (&__pyx_v_errorInfo)); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L6:; - /* "src/pyrfc/data_container.pyx":536 - * elif typ == RFCTYPE_STRING: - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * try: # <<<<<<<<<<<<<< - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1149 + * # attributes + * # set default values + * memsetR(&unitAttr, 0, sizeof(RFC_UNIT_ATTRIBUTES)) # <<<<<<<<<<<<<< + * memsetR(&uIdentifier, 0, sizeof(RFC_UNIT_IDENTIFIER)) + * # unitAttr.kernelTrace = 0 (short) If != 0, the backend will write kernel traces, while executing this unit. */ - /*try:*/ { + memsetR((&__pyx_v_unitAttr), 0, (sizeof(RFC_UNIT_ATTRIBUTES))); - /* "src/pyrfc/data_container.pyx":537 - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * try: - * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1150 + * # set default values + * memsetR(&unitAttr, 0, sizeof(RFC_UNIT_ATTRIBUTES)) + * memsetR(&uIdentifier, 0, sizeof(RFC_UNIT_IDENTIFIER)) # <<<<<<<<<<<<<< + * # unitAttr.kernelTrace = 0 (short) If != 0, the backend will write kernel traces, while executing this unit. + * # unitAttr.satTrace = 0 (short) If != 0, the backend will keep a "history" for this unit. */ - __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); + memsetR((&__pyx_v_uIdentifier), 0, (sizeof(RFC_UNIT_IDENTIFIER))); - /* "src/pyrfc/data_container.pyx":538 - * try: - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1177 + * # Sending time in UTC (GMT-0). Used only when the external program is server. + * # In the client case the nwrfclib fills this automatically. + * if attributes is not None: # <<<<<<<<<<<<<< + * if 'kernel_trace' in attributes: + * unitAttr.kernelTrace = attributes['kernel_trace'] */ - __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + __pyx_t_3 = (__pyx_v_attributes != Py_None); + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":539 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapString(stringValue, resultLen) + /* "pyrfc/_cyrfc.pyx":1178 + * # In the client case the nwrfclib fills this automatically. + * if attributes is not None: + * if 'kernel_trace' in attributes: # <<<<<<<<<<<<<< + * unitAttr.kernelTrace = attributes['kernel_trace'] + * if 'sat_trace' in attributes: */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_kernel_trace, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1178, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":540 - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return wrapString(stringValue, resultLen) - * finally: - */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 540, __pyx_L12_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 540, __pyx_L12_error) - - /* "src/pyrfc/data_container.pyx":539 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapString(stringValue, resultLen) - */ - } - - /* "src/pyrfc/data_container.pyx":541 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return wrapString(stringValue, resultLen) # <<<<<<<<<<<<<< - * finally: - * free(stringValue) + /* "pyrfc/_cyrfc.pyx":1179 + * if attributes is not None: + * if 'kernel_trace' in attributes: + * unitAttr.kernelTrace = attributes['kernel_trace'] # <<<<<<<<<<<<<< + * if 'sat_trace' in attributes: + * unitAttr.satTrace = attributes['sat_trace'] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_resultLen); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 541, __pyx_L12_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5.__pyx_n = 1; - __pyx_t_5.uclen = __pyx_t_3; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 541, __pyx_L12_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L11_return; - } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_kernel_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1179, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_unitAttr.kernelTrace = __pyx_t_10; - /* "src/pyrfc/data_container.pyx":543 - * return wrapString(stringValue, resultLen) - * finally: - * free(stringValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_NUM: - * numValue = mallocU(cLen) + /* "pyrfc/_cyrfc.pyx":1178 + * # In the client case the nwrfclib fills this automatically. + * if attributes is not None: + * if 'kernel_trace' in attributes: # <<<<<<<<<<<<<< + * unitAttr.kernelTrace = attributes['kernel_trace'] + * if 'sat_trace' in attributes: */ - /*finally:*/ { - __pyx_L12_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_15 = __pyx_filename; - { - free(__pyx_v_stringValue); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); - } - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_15; - goto __pyx_L1_error; - } - __pyx_L11_return: { - __pyx_t_9 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_stringValue); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - } } - /* "src/pyrfc/data_container.pyx":534 - * finally: - * free(charValue) - * elif typ == RFCTYPE_STRING: # <<<<<<<<<<<<<< - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * try: + /* "pyrfc/_cyrfc.pyx":1180 + * if 'kernel_trace' in attributes: + * unitAttr.kernelTrace = attributes['kernel_trace'] + * if 'sat_trace' in attributes: # <<<<<<<<<<<<<< + * unitAttr.satTrace = attributes['sat_trace'] + * if 'unit_history' in attributes: */ - break; - case RFCTYPE_NUM: + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_sat_trace, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1180, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":545 - * free(stringValue) - * elif typ == RFCTYPE_NUM: - * numValue = mallocU(cLen) # <<<<<<<<<<<<<< - * try: - * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1181 + * unitAttr.kernelTrace = attributes['kernel_trace'] + * if 'sat_trace' in attributes: + * unitAttr.satTrace = attributes['sat_trace'] # <<<<<<<<<<<<<< + * if 'unit_history' in attributes: + * unitAttr.unitHistory = attributes['unit_history'] */ - __pyx_v_numValue = mallocU(__pyx_v_cLen); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_sat_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_unitAttr.satTrace = __pyx_t_10; - /* "src/pyrfc/data_container.pyx":546 - * elif typ == RFCTYPE_NUM: - * numValue = mallocU(cLen) - * try: # <<<<<<<<<<<<<< - * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1180 + * if 'kernel_trace' in attributes: + * unitAttr.kernelTrace = attributes['kernel_trace'] + * if 'sat_trace' in attributes: # <<<<<<<<<<<<<< + * unitAttr.satTrace = attributes['sat_trace'] + * if 'unit_history' in attributes: */ - /*try:*/ { + } - /* "src/pyrfc/data_container.pyx":547 - * numValue = mallocU(cLen) - * try: - * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1182 + * if 'sat_trace' in attributes: + * unitAttr.satTrace = attributes['sat_trace'] + * if 'unit_history' in attributes: # <<<<<<<<<<<<<< + * unitAttr.unitHistory = attributes['unit_history'] + * if 'lock' in attributes: */ - __pyx_v_rc = RfcGetNum(__pyx_v_container, __pyx_v_cName, __pyx_v_numValue, __pyx_v_cLen, (&__pyx_v_errorInfo)); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_unit_history, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":548 - * try: - * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapString(numValue, cLen) + /* "pyrfc/_cyrfc.pyx":1183 + * unitAttr.satTrace = attributes['sat_trace'] + * if 'unit_history' in attributes: + * unitAttr.unitHistory = attributes['unit_history'] # <<<<<<<<<<<<<< + * if 'lock' in attributes: + * unitAttr.lock = attributes['lock'] */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_unit_history); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1183, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_unitAttr.unitHistory = __pyx_t_10; - /* "src/pyrfc/data_container.pyx":549 - * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return wrapString(numValue, cLen) - * finally: + /* "pyrfc/_cyrfc.pyx":1182 + * if 'sat_trace' in attributes: + * unitAttr.satTrace = attributes['sat_trace'] + * if 'unit_history' in attributes: # <<<<<<<<<<<<<< + * unitAttr.unitHistory = attributes['unit_history'] + * if 'lock' in attributes: */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 549, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(4, 549, __pyx_L18_error) + } - /* "src/pyrfc/data_container.pyx":548 - * try: - * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return wrapString(numValue, cLen) + /* "pyrfc/_cyrfc.pyx":1184 + * if 'unit_history' in attributes: + * unitAttr.unitHistory = attributes['unit_history'] + * if 'lock' in attributes: # <<<<<<<<<<<<<< + * unitAttr.lock = attributes['lock'] + * if 'no_commit_check' in attributes: */ - } + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_lock, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1184, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":550 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return wrapString(numValue, cLen) # <<<<<<<<<<<<<< - * finally: - * free(numValue) + /* "pyrfc/_cyrfc.pyx":1185 + * unitAttr.unitHistory = attributes['unit_history'] + * if 'lock' in attributes: + * unitAttr.lock = attributes['lock'] # <<<<<<<<<<<<<< + * if 'no_commit_check' in attributes: + * unitAttr.noCommitCheck = attributes['no_commit_check'] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_cLen); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 550, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5.__pyx_n = 1; - __pyx_t_5.uclen = __pyx_t_4; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_numValue, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 550, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L17_return; - } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1185, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_unitAttr.lock = __pyx_t_10; - /* "src/pyrfc/data_container.pyx":552 - * return wrapString(numValue, cLen) - * finally: - * free(numValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_BYTE: - * byteValue = malloc(cLen) + /* "pyrfc/_cyrfc.pyx":1184 + * if 'unit_history' in attributes: + * unitAttr.unitHistory = attributes['unit_history'] + * if 'lock' in attributes: # <<<<<<<<<<<<<< + * unitAttr.lock = attributes['lock'] + * if 'no_commit_check' in attributes: */ - /*finally:*/ { - __pyx_L18_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_16 = __pyx_filename; - { - free(__pyx_v_numValue); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - } - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_16; - goto __pyx_L1_error; - } - __pyx_L17_return: { - __pyx_t_14 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_numValue); - __pyx_r = __pyx_t_14; - __pyx_t_14 = 0; - goto __pyx_L0; - } } - /* "src/pyrfc/data_container.pyx":544 - * finally: - * free(stringValue) - * elif typ == RFCTYPE_NUM: # <<<<<<<<<<<<<< - * numValue = mallocU(cLen) - * try: + /* "pyrfc/_cyrfc.pyx":1186 + * if 'lock' in attributes: + * unitAttr.lock = attributes['lock'] + * if 'no_commit_check' in attributes: # <<<<<<<<<<<<<< + * unitAttr.noCommitCheck = attributes['no_commit_check'] + * if 'user' in attributes and attributes['user'] is not None: */ - break; - case RFCTYPE_BYTE: + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_no_commit_check, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1186, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":554 - * free(numValue) - * elif typ == RFCTYPE_BYTE: - * byteValue = malloc(cLen) # <<<<<<<<<<<<<< - * try: - * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1187 + * unitAttr.lock = attributes['lock'] + * if 'no_commit_check' in attributes: + * unitAttr.noCommitCheck = attributes['no_commit_check'] # <<<<<<<<<<<<<< + * if 'user' in attributes and attributes['user'] is not None: + * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. */ - __pyx_v_byteValue = ((SAP_RAW *)malloc(__pyx_v_cLen)); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_no_commit_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1187, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_unitAttr.noCommitCheck = __pyx_t_10; - /* "src/pyrfc/data_container.pyx":555 - * elif typ == RFCTYPE_BYTE: - * byteValue = malloc(cLen) - * try: # <<<<<<<<<<<<<< - * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1186 + * if 'lock' in attributes: + * unitAttr.lock = attributes['lock'] + * if 'no_commit_check' in attributes: # <<<<<<<<<<<<<< + * unitAttr.noCommitCheck = attributes['no_commit_check'] + * if 'user' in attributes and attributes['user'] is not None: */ - /*try:*/ { + } - /* "src/pyrfc/data_container.pyx":556 - * byteValue = malloc(cLen) - * try: - * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1188 + * if 'no_commit_check' in attributes: + * unitAttr.noCommitCheck = attributes['no_commit_check'] + * if 'user' in attributes and attributes['user'] is not None: # <<<<<<<<<<<<<< + * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. + * sapuc = fillString(attributes['user'][0:12]) */ - __pyx_v_rc = RfcGetBytes(__pyx_v_container, __pyx_v_cName, __pyx_v_byteValue, __pyx_v_cLen, (&__pyx_v_errorInfo)); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_user, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1188, __pyx_L1_error) + __pyx_t_11 = (__pyx_t_2 != 0); + if (__pyx_t_11) { + } else { + __pyx_t_3 = __pyx_t_11; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_user); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1188, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = (__pyx_t_1 != Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_t_11 != 0); + __pyx_t_3 = __pyx_t_2; + __pyx_L16_bool_binop_done:; + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":557 - * try: - * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return byteValue[:cLen] + /* "pyrfc/_cyrfc.pyx":1190 + * if 'user' in attributes and attributes['user'] is not None: + * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. + * sapuc = fillString(attributes['user'][0:12]) # <<<<<<<<<<<<<< + * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) + * free(sapuc) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_user); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 12, NULL, NULL, &__pyx_slice__12, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1190, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_sapuc = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":558 - * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return byteValue[:cLen] - * finally: + /* "pyrfc/_cyrfc.pyx":1191 + * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. + * sapuc = fillString(attributes['user'][0:12]) + * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if 'client' in attributes: */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 558, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 558, __pyx_L24_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_user); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 12, NULL, NULL, &__pyx_slice__12, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_unitAttr.user, __pyx_v_sapuc, (__pyx_t_6 + 1)); - /* "src/pyrfc/data_container.pyx":557 - * try: - * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return byteValue[:cLen] + /* "pyrfc/_cyrfc.pyx":1192 + * sapuc = fillString(attributes['user'][0:12]) + * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if 'client' in attributes: + * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". */ - } + free(__pyx_v_sapuc); - /* "src/pyrfc/data_container.pyx":559 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return byteValue[:cLen] # <<<<<<<<<<<<<< - * finally: - * free(byteValue) + /* "pyrfc/_cyrfc.pyx":1188 + * if 'no_commit_check' in attributes: + * unitAttr.noCommitCheck = attributes['no_commit_check'] + * if 'user' in attributes and attributes['user'] is not None: # <<<<<<<<<<<<<< + * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. + * sapuc = fillString(attributes['user'][0:12]) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_byteValue) + 0, __pyx_v_cLen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 559, __pyx_L24_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L23_return; } - /* "src/pyrfc/data_container.pyx":561 - * return byteValue[:cLen] - * finally: - * free(byteValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_XSTRING: - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1193 + * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) + * free(sapuc) + * if 'client' in attributes: # <<<<<<<<<<<<<< + * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". + * sapuc = fillString(attributes['client'][0:3]) */ - /*finally:*/ { - __pyx_L24_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_17 = __pyx_filename; - { - free(__pyx_v_byteValue); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); - } - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_17; - goto __pyx_L1_error; - } - __pyx_L23_return: { - __pyx_t_9 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_byteValue); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - } - } + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_client, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1193, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":553 - * finally: - * free(numValue) - * elif typ == RFCTYPE_BYTE: # <<<<<<<<<<<<<< - * byteValue = malloc(cLen) - * try: + /* "pyrfc/_cyrfc.pyx":1195 + * if 'client' in attributes: + * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". + * sapuc = fillString(attributes['client'][0:3]) # <<<<<<<<<<<<<< + * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) + * free(sapuc) */ - break; - case RFCTYPE_XSTRING: + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_client); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 3, NULL, NULL, &__pyx_slice__13, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1195, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_sapuc = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":563 - * free(byteValue) - * elif typ == RFCTYPE_XSTRING: - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) # <<<<<<<<<<<<<< - * try: - * byteValue = malloc(strLen+1) + /* "pyrfc/_cyrfc.pyx":1196 + * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". + * sapuc = fillString(attributes['client'][0:3]) + * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if 't_code' in attributes: */ - __pyx_v_rc = RfcGetStringLength(__pyx_v_container, __pyx_v_cName, (&__pyx_v_strLen), (&__pyx_v_errorInfo)); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_client); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 3, NULL, NULL, &__pyx_slice__13, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1196, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_unitAttr.client, __pyx_v_sapuc, (__pyx_t_6 + 1)); - /* "src/pyrfc/data_container.pyx":564 - * elif typ == RFCTYPE_XSTRING: - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * try: # <<<<<<<<<<<<<< - * byteValue = malloc(strLen+1) - * byteValue[strLen] = 0 + /* "pyrfc/_cyrfc.pyx":1197 + * sapuc = fillString(attributes['client'][0:3]) + * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if 't_code' in attributes: + * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". */ - /*try:*/ { + free(__pyx_v_sapuc); - /* "src/pyrfc/data_container.pyx":565 - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * try: - * byteValue = malloc(strLen+1) # <<<<<<<<<<<<<< - * byteValue[strLen] = 0 - * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1193 + * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) + * free(sapuc) + * if 'client' in attributes: # <<<<<<<<<<<<<< + * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". + * sapuc = fillString(attributes['client'][0:3]) */ - __pyx_v_byteValue = ((SAP_RAW *)malloc((__pyx_v_strLen + 1))); + } - /* "src/pyrfc/data_container.pyx":566 - * try: - * byteValue = malloc(strLen+1) - * byteValue[strLen] = 0 # <<<<<<<<<<<<<< - * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1198 + * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) + * free(sapuc) + * if 't_code' in attributes: # <<<<<<<<<<<<<< + * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + * sapuc = fillString(attributes['t_code'][0:20]) */ - (__pyx_v_byteValue[__pyx_v_strLen]) = 0; - - /* "src/pyrfc/data_container.pyx":567 - * byteValue = malloc(strLen+1) - * byteValue[strLen] = 0 - * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetXString(__pyx_v_container, __pyx_v_cName, __pyx_v_byteValue, __pyx_v_strLen, (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_t_code, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1198, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":568 - * byteValue[strLen] = 0 - * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return byteValue[:resultLen] + /* "pyrfc/_cyrfc.pyx":1200 + * if 't_code' in attributes: + * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + * sapuc = fillString(attributes['t_code'][0:20]) # <<<<<<<<<<<<<< + * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) + * free(sapuc) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_t_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 20, NULL, NULL, &__pyx_slice__14, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1200, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_sapuc = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":569 - * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return byteValue[:resultLen] - * finally: + /* "pyrfc/_cyrfc.pyx":1201 + * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + * sapuc = fillString(attributes['t_code'][0:20]) + * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if 'program' in attributes and attributes['program'] is not None: */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 569, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 569, __pyx_L30_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_t_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 20, NULL, NULL, &__pyx_slice__14, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1201, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_unitAttr.tCode, __pyx_v_sapuc, (__pyx_t_6 + 1)); - /* "src/pyrfc/data_container.pyx":568 - * byteValue[strLen] = 0 - * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return byteValue[:resultLen] + /* "pyrfc/_cyrfc.pyx":1202 + * sapuc = fillString(attributes['t_code'][0:20]) + * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if 'program' in attributes and attributes['program'] is not None: + * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. */ - } + free(__pyx_v_sapuc); - /* "src/pyrfc/data_container.pyx":570 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return byteValue[:resultLen] # <<<<<<<<<<<<<< - * finally: - * free(byteValue) + /* "pyrfc/_cyrfc.pyx":1198 + * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) + * free(sapuc) + * if 't_code' in attributes: # <<<<<<<<<<<<<< + * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + * sapuc = fillString(attributes['t_code'][0:20]) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_byteValue) + 0, __pyx_v_resultLen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 570, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L29_return; } - /* "src/pyrfc/data_container.pyx":572 - * return byteValue[:resultLen] - * finally: - * free(byteValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_BCD: - * # An upper bound for the length of the _string representation_ + /* "pyrfc/_cyrfc.pyx":1203 + * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) + * free(sapuc) + * if 'program' in attributes and attributes['program'] is not None: # <<<<<<<<<<<<<< + * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. + * sapuc = fillString(attributes['program'][0:40]) */ - /*finally:*/ { - __pyx_L30_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_18 = __pyx_filename; - { - free(__pyx_v_byteValue); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - } - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_18; - goto __pyx_L1_error; - } - __pyx_L29_return: { - __pyx_t_14 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_byteValue); - __pyx_r = __pyx_t_14; - __pyx_t_14 = 0; - goto __pyx_L0; - } + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_program, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1203, __pyx_L1_error) + __pyx_t_11 = (__pyx_t_2 != 0); + if (__pyx_t_11) { + } else { + __pyx_t_3 = __pyx_t_11; + goto __pyx_L21_bool_binop_done; } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_program); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = (__pyx_t_1 != Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_t_11 != 0); + __pyx_t_3 = __pyx_t_2; + __pyx_L21_bool_binop_done:; + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":562 - * finally: - * free(byteValue) - * elif typ == RFCTYPE_XSTRING: # <<<<<<<<<<<<<< - * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * try: - */ - break; - case RFCTYPE_BCD: - - /* "src/pyrfc/data_container.pyx":579 - * # Furthermore, a sign char, a decimal separator char may be present - * # => (2*cLen)+1 - * strLen = 2*cLen + 1 # <<<<<<<<<<<<<< - * try: - * stringValue = mallocU(strLen+1) - */ - __pyx_v_strLen = ((2 * __pyx_v_cLen) + 1); - - /* "src/pyrfc/data_container.pyx":580 - * # => (2*cLen)+1 - * strLen = 2*cLen + 1 - * try: # <<<<<<<<<<<<<< - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1205 + * if 'program' in attributes and attributes['program'] is not None: + * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. + * sapuc = fillString(attributes['program'][0:40]) # <<<<<<<<<<<<<< + * strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) + * free(sapuc) */ - /*try:*/ { + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_program); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 40, NULL, NULL, &__pyx_slice__15, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_sapuc = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":581 - * strLen = 2*cLen + 1 - * try: - * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc == 23: # Buffer too small, use returned requried result length + /* "pyrfc/_cyrfc.pyx":1206 + * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. + * sapuc = fillString(attributes['program'][0:40]) + * strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * */ - __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_program); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 40, NULL, NULL, &__pyx_slice__15, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1206, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_unitAttr.program, __pyx_v_sapuc, (__pyx_t_6 + 1)); - /* "src/pyrfc/data_container.pyx":582 - * try: - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc == 23: # Buffer too small, use returned requried result length - * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " + /* "pyrfc/_cyrfc.pyx":1207 + * sapuc = fillString(attributes['program'][0:40]) + * strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * + * self._uHandle = RfcCreateUnit(self._handle, uid, queueNames, queueNameCount, &unitAttr, &uIdentifier, &errorInfo) */ - __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + free(__pyx_v_sapuc); - /* "src/pyrfc/data_container.pyx":583 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< - * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " - * # "trying with {}".format(cLen, strLen, resultLen)) + /* "pyrfc/_cyrfc.pyx":1203 + * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) + * free(sapuc) + * if 'program' in attributes and attributes['program'] is not None: # <<<<<<<<<<<<<< + * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. + * sapuc = fillString(attributes['program'][0:40]) */ - __pyx_t_1 = ((__pyx_v_rc == 23) != 0); - if (__pyx_t_1) { + } - /* "src/pyrfc/data_container.pyx":586 - * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " - * # "trying with {}".format(cLen, strLen, resultLen)) - * free(stringValue) # <<<<<<<<<<<<<< - * strLen = resultLen - * stringValue = mallocU(strLen+1) + /* "pyrfc/_cyrfc.pyx":1177 + * # Sending time in UTC (GMT-0). Used only when the external program is server. + * # In the client case the nwrfclib fills this automatically. + * if attributes is not None: # <<<<<<<<<<<<<< + * if 'kernel_trace' in attributes: + * unitAttr.kernelTrace = attributes['kernel_trace'] */ - free(__pyx_v_stringValue); + } - /* "src/pyrfc/data_container.pyx":587 - * # "trying with {}".format(cLen, strLen, resultLen)) - * free(stringValue) - * strLen = resultLen # <<<<<<<<<<<<<< - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1209 + * free(sapuc) + * + * self._uHandle = RfcCreateUnit(self._handle, uid, queueNames, queueNameCount, &unitAttr, &uIdentifier, &errorInfo) # <<<<<<<<<<<<<< + * + * # queue (deallocate) */ - __pyx_v_strLen = __pyx_v_resultLen; + __pyx_v_self->_uHandle = RfcCreateUnit(__pyx_v_self->_handle, __pyx_v_uid, ((const SAP_UC* *)__pyx_v_queueNames), __pyx_v_queueNameCount, (&__pyx_v_unitAttr), (&__pyx_v_uIdentifier), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":588 - * free(stringValue) - * strLen = resultLen - * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1212 + * + * # queue (deallocate) + * if len(queue_names) > 0: # <<<<<<<<<<<<<< + * for i, queue_name in enumerate(queue_names): + * free(queueNames[i]) */ - __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); + __pyx_t_6 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1212, __pyx_L1_error) + __pyx_t_3 = ((__pyx_t_6 > 0) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":589 - * strLen = resultLen - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1213 + * # queue (deallocate) + * if len(queue_names) > 0: + * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< + * free(queueNames[i]) + * free(queueNames) */ - __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + __Pyx_INCREF(__pyx_int_0); + __pyx_t_1 = __pyx_int_0; + if (likely(PyList_CheckExact(__pyx_v_queue_names)) || PyTuple_CheckExact(__pyx_v_queue_names)) { + __pyx_t_5 = __pyx_v_queue_names; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_queue_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1213, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1213, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1213, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_5); + if (unlikely(!__pyx_t_8)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1213, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + __Pyx_XDECREF_SET(__pyx_v_queue_name, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_8; + __pyx_t_8 = 0; - /* "src/pyrfc/data_container.pyx":583 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< - * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " - * # "trying with {}".format(cLen, strLen, resultLen)) + /* "pyrfc/_cyrfc.pyx":1214 + * if len(queue_names) > 0: + * for i, queue_name in enumerate(queue_names): + * free(queueNames[i]) # <<<<<<<<<<<<<< + * free(queueNames) + * # uid (deallocate) */ - } + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1214, __pyx_L1_error) + free((__pyx_v_queueNames[__pyx_t_9])); - /* "src/pyrfc/data_container.pyx":590 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + /* "pyrfc/_cyrfc.pyx":1213 + * # queue (deallocate) + * if len(queue_names) > 0: + * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< + * free(queueNames[i]) + * free(queueNames) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":591 - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) - * finally: + /* "pyrfc/_cyrfc.pyx":1215 + * for i, queue_name in enumerate(queue_names): + * free(queueNames[i]) + * free(queueNames) # <<<<<<<<<<<<<< + * # uid (deallocate) + * free(uid) */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 591, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 591, __pyx_L36_error) + free(__pyx_v_queueNames); - /* "src/pyrfc/data_container.pyx":590 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + /* "pyrfc/_cyrfc.pyx":1212 + * + * # queue (deallocate) + * if len(queue_names) > 0: # <<<<<<<<<<<<<< + * for i, queue_name in enumerate(queue_names): + * free(queueNames[i]) */ - } + } - /* "src/pyrfc/data_container.pyx":592 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) # <<<<<<<<<<<<<< - * finally: - * free(stringValue) + /* "pyrfc/_cyrfc.pyx":1217 + * free(queueNames) + * # uid (deallocate) + * free(uid) # <<<<<<<<<<<<<< + * + * if self._uHandle == NULL: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 592, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 592, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_19 = PyNumber_And(__pyx_v_config, __pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 592, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5.__pyx_n = 2; - __pyx_t_5.uclen = __pyx_int_neg_1; - __pyx_t_5.rstrip = __pyx_t_19; - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 592, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_19, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 592, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L35_return; - } + free(__pyx_v_uid); - /* "src/pyrfc/data_container.pyx":594 - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) - * finally: - * free(stringValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: - * # An upper bound for the length of the _string representation_ + /* "pyrfc/_cyrfc.pyx":1219 + * free(uid) + * + * if self._uHandle == NULL: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * self.active_unit = True */ - /*finally:*/ { - __pyx_L36_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_20 = __pyx_filename; - { - free(__pyx_v_stringValue); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); - } - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_20; - goto __pyx_L1_error; - } - __pyx_L35_return: { - __pyx_t_9 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_stringValue); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; - } - } + __pyx_t_3 = ((__pyx_v_self->_uHandle == NULL) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":573 - * finally: - * free(byteValue) - * elif typ == RFCTYPE_BCD: # <<<<<<<<<<<<<< - * # An upper bound for the length of the _string representation_ - * # of the BCD is given by (2*cLen)-1 (each digit is encoded in 4bit, + /* "pyrfc/_cyrfc.pyx":1220 + * + * if self._uHandle == NULL: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * self.active_unit = True + * */ - break; - case RFCTYPE_DECF16: + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":595 - * finally: - * free(stringValue) - * elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< - * # An upper bound for the length of the _string representation_ - * # of the DECF is given by (2*cLen)-1 (each digit is encoded in 4bit, + /* "pyrfc/_cyrfc.pyx":1219 + * free(uid) + * + * if self._uHandle == NULL: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * self.active_unit = True */ - case RFCTYPE_DECF34: + } - /* "src/pyrfc/data_container.pyx":603 - * # and exponent char, sign and exponent - * # => +9 - * strLen = 2*cLen + 10 # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1221 + * if self._uHandle == NULL: + * self._error(&errorInfo) + * self.active_unit = True # <<<<<<<<<<<<<< + * * try: - * stringValue = mallocU(strLen+1) */ - __pyx_v_strLen = ((2 * __pyx_v_cLen) + 10); + __pyx_v_self->active_unit = 1; - /* "src/pyrfc/data_container.pyx":604 - * # => +9 - * strLen = 2*cLen + 10 + /* "pyrfc/_cyrfc.pyx":1223 + * self.active_unit = True + * * try: # <<<<<<<<<<<<<< - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * for func_name, params in calls: + * funcName = fillString(func_name) */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); /*try:*/ { - /* "src/pyrfc/data_container.pyx":605 - * strLen = 2*cLen + 10 + /* "pyrfc/_cyrfc.pyx":1224 + * * try: - * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc == 23: # Buffer too small, use returned requried result length + * for func_name, params in calls: # <<<<<<<<<<<<<< + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) */ - __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); - - /* "src/pyrfc/data_container.pyx":606 - * try: - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc == 23: # Buffer too small, use returned requried result length - * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " - */ - __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + if (likely(PyList_CheckExact(__pyx_v_calls)) || PyTuple_CheckExact(__pyx_v_calls)) { + __pyx_t_1 = __pyx_v_calls; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_calls); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1224, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1224, __pyx_L27_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1224, __pyx_L27_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1224, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1224, __pyx_L27_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1224, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_7(__pyx_t_1); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1224, __pyx_L27_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { + PyObject* sequence = __pyx_t_5; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1224, __pyx_L27_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + __pyx_t_15 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_15); + #else + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1224, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1224, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_15); + #endif + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_16 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1224, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext; + index = 0; __pyx_t_8 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_8)) goto __pyx_L35_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L35_unpacking_failed; + __Pyx_GOTREF(__pyx_t_15); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 2) < 0) __PYX_ERR(0, 1224, __pyx_L27_error) + __pyx_t_17 = NULL; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + goto __pyx_L36_unpacking_done; + __pyx_L35_unpacking_failed:; + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __pyx_t_17 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1224, __pyx_L27_error) + __pyx_L36_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_15); + __pyx_t_15 = 0; - /* "src/pyrfc/data_container.pyx":607 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< - * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " - * # "trying with {}".format(cLen, strLen, resultLen)) + /* "pyrfc/_cyrfc.pyx":1225 + * try: + * for func_name, params in calls: + * funcName = fillString(func_name) # <<<<<<<<<<<<<< + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) */ - __pyx_t_1 = ((__pyx_v_rc == 23) != 0); - if (__pyx_t_1) { + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1225, __pyx_L27_error) + __pyx_v_funcName = __pyx_t_4; - /* "src/pyrfc/data_container.pyx":610 - * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " - * # "trying with {}".format(cLen, strLen, resultLen)) - * free(stringValue) # <<<<<<<<<<<<<< - * strLen = resultLen - * stringValue = mallocU(strLen+1) + /* "pyrfc/_cyrfc.pyx":1226 + * for func_name, params in calls: + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< + * free(funcName) + * if not funcDesc: */ - free(__pyx_v_stringValue); + __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":611 - * # "trying with {}".format(cLen, strLen, resultLen)) - * free(stringValue) - * strLen = resultLen # <<<<<<<<<<<<<< - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1227 + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) # <<<<<<<<<<<<<< + * if not funcDesc: + * self._error(&errorInfo) */ - __pyx_v_strLen = __pyx_v_resultLen; + free(__pyx_v_funcName); - /* "src/pyrfc/data_container.pyx":612 - * free(stringValue) - * strLen = resultLen - * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1228 + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) */ - __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); + __pyx_t_3 = ((!(__pyx_v_funcDesc != 0)) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":613 - * strLen = resultLen - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1229 + * free(funcName) + * if not funcDesc: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: */ - __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + __pyx_t_5 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1229, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/pyrfc/data_container.pyx":607 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< - * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " - * # "trying with {}".format(cLen, strLen, resultLen)) + /* "pyrfc/_cyrfc.pyx":1228 + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * free(funcName) + * if not funcDesc: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) */ - } + } - /* "src/pyrfc/data_container.pyx":614 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + /* "pyrfc/_cyrfc.pyx":1230 + * if not funcDesc: + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) # <<<<<<<<<<<<<< + * if not funcCont: + * self._error(&errorInfo) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_v_funcCont = RfcCreateFunction(__pyx_v_funcDesc, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":615 - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) - * finally: + /* "pyrfc/_cyrfc.pyx":1231 + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * try: */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 615, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 615, __pyx_L43_error) + __pyx_t_3 = ((!(__pyx_v_funcCont != 0)) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":614 - * stringValue = mallocU(strLen+1) - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + /* "pyrfc/_cyrfc.pyx":1232 + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * try: + * for name, value in params.iteritems(): */ - } + __pyx_t_5 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1232, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/pyrfc/data_container.pyx":616 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) # <<<<<<<<<<<<<< - * finally: - * free(stringValue) + /* "pyrfc/_cyrfc.pyx":1231 + * self._error(&errorInfo) + * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + * if not funcCont: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * try: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 616, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 616, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_19 = PyNumber_And(__pyx_v_config, __pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 616, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5.__pyx_n = 2; - __pyx_t_5.uclen = __pyx_int_neg_1; - __pyx_t_5.rstrip = __pyx_t_19; - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 616, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); } - } - __pyx_t_3 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_19, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 616, __pyx_L43_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L42_return; - } - /* "src/pyrfc/data_container.pyx":618 - * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) - * finally: - * free(stringValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_FLOAT: - * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1233 + * if not funcCont: + * self._error(&errorInfo) + * try: # <<<<<<<<<<<<<< + * for name, value in params.iteritems(): + * fillFunctionParameter(funcDesc, funcCont, name, value) */ - /*finally:*/ { - __pyx_L43_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_21 = __pyx_filename; - { - free(__pyx_v_stringValue); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - } - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); - __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; - __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_21; - goto __pyx_L1_error; - } - __pyx_L42_return: { - __pyx_t_14 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_stringValue); - __pyx_r = __pyx_t_14; - __pyx_t_14 = 0; - goto __pyx_L0; - } - } + /*try:*/ { - /* "src/pyrfc/data_container.pyx":595 - * finally: - * free(stringValue) - * elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< - * # An upper bound for the length of the _string representation_ - * # of the DECF is given by (2*cLen)-1 (each digit is encoded in 4bit, + /* "pyrfc/_cyrfc.pyx":1234 + * self._error(&errorInfo) + * try: + * for name, value in params.iteritems(): # <<<<<<<<<<<<<< + * fillFunctionParameter(funcDesc, funcCont, name, value) + * # Add RFC call to unit */ - break; - case RFCTYPE_FLOAT: + __pyx_t_9 = 0; + if (unlikely(__pyx_v_params == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(0, 1234, __pyx_L42_error) + } + __pyx_t_15 = __Pyx_dict_iterator(__pyx_v_params, 0, __pyx_n_s_iteritems, (&__pyx_t_18), (&__pyx_t_19)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1234, __pyx_L42_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_15; + __pyx_t_15 = 0; + while (1) { + __pyx_t_20 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_18, &__pyx_t_9, &__pyx_t_15, &__pyx_t_8, NULL, __pyx_t_19); + if (unlikely(__pyx_t_20 == 0)) break; + if (unlikely(__pyx_t_20 == -1)) __PYX_ERR(0, 1234, __pyx_L42_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GOTREF(__pyx_t_8); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_15); + __pyx_t_15 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; - /* "src/pyrfc/data_container.pyx":620 - * free(stringValue) - * elif typ == RFCTYPE_FLOAT: - * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1235 + * try: + * for name, value in params.iteritems(): + * fillFunctionParameter(funcDesc, funcCont, name, value) # <<<<<<<<<<<<<< + * # Add RFC call to unit + * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) */ - __pyx_v_rc = RfcGetFloat(__pyx_v_container, __pyx_v_cName, (&__pyx_v_floatValue), (&__pyx_v_errorInfo)); + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcCont, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1235, __pyx_L42_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/pyrfc/data_container.pyx":621 - * elif typ == RFCTYPE_FLOAT: - * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return floatValue + /* "pyrfc/_cyrfc.pyx":1237 + * fillFunctionParameter(funcDesc, funcCont, name, value) + * # Add RFC call to unit + * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_v_rc = RfcInvokeInUnit(__pyx_v_self->_uHandle, __pyx_v_funcCont, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":622 - * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return floatValue - * elif typ == RFCTYPE_INT: + /* "pyrfc/_cyrfc.pyx":1238 + * # Add RFC call to unit + * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * finally: */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 622, __pyx_L1_error) + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":621 - * elif typ == RFCTYPE_FLOAT: - * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return floatValue + /* "pyrfc/_cyrfc.pyx":1239 + * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * finally: + * RfcDestroyFunction(funcCont, NULL) */ - } + __pyx_t_5 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1239, __pyx_L42_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/pyrfc/data_container.pyx":623 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return floatValue # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_INT: - * rc = RfcGetInt(container, cName, &intValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1238 + * # Add RFC call to unit + * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * finally: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_floatValue); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 623, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + } + } - /* "src/pyrfc/data_container.pyx":619 - * finally: - * free(stringValue) - * elif typ == RFCTYPE_FLOAT: # <<<<<<<<<<<<<< - * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1241 + * self._error(&errorInfo) + * finally: + * RfcDestroyFunction(funcCont, NULL) # <<<<<<<<<<<<<< + * # execute + * print (" Invocation finished. submitting unit.") */ - break; - case RFCTYPE_INT: + /*finally:*/ { + /*normal exit:*/{ + (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); + goto __pyx_L43; + } + __pyx_L42_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24); + __Pyx_XGOTREF(__pyx_t_22); + __Pyx_XGOTREF(__pyx_t_23); + __Pyx_XGOTREF(__pyx_t_24); + __Pyx_XGOTREF(__pyx_t_25); + __Pyx_XGOTREF(__pyx_t_26); + __Pyx_XGOTREF(__pyx_t_27); + __pyx_t_19 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename; + { + (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_25); + __Pyx_XGIVEREF(__pyx_t_26); + __Pyx_XGIVEREF(__pyx_t_27); + __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_26, __pyx_t_27); + } + __Pyx_XGIVEREF(__pyx_t_22); + __Pyx_XGIVEREF(__pyx_t_23); + __Pyx_XGIVEREF(__pyx_t_24); + __Pyx_ErrRestore(__pyx_t_22, __pyx_t_23, __pyx_t_24); + __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; + __pyx_lineno = __pyx_t_19; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21; + goto __pyx_L27_error; + } + __pyx_L43:; + } - /* "src/pyrfc/data_container.pyx":625 - * return floatValue - * elif typ == RFCTYPE_INT: - * rc = RfcGetInt(container, cName, &intValue, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1224 + * + * try: + * for func_name, params in calls: # <<<<<<<<<<<<<< + * funcName = fillString(func_name) + * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) */ - __pyx_v_rc = RfcGetInt(__pyx_v_container, __pyx_v_cName, (&__pyx_v_intValue), (&__pyx_v_errorInfo)); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":626 - * elif typ == RFCTYPE_INT: - * rc = RfcGetInt(container, cName, &intValue, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return intValue + /* "pyrfc/_cyrfc.pyx":1243 + * RfcDestroyFunction(funcCont, NULL) + * # execute + * print (" Invocation finished. submitting unit.") # <<<<<<<<<<<<<< + * with nogil: + * rc = RfcSubmitUnit(self._uHandle, &errorInfo) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + if (__Pyx_PrintOne(0, __pyx_kp_s_Invocation_finished_submitting) < 0) __PYX_ERR(0, 1243, __pyx_L27_error) - /* "src/pyrfc/data_container.pyx":627 - * rc = RfcGetInt(container, cName, &intValue, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return intValue - * elif typ == RFCTYPE_INT1: + /* "pyrfc/_cyrfc.pyx":1244 + * # execute + * print (" Invocation finished. submitting unit.") + * with nogil: # <<<<<<<<<<<<<< + * rc = RfcSubmitUnit(self._uHandle, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 627, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 627, __pyx_L1_error) + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "src/pyrfc/data_container.pyx":626 - * elif typ == RFCTYPE_INT: - * rc = RfcGetInt(container, cName, &intValue, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return intValue + /* "pyrfc/_cyrfc.pyx":1245 + * print (" Invocation finished. submitting unit.") + * with nogil: + * rc = RfcSubmitUnit(self._uHandle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - } + __pyx_v_rc = RfcSubmitUnit(__pyx_v_self->_uHandle, (&__pyx_v_errorInfo)); + } - /* "src/pyrfc/data_container.pyx":628 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return intValue # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_INT1: - * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_RFC_INT(__pyx_v_intValue); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "src/pyrfc/data_container.pyx":624 - * raise wrapError(&errorInfo) - * return floatValue - * elif typ == RFCTYPE_INT: # <<<<<<<<<<<<<< - * rc = RfcGetInt(container, cName, &intValue, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1244 + * # execute + * print (" Invocation finished. submitting unit.") + * with nogil: # <<<<<<<<<<<<<< + * rc = RfcSubmitUnit(self._uHandle, &errorInfo) + * if rc != RFC_OK: */ - break; - case RFCTYPE_INT1: + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L53; + } + __pyx_L53:; + } + } - /* "src/pyrfc/data_container.pyx":630 - * return intValue - * elif typ == RFCTYPE_INT1: - * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1246 + * with nogil: + * rc = RfcSubmitUnit(self._uHandle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_v_rc = RfcGetInt1(__pyx_v_container, __pyx_v_cName, (&__pyx_v_int1Value), (&__pyx_v_errorInfo)); + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/data_container.pyx":631 - * elif typ == RFCTYPE_INT1: - * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return int1Value + /* "pyrfc/_cyrfc.pyx":1247 + * rc = RfcSubmitUnit(self._uHandle, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * except RFCError as e: */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1247, __pyx_L27_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":632 - * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return int1Value - * elif typ == RFCTYPE_INT2: + /* "pyrfc/_cyrfc.pyx":1246 + * with nogil: + * rc = RfcSubmitUnit(self._uHandle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 632, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 632, __pyx_L1_error) + } - /* "src/pyrfc/data_container.pyx":631 - * elif typ == RFCTYPE_INT1: - * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return int1Value + /* "pyrfc/_cyrfc.pyx":1223 + * self.active_unit = True + * + * try: # <<<<<<<<<<<<<< + * for func_name, params in calls: + * funcName = fillString(func_name) */ } + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + goto __pyx_L32_try_end; + __pyx_L27_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/pyrfc/data_container.pyx":633 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return int1Value # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_INT2: - * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1249 + * self._error(&errorInfo) + * + * except RFCError as e: # <<<<<<<<<<<<<< + * # clean up actions + * RfcDestroyUnit(self._uHandle, NULL) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_SAP_RAW(__pyx_v_int1Value); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 633, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1249, __pyx_L29_except_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_20 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_15); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_8); + __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_8 = 0; + if (__pyx_t_20) { + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 1249, __pyx_L29_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); + __pyx_v_e = __pyx_t_5; - /* "src/pyrfc/data_container.pyx":629 - * raise wrapError(&errorInfo) - * return intValue - * elif typ == RFCTYPE_INT1: # <<<<<<<<<<<<<< - * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1251 + * except RFCError as e: + * # clean up actions + * RfcDestroyUnit(self._uHandle, NULL) # <<<<<<<<<<<<<< + * raise + * */ - break; - case RFCTYPE_INT2: + (void)(RfcDestroyUnit(__pyx_v_self->_uHandle, NULL)); - /* "src/pyrfc/data_container.pyx":635 - * return int1Value - * elif typ == RFCTYPE_INT2: - * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1252 + * # clean up actions + * RfcDestroyUnit(self._uHandle, NULL) + * raise # <<<<<<<<<<<<<< + * + * unit_identifier = wrapUnitIdentifier(uIdentifier) */ - __pyx_v_rc = RfcGetInt2(__pyx_v_container, __pyx_v_cName, (&__pyx_v_int2Value), (&__pyx_v_errorInfo)); + __Pyx_GIVEREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestoreWithState(__pyx_t_8, __pyx_t_5, __pyx_t_1); + __pyx_t_8 = 0; __pyx_t_5 = 0; __pyx_t_1 = 0; + __PYX_ERR(0, 1252, __pyx_L29_except_error) + } + goto __pyx_L29_except_error; + __pyx_L29_except_error:; - /* "src/pyrfc/data_container.pyx":636 - * elif typ == RFCTYPE_INT2: - * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return int2Value + /* "pyrfc/_cyrfc.pyx":1223 + * self.active_unit = True + * + * try: # <<<<<<<<<<<<<< + * for func_name, params in calls: + * funcName = fillString(func_name) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); + goto __pyx_L1_error; + __pyx_L32_try_end:; + } - /* "src/pyrfc/data_container.pyx":637 - * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return int2Value - * elif typ == RFCTYPE_INT8: + /* "pyrfc/_cyrfc.pyx":1254 + * raise + * + * unit_identifier = wrapUnitIdentifier(uIdentifier) # <<<<<<<<<<<<<< + * return unit_identifier["queued"] + * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 637, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 637, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier(__pyx_v_uIdentifier); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_unit_identifier = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/data_container.pyx":636 - * elif typ == RFCTYPE_INT2: - * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return int2Value + /* "pyrfc/_cyrfc.pyx":1255 + * + * unit_identifier = wrapUnitIdentifier(uIdentifier) + * return unit_identifier["queued"] # <<<<<<<<<<<<<< + * + * def _get_unit_state(self, unit): */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit_identifier, __pyx_n_s_queued); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":638 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return int2Value # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_INT8: - * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1119 + * return wrapString(uid, RFC_UNITID_LN) + * + * def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< + * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) + * cdef RFC_RC rc */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_RFC_INT2(__pyx_v_int2Value); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 638, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":634 - * raise wrapError(&errorInfo) - * return int1Value - * elif typ == RFCTYPE_INT2: # <<<<<<<<<<<<<< - * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) - * if rc != RFC_OK: - */ - break; - case RFCTYPE_INT8: + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_queue_name); + __Pyx_XDECREF(__pyx_v_func_name); + __Pyx_XDECREF(__pyx_v_params); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_v_unit_identifier); + __Pyx_XDECREF(__pyx_v_queue_names); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":640 - * return int2Value - * elif typ == RFCTYPE_INT8: - * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1257 + * return unit_identifier["queued"] + * + * def _get_unit_state(self, unit): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_v_rc = RfcGetInt8(__pyx_v_container, __pyx_v_cName, (&__pyx_v_int8Value), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":641 - * elif typ == RFCTYPE_INT8: - * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return int8Value - */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_53_get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_53_get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_unit_state (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_52_get_unit_state(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); - /* "src/pyrfc/data_container.pyx":642 - * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return int8Value - * elif typ == RFCTYPE_UTCLONG: + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_52_get_unit_state(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; + RFC_UNIT_STATE __pyx_v_state; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + RFC_UNIT_IDENTIFIER __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + Py_UCS4 __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_unit_state", 0); + + /* "pyrfc/_cyrfc.pyx":1260 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) # <<<<<<<<<<<<<< + * cdef RFC_UNIT_STATE state + * */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 642, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 642, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(__pyx_v_unit); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1260, __pyx_L1_error) + __pyx_v_uIdentifier = __pyx_t_1; - /* "src/pyrfc/data_container.pyx":641 - * elif typ == RFCTYPE_INT8: - * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * return int8Value + /* "pyrfc/_cyrfc.pyx":1263 + * cdef RFC_UNIT_STATE state + * + * if not self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: */ - } + __pyx_t_2 = ((!(__pyx_v_self->active_unit != 0)) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/data_container.pyx":643 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * return int8Value # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_UTCLONG: - * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1264 + * + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") # <<<<<<<<<<<<<< + * if not self.alive: + * self._open() */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_RFC_INT8(__pyx_v_int8Value); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 643, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_No_unit_handle_for_this_connecti) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_No_unit_handle_for_this_connecti); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1264, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":639 - * raise wrapError(&errorInfo) - * return int2Value - * elif typ == RFCTYPE_INT8: # <<<<<<<<<<<<<< - * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1263 + * cdef RFC_UNIT_STATE state + * + * if not self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: */ - break; - case RFCTYPE_UTCLONG: + } - /* "src/pyrfc/data_container.pyx":646 - * elif typ == RFCTYPE_UTCLONG: - * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * strLen = 27 # is fixed # <<<<<<<<<<<<<< - * try: - * stringValue = mallocU(strLen+1) + /* "pyrfc/_cyrfc.pyx":1265 + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) */ - __pyx_v_strLen = 27; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1265, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = ((!__pyx_t_2) != 0); + if (__pyx_t_6) { - /* "src/pyrfc/data_container.pyx":647 - * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * strLen = 27 # is fixed - * try: # <<<<<<<<<<<<<< - * stringValue = mallocU(strLen+1) - * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds + /* "pyrfc/_cyrfc.pyx":1266 + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) + * if rc != RFC_OK: */ - /*try:*/ { + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1266, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":648 - * strLen = 27 # is fixed - * try: - * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< - * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1265 + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) */ - __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); + } - /* "src/pyrfc/data_container.pyx":650 - * stringValue = mallocU(strLen+1) - * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1267 + * if not self.alive: + * self._open() + * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetUnitState(__pyx_v_self->_handle, (&__pyx_v_uIdentifier), (&__pyx_v_state), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":651 - * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * utcValue = wrapString(stringValue, resultLen) + /* "pyrfc/_cyrfc.pyx":1268 + * self._open() + * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * if state not in enum_values(UnitState): */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_6 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_6) { - /* "src/pyrfc/data_container.pyx":652 - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * utcValue = wrapString(stringValue, resultLen) - * # replace the "," separator with "." + /* "pyrfc/_cyrfc.pyx":1269 + * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * if state not in enum_values(UnitState): + * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 652, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 652, __pyx_L55_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1269, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":651 - * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds - * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * utcValue = wrapString(stringValue, resultLen) + /* "pyrfc/_cyrfc.pyx":1268 + * self._open() + * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * if state not in enum_values(UnitState): */ - } + } - /* "src/pyrfc/data_container.pyx":653 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * utcValue = wrapString(stringValue, resultLen) # <<<<<<<<<<<<<< - * # replace the "," separator with "." - * return utcValue[:19]+'.'+utcValue[20:] + /* "pyrfc/_cyrfc.pyx":1270 + * if rc != RFC_OK: + * self._error(&errorInfo) + * if state not in enum_values(UnitState): # <<<<<<<<<<<<<< + * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") + * return UnitState(state).name */ - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_resultLen); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 653, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5.__pyx_n = 1; - __pyx_t_5.uclen = __pyx_t_3; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 653, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_utcValue = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyInt_From_RFC_UNIT_STATE(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_enum_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1270, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = (__pyx_t_6 != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/data_container.pyx":655 - * utcValue = wrapString(stringValue, resultLen) - * # replace the "," separator with "." - * return utcValue[:19]+'.'+utcValue[20:] # <<<<<<<<<<<<<< - * finally: - * free(stringValue) + /* "pyrfc/_cyrfc.pyx":1271 + * self._error(&errorInfo) + * if state not in enum_values(UnitState): + * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") # <<<<<<<<<<<<<< + * return UnitState(state).name + * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_utcValue, 0, 19, NULL, NULL, &__pyx_slice__21, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 655, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__8); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 655, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_utcValue, 20, 0, NULL, NULL, &__pyx_slice__22, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 655, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 655, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L54_return; - } - - /* "src/pyrfc/data_container.pyx":657 - * return utcValue[:19]+'.'+utcValue[20:] - * finally: - * free(stringValue) # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_DATE: - * rc = RfcGetDate(container, cName, dateValue, &errorInfo) - */ - /*finally:*/ { - __pyx_L55_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_9); - __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_22 = __pyx_filename; - { - free(__pyx_v_stringValue); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); - } - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); - __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; - __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_22; - goto __pyx_L1_error; - } - __pyx_L54_return: { - __pyx_t_9 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_stringValue); - __pyx_r = __pyx_t_9; - __pyx_t_9 = 0; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = 0; + __pyx_t_10 = 127; + __Pyx_INCREF(__pyx_kp_u_Unit); + __pyx_t_9 += 5; + __Pyx_GIVEREF(__pyx_kp_u_Unit); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Unit); + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_10; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_kp_u_has_invalid_state); + __pyx_t_9 += 20; + __Pyx_GIVEREF(__pyx_kp_u_has_invalid_state); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_has_invalid_state); + __pyx_t_8 = __Pyx_PyUnicode_From_RFC_UNIT_STATE(__pyx_v_state, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_10; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_9 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__6); + __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1271, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1271, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":644 - * raise wrapError(&errorInfo) - * return int8Value - * elif typ == RFCTYPE_UTCLONG: # <<<<<<<<<<<<<< - * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - * strLen = 27 # is fixed - */ - break; - case RFCTYPE_DATE: - - /* "src/pyrfc/data_container.pyx":659 - * free(stringValue) - * elif typ == RFCTYPE_DATE: - * rc = RfcGetDate(container, cName, dateValue, &errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1270 * if rc != RFC_OK: - * raise wrapError(&errorInfo) + * self._error(&errorInfo) + * if state not in enum_values(UnitState): # <<<<<<<<<<<<<< + * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") + * return UnitState(state).name */ - __pyx_v_rc = RfcGetDate(__pyx_v_container, __pyx_v_cName, __pyx_v_dateValue, (&__pyx_v_errorInfo)); + } - /* "src/pyrfc/data_container.pyx":660 - * elif typ == RFCTYPE_DATE: - * rc = RfcGetDate(container, cName, dateValue, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * value = wrapString(dateValue, 8) + /* "pyrfc/_cyrfc.pyx":1272 + * if state not in enum_values(UnitState): + * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") + * return UnitState(state).name # <<<<<<<<<<<<<< + * + * def _destroy_unit(self): */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyInt_From_RFC_UNIT_STATE(__pyx_v_state); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1272, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":661 - * rc = RfcGetDate(container, cName, dateValue, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * value = wrapString(dateValue, 8) - * # return date or None + /* "pyrfc/_cyrfc.pyx":1257 + * return unit_identifier["queued"] + * + * def _get_unit_state(self, unit): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(4, 661, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":660 - * elif typ == RFCTYPE_DATE: - * rc = RfcGetDate(container, cName, dateValue, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * value = wrapString(dateValue, 8) - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._get_unit_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":662 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * value = wrapString(dateValue, 8) # <<<<<<<<<<<<<< - * # return date or None - * if config & _MASK_DTIME: +/* "pyrfc/_cyrfc.pyx":1274 + * return UnitState(state).name + * + * def _destroy_unit(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_5.__pyx_n = 1; - __pyx_t_5.uclen = __pyx_int_8; - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_dateValue, &__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_value = __pyx_t_2; - __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":664 - * value = wrapString(dateValue, 8) - * # return date or None - * if config & _MASK_DTIME: # <<<<<<<<<<<<<< - * if (value == '00000000') or not value: - * return None - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MASK_DTIME); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 664, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_And(__pyx_v_config, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 664, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 664, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_1) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_55_destroy_unit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_55_destroy_unit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_destroy_unit (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_54_destroy_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - /* "src/pyrfc/data_container.pyx":665 - * # return date or None - * if config & _MASK_DTIME: - * if (value == '00000000') or not value: # <<<<<<<<<<<<<< - * return None - * return datetime.strptime(value, '%Y%m%d').date() - */ - __pyx_t_23 = (__Pyx_PyString_Equals(__pyx_v_value, __pyx_kp_s_00000000, Py_EQ)); if (unlikely(__pyx_t_23 < 0)) __PYX_ERR(4, 665, __pyx_L1_error) - if (!__pyx_t_23) { - } else { - __pyx_t_1 = __pyx_t_23; - goto __pyx_L63_bool_binop_done; - } - __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_23 < 0)) __PYX_ERR(4, 665, __pyx_L1_error) - __pyx_t_24 = ((!__pyx_t_23) != 0); - __pyx_t_1 = __pyx_t_24; - __pyx_L63_bool_binop_done:; - if (__pyx_t_1) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/data_container.pyx":666 - * if config & _MASK_DTIME: - * if (value == '00000000') or not value: - * return None # <<<<<<<<<<<<<< - * return datetime.strptime(value, '%Y%m%d').date() - * # return date string or '' - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_54_destroy_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_destroy_unit", 0); - /* "src/pyrfc/data_container.pyx":665 - * # return date or None - * if config & _MASK_DTIME: - * if (value == '00000000') or not value: # <<<<<<<<<<<<<< - * return None - * return datetime.strptime(value, '%Y%m%d').date() + /* "pyrfc/_cyrfc.pyx":1277 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: */ - } + __pyx_t_1 = ((!(__pyx_v_self->active_unit != 0)) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":667 - * if (value == '00000000') or not value: - * return None - * return datetime.strptime(value, '%Y%m%d').date() # <<<<<<<<<<<<<< - * # return date string or '' - * if (value == '00000000') or not value: + /* "pyrfc/_cyrfc.pyx":1278 + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") # <<<<<<<<<<<<<< + * if not self.alive: + * self._open() */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_strptime); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_19); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_19, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_19)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_value, __pyx_kp_s_Y_m_d}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_value, __pyx_kp_s_Y_m_d}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_25 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_25)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_6, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_Y_m_d); - __Pyx_GIVEREF(__pyx_kp_s_Y_m_d); - PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_6, __pyx_kp_s_Y_m_d); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - } - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_date); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_19); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_19, function); - } + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); } - __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 667, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "src/pyrfc/data_container.pyx":664 - * value = wrapString(dateValue, 8) - * # return date or None - * if config & _MASK_DTIME: # <<<<<<<<<<<<<< - * if (value == '00000000') or not value: - * return None - */ } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_unit_handle_for_this_connecti) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_unit_handle_for_this_connecti); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1278, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":669 - * return datetime.strptime(value, '%Y%m%d').date() - * # return date string or '' - * if (value == '00000000') or not value: # <<<<<<<<<<<<<< - * return '' - * return value + /* "pyrfc/_cyrfc.pyx":1277 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if not self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: */ - __pyx_t_24 = (__Pyx_PyString_Equals(__pyx_v_value, __pyx_kp_s_00000000, Py_EQ)); if (unlikely(__pyx_t_24 < 0)) __PYX_ERR(4, 669, __pyx_L1_error) - if (!__pyx_t_24) { - } else { - __pyx_t_1 = __pyx_t_24; - goto __pyx_L66_bool_binop_done; - } - __pyx_t_24 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_24 < 0)) __PYX_ERR(4, 669, __pyx_L1_error) - __pyx_t_23 = ((!__pyx_t_24) != 0); - __pyx_t_1 = __pyx_t_23; - __pyx_L66_bool_binop_done:; - if (__pyx_t_1) { + } - /* "src/pyrfc/data_container.pyx":670 - * # return date string or '' - * if (value == '00000000') or not value: - * return '' # <<<<<<<<<<<<<< - * return value - * elif typ == RFCTYPE_TIME: + /* "pyrfc/_cyrfc.pyx":1279 + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_kp_s__5); - __pyx_r = __pyx_kp_s__5; - goto __pyx_L0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1279, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((!__pyx_t_1) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":669 - * return datetime.strptime(value, '%Y%m%d').date() - * # return date string or '' - * if (value == '00000000') or not value: # <<<<<<<<<<<<<< - * return '' - * return value + /* "pyrfc/_cyrfc.pyx":1280 + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False */ - } + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":671 - * if (value == '00000000') or not value: - * return '' - * return value # <<<<<<<<<<<<<< - * elif typ == RFCTYPE_TIME: - * rc = RfcGetTime(container, cName, timeValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1279 + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_value); - __pyx_r = __pyx_v_value; - goto __pyx_L0; + } - /* "src/pyrfc/data_container.pyx":658 - * finally: - * free(stringValue) - * elif typ == RFCTYPE_DATE: # <<<<<<<<<<<<<< - * rc = RfcGetDate(container, cName, dateValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1281 + * if not self.alive: + * self._open() + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) # <<<<<<<<<<<<<< + * self.active_unit = False * if rc != RFC_OK: */ - break; - case RFCTYPE_TIME: + __pyx_v_rc = RfcDestroyUnit(__pyx_v_self->_uHandle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":673 - * return value - * elif typ == RFCTYPE_TIME: - * rc = RfcGetTime(container, cName, timeValue, &errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1282 + * self._open() + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False # <<<<<<<<<<<<<< * if rc != RFC_OK: - * raise wrapError(&errorInfo) + * self._error(&errorInfo) */ - __pyx_v_rc = RfcGetTime(__pyx_v_container, __pyx_v_cName, __pyx_v_timeValue, (&__pyx_v_errorInfo)); + __pyx_v_self->active_unit = 0; - /* "src/pyrfc/data_container.pyx":674 - * elif typ == RFCTYPE_TIME: - * rc = RfcGetTime(container, cName, timeValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1283 + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * value = wrapString(timeValue, 6) + * self._error(&errorInfo) + * */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/data_container.pyx":675 - * rc = RfcGetTime(container, cName, timeValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1284 + * self.active_unit = False * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * value = wrapString(timeValue, 6) - * # return time or None + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * def _confirm_unit(self, unit): */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 675, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(4, 675, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/data_container.pyx":674 - * elif typ == RFCTYPE_TIME: - * rc = RfcGetTime(container, cName, timeValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1283 + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * value = wrapString(timeValue, 6) + * self._error(&errorInfo) + * */ - } + } - /* "src/pyrfc/data_container.pyx":676 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * value = wrapString(timeValue, 6) # <<<<<<<<<<<<<< - * # return time or None - * if config & _MASK_DTIME: + /* "pyrfc/_cyrfc.pyx":1274 + * return UnitState(state).name + * + * def _destroy_unit(self): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_5.__pyx_n = 1; - __pyx_t_5.uclen = __pyx_int_6; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_timeValue, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 676, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_value = __pyx_t_4; - __pyx_t_4 = 0; - /* "src/pyrfc/data_container.pyx":678 - * value = wrapString(timeValue, 6) - * # return time or None - * if config & _MASK_DTIME: # <<<<<<<<<<<<<< - * if not value: - * return None + /* 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_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._destroy_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1286 + * self._error(&errorInfo) + * + * def _confirm_unit(self, unit): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_57_confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_57_confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_confirm_unit (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_56_confirm_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_56_confirm_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + RFC_UNIT_IDENTIFIER __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_confirm_unit", 0); + + /* "pyrfc/_cyrfc.pyx":1289 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) # <<<<<<<<<<<<<< + * + * if not self.active_unit: + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(__pyx_v_unit); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1289, __pyx_L1_error) + __pyx_v_uIdentifier = __pyx_t_1; + + /* "pyrfc/_cyrfc.pyx":1291 + * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) + * + * if not self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: + */ + __pyx_t_2 = ((!(__pyx_v_self->active_unit != 0)) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":1292 + * + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") # <<<<<<<<<<<<<< + * if not self.alive: + * self._open() */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MASK_DTIME); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 678, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_19 = PyNumber_And(__pyx_v_config, __pyx_t_4); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 678, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_No_unit_handle_for_this_connecti) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_No_unit_handle_for_this_connecti); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_19); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 678, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - if (__pyx_t_1) { + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1292, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":679 - * # return time or None - * if config & _MASK_DTIME: - * if not value: # <<<<<<<<<<<<<< - * return None - * return datetime.strptime(value, '%H%M%S').time() + /* "pyrfc/_cyrfc.pyx":1291 + * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) + * + * if not self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 679, __pyx_L1_error) - __pyx_t_23 = ((!__pyx_t_1) != 0); - if (__pyx_t_23) { + } - /* "src/pyrfc/data_container.pyx":680 - * if config & _MASK_DTIME: - * if not value: - * return None # <<<<<<<<<<<<<< - * return datetime.strptime(value, '%H%M%S').time() - * # return time string or '' + /* "pyrfc/_cyrfc.pyx":1293 + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1293, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = ((!__pyx_t_2) != 0); + if (__pyx_t_6) { - /* "src/pyrfc/data_container.pyx":679 - * # return time or None - * if config & _MASK_DTIME: - * if not value: # <<<<<<<<<<<<<< - * return None - * return datetime.strptime(value, '%H%M%S').time() + /* "pyrfc/_cyrfc.pyx":1294 + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: + * self._open() # <<<<<<<<<<<<<< + * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) + * if rc != RFC_OK: */ - } + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1294, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":681 - * if not value: - * return None - * return datetime.strptime(value, '%H%M%S').time() # <<<<<<<<<<<<<< - * # return time string or '' - * if not value: + /* "pyrfc/_cyrfc.pyx":1293 + * if not self.active_unit: + * raise RFCError("No unit handle for this connection available.") + * if not self.alive: # <<<<<<<<<<<<<< + * self._open() + * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strptime); if (unlikely(!__pyx_t_25)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_25))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_25); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_25, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_25)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_value, __pyx_kp_s_H_M_S}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_25)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_value, __pyx_kp_s_H_M_S}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_value); - __Pyx_INCREF(__pyx_kp_s_H_M_S); - __Pyx_GIVEREF(__pyx_kp_s_H_M_S); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_kp_s_H_M_S); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_25, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_25)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_25))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_25); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_25, function); - } - } - __pyx_t_19 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_25, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_25); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_r = __pyx_t_19; - __pyx_t_19 = 0; - goto __pyx_L0; + } - /* "src/pyrfc/data_container.pyx":678 - * value = wrapString(timeValue, 6) - * # return time or None - * if config & _MASK_DTIME: # <<<<<<<<<<<<<< - * if not value: - * return None + /* "pyrfc/_cyrfc.pyx":1295 + * if not self.alive: + * self._open() + * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * self._error(&errorInfo) */ - } + __pyx_v_rc = RfcConfirmUnit(__pyx_v_self->_handle, (&__pyx_v_uIdentifier), (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":683 - * return datetime.strptime(value, '%H%M%S').time() - * # return time string or '' - * if not value: # <<<<<<<<<<<<<< - * return '' - * return value + /* "pyrfc/_cyrfc.pyx":1296 + * self._open() + * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) */ - __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_23 < 0)) __PYX_ERR(4, 683, __pyx_L1_error) - __pyx_t_1 = ((!__pyx_t_23) != 0); - if (__pyx_t_1) { + __pyx_t_6 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_6) { - /* "src/pyrfc/data_container.pyx":684 - * # return time string or '' - * if not value: - * return '' # <<<<<<<<<<<<<< - * return value - * else: + /* "pyrfc/_cyrfc.pyx":1297 + * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_kp_s__5); - __pyx_r = __pyx_kp_s__5; - goto __pyx_L0; + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":683 - * return datetime.strptime(value, '%H%M%S').time() - * # return time string or '' - * if not value: # <<<<<<<<<<<<<< - * return '' - * return value + /* "pyrfc/_cyrfc.pyx":1296 + * self._open() + * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) */ - } + } - /* "src/pyrfc/data_container.pyx":685 - * if not value: - * return '' - * return value # <<<<<<<<<<<<<< - * else: - * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) + /* "pyrfc/_cyrfc.pyx":1298 + * if rc != RFC_OK: + * self._error(&errorInfo) + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) # <<<<<<<<<<<<<< + * self.active_unit = False + * if rc != RFC_OK: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_value); - __pyx_r = __pyx_v_value; - goto __pyx_L0; + __pyx_v_rc = RfcDestroyUnit(__pyx_v_self->_uHandle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/data_container.pyx":672 - * return '' - * return value - * elif typ == RFCTYPE_TIME: # <<<<<<<<<<<<<< - * rc = RfcGetTime(container, cName, timeValue, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1299 + * self._error(&errorInfo) + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False # <<<<<<<<<<<<<< * if rc != RFC_OK: + * self._error(&errorInfo) */ - break; - default: + __pyx_v_self->active_unit = 0; - /* "src/pyrfc/data_container.pyx":687 - * return value - * else: - * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1300 + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) * - * cdef wrapError(RFC_ERROR_INFO* errorInfo): */ - __Pyx_GetModuleGlobalName(__pyx_t_25, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_25)) __PYX_ERR(4, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_25); - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_typ); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_cName, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_RFC_type_d_when_wrapping, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 687, __pyx_L1_error) + __pyx_t_6 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_6) { + + /* "pyrfc/_cyrfc.pyx":1301 + * self.active_unit = False + * if rc != RFC_OK: + * self._error(&errorInfo) # <<<<<<<<<<<<<< + * + * ########################################################################## + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_25))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_25); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_25, function); - } - } - __pyx_t_19 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_25, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_25, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 687, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __Pyx_Raise(__pyx_t_19, 0, 0, 0); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __PYX_ERR(4, 687, __pyx_L1_error) - break; + + /* "pyrfc/_cyrfc.pyx":1300 + * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + * self.active_unit = False + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * self._error(&errorInfo) + * + */ } - /* "src/pyrfc/data_container.pyx":491 - * return table + /* "pyrfc/_cyrfc.pyx":1286 + * self._error(&errorInfo) * - * cdef wrapVariable( # <<<<<<<<<<<<<< - * RFCTYPE typ, - * RFC_FUNCTION_HANDLE container, + * def _confirm_unit(self, unit): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ /* 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_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_25); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection._confirm_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_utcValue); - __Pyx_XDECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":689 - * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) +/* "pyrfc/_cyrfc.pyx":1311 + * # * queued - boolean, set on fill_and_submit_unit() call + * + * def initialize_unit(self, background=True): # <<<<<<<<<<<<<< + * """ Initializes a logical unit of work (LUW), shorthand: unit * - * cdef wrapError(RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * group2error = { - * ABAP_APPLICATION_FAILURE: ABAPApplicationError, */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapError(RFC_ERROR_INFO *__pyx_v_errorInfo) { - PyObject *__pyx_v_group2error = NULL; - PyObject *__pyx_v_error = NULL; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_59initialize_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_58initialize_unit[] = " Initializes a logical unit of work (LUW), shorthand: unit\n\n .. warning::\n\n The background protocol (bgRFC) is not working in the current version.\n Please use only tRFC/qRFC protocols.\n\n :param background: The bgRFC protocol will be used. If set to False,\n the t/qRFC protocol will be used. Note that the bgRFC protocol\n has extended functionality. Default: True\n :type background: boolean\n\n :returns: A dictionary describing the unit.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_59initialize_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_background = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("initialize_unit (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_background,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_True); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_background); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize_unit") < 0)) __PYX_ERR(0, 1311, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_background = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("initialize_unit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1311, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.initialize_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_58initialize_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_background); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_58initialize_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_background) { + PyObject *__pyx_v_id = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - PyObject *__pyx_t_15 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapError", 0); + __Pyx_RefNannySetupContext("initialize_unit", 0); - /* "src/pyrfc/data_container.pyx":691 - * cdef wrapError(RFC_ERROR_INFO* errorInfo): - * group2error = { - * ABAP_APPLICATION_FAILURE: ABAPApplicationError, # <<<<<<<<<<<<<< - * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, - * LOGON_FAILURE: LogonError, + /* "pyrfc/_cyrfc.pyx":1326 + * :returns: A dictionary describing the unit. + * """ + * if background is True: # use bgRFC # <<<<<<<<<<<<<< + * id = self._get_unit_id() + * elif background is False: # classic t/qRFC */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_APPLICATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ABAPApplicationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_v_background == Py_True); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "src/pyrfc/data_container.pyx":692 - * group2error = { - * ABAP_APPLICATION_FAILURE: ABAPApplicationError, - * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, # <<<<<<<<<<<<<< - * LOGON_FAILURE: LogonError, - * COMMUNICATION_FAILURE: CommunicationError, + /* "pyrfc/_cyrfc.pyx":1327 + * """ + * if background is True: # use bgRFC + * id = self._get_unit_id() # <<<<<<<<<<<<<< + * elif background is False: # classic t/qRFC + * id = self._get_transaction_id() */ - __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_RUNTIME_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ABAPRuntimeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_unit_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_id = __pyx_t_3; + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":693 - * ABAP_APPLICATION_FAILURE: ABAPApplicationError, - * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, - * LOGON_FAILURE: LogonError, # <<<<<<<<<<<<<< - * COMMUNICATION_FAILURE: CommunicationError, - * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, - */ - __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(LOGON_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LogonError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/data_container.pyx":694 - * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, - * LOGON_FAILURE: LogonError, - * COMMUNICATION_FAILURE: CommunicationError, # <<<<<<<<<<<<<< - * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, - * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, - */ - __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(COMMUNICATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CommunicationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 694, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/data_container.pyx":695 - * LOGON_FAILURE: LogonError, - * COMMUNICATION_FAILURE: CommunicationError, - * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, # <<<<<<<<<<<<<< - * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, - * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError - */ - __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_RUNTIME_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 695, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 695, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/data_container.pyx":696 - * COMMUNICATION_FAILURE: CommunicationError, - * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, - * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, # <<<<<<<<<<<<<< - * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError - * } - */ - __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_APPLICATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExternalApplicationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 696, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/data_container.pyx":697 - * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, - * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, - * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError # <<<<<<<<<<<<<< - * } - * error = group2error[errorInfo.group] - */ - __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_AUTHORIZATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 697, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ExternalAuthorizationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 697, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(4, 691, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_group2error = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "src/pyrfc/data_container.pyx":699 - * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError - * } - * error = group2error[errorInfo.group] # <<<<<<<<<<<<<< - * return error( - * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), - */ - __pyx_t_1 = __Pyx_PyInt_From_RFC_ERROR_GROUP(__pyx_v_errorInfo->group); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 699, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_group2error, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 699, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_error = __pyx_t_3; - __pyx_t_3 = 0; - - /* "src/pyrfc/data_container.pyx":700 - * } - * error = group2error[errorInfo.group] - * return error( # <<<<<<<<<<<<<< - * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), - * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), + /* "pyrfc/_cyrfc.pyx":1326 + * :returns: A dictionary describing the unit. + * """ + * if background is True: # use bgRFC # <<<<<<<<<<<<<< + * id = self._get_unit_id() + * elif background is False: # classic t/qRFC */ - __Pyx_XDECREF(__pyx_r); + goto __pyx_L3; + } - /* "src/pyrfc/data_container.pyx":701 - * error = group2error[errorInfo.group] - * return error( - * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), # <<<<<<<<<<<<<< - * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), - * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), + /* "pyrfc/_cyrfc.pyx":1328 + * if background is True: # use bgRFC + * id = self._get_unit_id() + * elif background is False: # classic t/qRFC # <<<<<<<<<<<<<< + * id = self._get_transaction_id() + * else: */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->message, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_RFC_RC(__pyx_v_errorInfo->code); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = (__pyx_v_background == Py_False); + __pyx_t_1 = (__pyx_t_2 != 0); + if (likely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":702 - * return error( - * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), - * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), # <<<<<<<<<<<<<< - * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), - * wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) + /* "pyrfc/_cyrfc.pyx":1329 + * id = self._get_unit_id() + * elif background is False: # classic t/qRFC + * id = self._get_transaction_id() # <<<<<<<<<<<<<< + * else: + * raise RFCError("Argument 'background' must be a boolean value.") */ - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgClass, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgType, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgNumber, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 702, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_transaction_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_id = __pyx_t_3; + __pyx_t_3 = 0; - /* "src/pyrfc/data_container.pyx":703 - * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), - * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), - * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), # <<<<<<<<<<<<<< - * wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) - * ) + /* "pyrfc/_cyrfc.pyx":1328 + * if background is True: # use bgRFC + * id = self._get_unit_id() + * elif background is False: # classic t/qRFC # <<<<<<<<<<<<<< + * id = self._get_transaction_id() + * else: */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 703, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 703, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + goto __pyx_L3; + } - /* "src/pyrfc/data_container.pyx":704 - * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), - * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), - * wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) # <<<<<<<<<<<<<< - * ) + /* "pyrfc/_cyrfc.pyx":1331 + * id = self._get_transaction_id() + * else: + * raise RFCError("Argument 'background' must be a boolean value.") # <<<<<<<<<<<<<< + * return {'background': background, 'id': id, "queued": False} * */ - __pyx_t_10 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV4, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 704, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_v_error); - __pyx_t_12 = __pyx_v_error; __pyx_t_13 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - __pyx_t_14 = 1; + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[11] = {__pyx_t_13, __pyx_t_1, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 10+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 700, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { - PyObject *__pyx_temp[11] = {__pyx_t_13, __pyx_t_1, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 10+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 700, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_background_must_be_a_bo) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_background_must_be_a_bo); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - { - __pyx_t_15 = PyTuple_New(10+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(4, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_15); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_14, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_15, 5+__pyx_t_14, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_15, 6+__pyx_t_14, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_15, 7+__pyx_t_14, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_15, 8+__pyx_t_14, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_15, 9+__pyx_t_14, __pyx_t_11); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1331, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_L3:; + + /* "pyrfc/_cyrfc.pyx":1332 + * else: + * raise RFCError("Argument 'background' must be a boolean value.") + * return {'background': background, 'id': id, "queued": False} # <<<<<<<<<<<<<< + * + * def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_background, __pyx_v_background) < 0) __PYX_ERR(0, 1332, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_id, __pyx_v_id) < 0) __PYX_ERR(0, 1332, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_queued, Py_False) < 0) __PYX_ERR(0, 1332, __pyx_L1_error) __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "src/pyrfc/data_container.pyx":689 - * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) + /* "pyrfc/_cyrfc.pyx":1311 + * # * queued - boolean, set on fill_and_submit_unit() call + * + * def initialize_unit(self, background=True): # <<<<<<<<<<<<<< + * """ Initializes a logical unit of work (LUW), shorthand: unit * - * cdef wrapError(RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * group2error = { - * ABAP_APPLICATION_FAILURE: ABAPApplicationError, */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapError", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.initialize_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_group2error); - __Pyx_XDECREF(__pyx_v_error); + __Pyx_XDECREF(__pyx_v_id); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/data_container.pyx":707 - * ) +/* "pyrfc/_cyrfc.pyx":1334 + * return {'background': background, 'id': id, "queued": False} + * + * def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< + * """ Fills a unit with one or more RFC and submits it to the backend. * - * cdef wrapString(const SAP_UC* uc, uclen=-1, rstrip=False): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapString(SAP_UC const *__pyx_v_uc, struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString *__pyx_optional_args) { - PyObject *__pyx_v_uclen = ((PyObject *)__pyx_int_neg_1); - PyObject *__pyx_v_rstrip = ((PyObject *)Py_False); - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - unsigned int __pyx_v_utf8_size; - char *__pyx_v_utf8; - unsigned int __pyx_v_result_len; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_61fill_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_60fill_and_submit_unit[] = " Fills a unit with one or more RFC and submits it to the backend.\n\n Fills a unit for this connection, prepare the invocation\n of multiple RFC function modules in it, and submits the unit\n to the backend.\n\n Afterwards, the unit is still attached to the connection object,\n until confirm_unit() or destroy_unit() is called. Until one of these\n methods are called, no other unit could be filled and submitted.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :param calls: a list of call descriptions. Each call description is a\n tuple that contains the function name as the first element and\n the function arguments in form of a dictionary as the second element.\n :param queue_names:\n If the unit uses the background protocol, various queue names can\n be given (leading to a asynchronous unit, type 'Q'). If parameter\n is an empty list or None, a synchronous unit (type 'T') is created.\n\n If the unit does not use the background protocol, the queue name\n may be a list with exactly one element, leading to a qRFC, or\n an empty list or None, leading to a tRFC.\n :type queue_names: list of strings or None (default)\n :param attributes: optional argument for attributes of the unit -- only valid if the background protocol\n is used. The attributes dict may contain the following keywords:\n\n =============== ============================= ======================= ==========================================================================================\n keyword default type description\n =============== ============================= ======================= =======================================================================""===================\n kernel_trace 0 int If != 0, the backend will write kernel traces, while executing this unit.\n sat_trace 0 int If != 0, the backend will write statistic records, while executing this unit.\n unit_history 0 int If != 0, the backend will keep a \"history\" for this unit.\n lock 0 int Used only for type Q: If != 0, the unit will be written to the queue, but not processed.\n The unit can then be started manually in the ABAP debugger.\n no_commit_check 0 int Per default the backend will check during execution of a unit, whether one of the\n unit's function modules triggers an explicit or implicit COMMITWORK.\n In this case the unit is aborted with an error, because the transactional integrity of\n this unit cannot be guaranteed. By setting \"no_commit_check\" to true (!=0), this behavior\n can be suppressed, meaning the unit will be executed anyway, even if one of it's\n function modules \"misbehaves\" and triggers a COMMIT WORK.\n user current operating system user String, len |nbsp| 12 Sender User (optional).\n client \"000\" String, len |nbsp| 3 Sender Client (""\"Mandant\") (optional).\n t_code \"\" String, len |nbsp| 20 Sender Transaction Code (optional).\n program current executable name String, len |nbsp| 40 Sender Program (optional).\n =============== ============================= ======================= ==========================================================================================\n\n :type attributes: dict or None (default)\n :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if an error\n occurred. In this case, the unit is destroyed.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_61fill_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_unit = 0; + PyObject *__pyx_v_calls = 0; + PyObject *__pyx_v_queue_names = 0; + PyObject *__pyx_v_attributes = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fill_and_submit_unit (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unit,&__pyx_n_s_calls,&__pyx_n_s_queue_names,&__pyx_n_s_attributes,0}; + PyObject* values[4] = {0,0,0,0}; + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 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_unit)) != 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_calls)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fill_and_submit_unit", 0, 2, 4, 1); __PYX_ERR(0, 1334, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_names); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_and_submit_unit") < 0)) __PYX_ERR(0, 1334, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_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); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_unit = values[0]; + __pyx_v_calls = values[1]; + __pyx_v_queue_names = values[2]; + __pyx_v_attributes = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("fill_and_submit_unit", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1334, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.fill_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_60fill_and_submit_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_unit, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_60fill_and_submit_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit, PyObject *__pyx_v_calls, PyObject *__pyx_v_queue_names, PyObject *__pyx_v_attributes) { + PyObject *__pyx_v_func_name = NULL; + PyObject *__pyx_v_params = NULL; + PyObject *__pyx_v_bg = NULL; + PyObject *__pyx_v_unit_id = NULL; + PyObject *__pyx_v_queue_name = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - unsigned int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - char const *__pyx_t_9; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + Py_UCS4 __pyx_t_12; + Py_ssize_t __pyx_t_13; + int __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapString", 0); - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_uclen = __pyx_optional_args->uclen; - if (__pyx_optional_args->__pyx_n > 1) { - __pyx_v_rstrip = __pyx_optional_args->rstrip; - } - } - } - __Pyx_INCREF(__pyx_v_uclen); + __Pyx_RefNannySetupContext("fill_and_submit_unit", 0); - /* "src/pyrfc/data_container.pyx":710 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if uclen == -1: # <<<<<<<<<<<<<< - * uclen = strlenU(uc) - * if uclen == 0: + /* "pyrfc/_cyrfc.pyx":1387 + * """ + * + * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") + * if not isinstance(calls, Iterable): */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 710, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 710, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_unit)) != ((PyObject *)(&PyDict_Type))); + __pyx_t_3 = (__pyx_t_2 != 0); + if (!__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_id, __pyx_v_unit, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1387, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_3 != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_background, __pyx_v_unit, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1387, __pyx_L1_error) + __pyx_t_3 = (__pyx_t_2 != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":711 - * cdef RFC_ERROR_INFO errorInfo - * if uclen == -1: - * uclen = strlenU(uc) # <<<<<<<<<<<<<< - * if uclen == 0: - * return '' + /* "pyrfc/_cyrfc.pyx":1388 + * + * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: + * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") # <<<<<<<<<<<<<< + * if not isinstance(calls, Iterable): + * raise TypeError("Parameter 'calls' must be iterable.") */ - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(strlenU(__pyx_v_uc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 711, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_uclen, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1388, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1388, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":710 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if uclen == -1: # <<<<<<<<<<<<<< - * uclen = strlenU(uc) - * if uclen == 0: + /* "pyrfc/_cyrfc.pyx":1387 + * """ + * + * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") + * if not isinstance(calls, Iterable): */ } - /* "src/pyrfc/data_container.pyx":712 - * if uclen == -1: - * uclen = strlenU(uc) - * if uclen == 0: # <<<<<<<<<<<<<< - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 + /* "pyrfc/_cyrfc.pyx":1389 + * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: + * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") + * if not isinstance(calls, Iterable): # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'calls' must be iterable.") + * if len(calls)==0: */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 712, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_IsInstance(__pyx_v_calls, __pyx_t_4); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1389, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/data_container.pyx":713 - * uclen = strlenU(uc) - * if uclen == 0: - * return '' # <<<<<<<<<<<<<< - * cdef unsigned utf8_size = uclen * 5 + 1 - * cdef char *utf8 = malloc(utf8_size) + /* "pyrfc/_cyrfc.pyx":1390 + * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") + * if not isinstance(calls, Iterable): + * raise TypeError("Parameter 'calls' must be iterable.") # <<<<<<<<<<<<<< + * if len(calls)==0: + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_kp_s__5); - __pyx_r = __pyx_kp_s__5; - goto __pyx_L0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1390, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":712 - * if uclen == -1: - * uclen = strlenU(uc) - * if uclen == 0: # <<<<<<<<<<<<<< - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 + /* "pyrfc/_cyrfc.pyx":1389 + * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: + * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") + * if not isinstance(calls, Iterable): # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'calls' must be iterable.") + * if len(calls)==0: */ } - /* "src/pyrfc/data_container.pyx":714 - * if uclen == 0: - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 # <<<<<<<<<<<<<< - * cdef char *utf8 = malloc(utf8_size) - * utf8[0] = 0 + /* "pyrfc/_cyrfc.pyx":1391 + * if not isinstance(calls, Iterable): + * raise TypeError("Parameter 'calls' must be iterable.") + * if len(calls)==0: # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + * for func_name, params in calls: */ - __pyx_t_1 = PyNumber_Multiply(__pyx_v_uclen, __pyx_int_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 714, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 714, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 714, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_utf8_size = __pyx_t_4; + __pyx_t_5 = PyObject_Length(__pyx_v_calls); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1391, __pyx_L1_error) + __pyx_t_3 = ((__pyx_t_5 == 0) != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/data_container.pyx":715 - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 - * cdef char *utf8 = malloc(utf8_size) # <<<<<<<<<<<<<< - * utf8[0] = 0 - * cdef unsigned result_len = 0 + /* "pyrfc/_cyrfc.pyx":1392 + * raise TypeError("Parameter 'calls' must be iterable.") + * if len(calls)==0: + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") # <<<<<<<<<<<<<< + * for func_name, params in calls: + * if type(func_name) is not str or type(params) is not dict: */ - __pyx_v_utf8 = ((char *)malloc(__pyx_v_utf8_size)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1392, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1392, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":716 - * cdef unsigned utf8_size = uclen * 5 + 1 - * cdef char *utf8 = malloc(utf8_size) - * utf8[0] = 0 # <<<<<<<<<<<<<< - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1391 + * if not isinstance(calls, Iterable): + * raise TypeError("Parameter 'calls' must be iterable.") + * if len(calls)==0: # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + * for func_name, params in calls: */ - (__pyx_v_utf8[0]) = 0; + } - /* "src/pyrfc/data_container.pyx":717 - * cdef char *utf8 = malloc(utf8_size) - * utf8[0] = 0 - * cdef unsigned result_len = 0 # <<<<<<<<<<<<<< - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1393 + * if len(calls)==0: + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + * for func_name, params in calls: # <<<<<<<<<<<<<< + * if type(func_name) is not str or type(params) is not dict: + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") */ - __pyx_v_result_len = 0; + if (likely(PyList_CheckExact(__pyx_v_calls)) || PyTuple_CheckExact(__pyx_v_calls)) { + __pyx_t_4 = __pyx_v_calls; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_calls); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1393, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1393, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1393, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1393, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { + PyObject* sequence = __pyx_t_7; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1393, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + #else + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 1393, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L12_unpacking_done; + __pyx_L11_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1393, __pyx_L1_error) + __pyx_L12_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_9); + __pyx_t_9 = 0; - /* "src/pyrfc/data_container.pyx":718 - * utf8[0] = 0 - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * # raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1394 + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + * for func_name, params in calls: + * if type(func_name) is not str or type(params) is not dict: # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + * if self.active_unit: */ - __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_v_uclen); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 718, __pyx_L1_error) - __pyx_v_rc = RfcSAPUCToUTF8(__pyx_v_uc, __pyx_t_4, ((RFC_BYTE *)__pyx_v_utf8), (&__pyx_v_utf8_size), (&__pyx_v_result_len), (&__pyx_v_errorInfo)); + __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_func_name)) != ((PyObject *)(&PyString_Type))); + __pyx_t_2 = (__pyx_t_1 != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_3 = __pyx_t_2; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_params)) != ((PyObject *)(&PyDict_Type))); + __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_3 = __pyx_t_1; + __pyx_L14_bool_binop_done:; + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/data_container.pyx":719 - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + /* "pyrfc/_cyrfc.pyx":1395 + * for func_name, params in calls: + * if type(func_name) is not str or type(params) is not dict: + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") # <<<<<<<<<<<<<< + * if self.active_unit: + * raise RFCError("There is an active unit for this connection. " */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1395, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_Raise(__pyx_t_7, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(0, 1395, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":721 - * if rc != RFC_OK: - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) # <<<<<<<<<<<<<< - * utf8[result_len] = 0 - * try: + /* "pyrfc/_cyrfc.pyx":1394 + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + * for func_name, params in calls: + * if type(func_name) is not str or type(params) is not dict: # <<<<<<<<<<<<<< + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + * if self.active_unit: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 721, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_utf8_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 721, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 721, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_uclen); - __Pyx_GIVEREF(__pyx_v_uclen); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_uclen); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_wrapString_uclen_u_utf8_size_u, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 721, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 721, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 721, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":719 - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + /* "pyrfc/_cyrfc.pyx":1393 + * if len(calls)==0: + * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + * for func_name, params in calls: # <<<<<<<<<<<<<< + * if type(func_name) is not str or type(params) is not dict: + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") */ } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/data_container.pyx":722 - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) - * utf8[result_len] = 0 # <<<<<<<<<<<<<< - * try: - * if rstrip: - */ - (__pyx_v_utf8[__pyx_v_result_len]) = 0; - - /* "src/pyrfc/data_container.pyx":723 - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) - * utf8[result_len] = 0 - * try: # <<<<<<<<<<<<<< - * if rstrip: - * return utf8[:result_len].rstrip().decode() + /* "pyrfc/_cyrfc.pyx":1396 + * if type(func_name) is not str or type(params) is not dict: + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + * if self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("There is an active unit for this connection. " + * "Use destroy_unit() " + */ - /*try:*/ { + __pyx_t_3 = (__pyx_v_self->active_unit != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/data_container.pyx":724 - * utf8[result_len] = 0 - * try: - * if rstrip: # <<<<<<<<<<<<<< - * return utf8[:result_len].rstrip().decode() - * else: + /* "pyrfc/_cyrfc.pyx":1397 + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + * if self.active_unit: + * raise RFCError("There is an active unit for this connection. " # <<<<<<<<<<<<<< + * "Use destroy_unit() " + + * "or confirm_unit().") */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rstrip); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 724, __pyx_L7_error) - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/pyrfc/data_container.pyx":725 - * try: - * if rstrip: - * return utf8[:result_len].rstrip().decode() # <<<<<<<<<<<<<< - * else: - * return utf8[:result_len].decode() + /* "pyrfc/_cyrfc.pyx":1398 + * if self.active_unit: + * raise RFCError("There is an active unit for this connection. " + * "Use destroy_unit() " + # <<<<<<<<<<<<<< + * "or confirm_unit().") + * bg = unit['background'] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_utf8 + 0, __pyx_v_result_len - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 725, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 725, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 725, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 725, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } + __pyx_t_9 = PyNumber_Add(__pyx_kp_s_There_is_an_active_unit_for_this, __pyx_kp_s_or_confirm_unit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); } - __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 725, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L6_return; - - /* "src/pyrfc/data_container.pyx":724 - * utf8[result_len] = 0 - * try: - * if rstrip: # <<<<<<<<<<<<<< - * return utf8[:result_len].rstrip().decode() - * else: - */ } + __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1397, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":727 - * return utf8[:result_len].rstrip().decode() - * else: - * return utf8[:result_len].decode() # <<<<<<<<<<<<<< - * finally: - * free(utf8) + /* "pyrfc/_cyrfc.pyx":1396 + * if type(func_name) is not str or type(params) is not dict: + * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + * if self.active_unit: # <<<<<<<<<<<<<< + * raise RFCError("There is an active unit for this connection. " + * "Use destroy_unit() " + */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_utf8, 0, __pyx_v_result_len, NULL, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 727, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L6_return; - } } - /* "src/pyrfc/data_container.pyx":729 - * return utf8[:result_len].decode() - * finally: - * free(utf8) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1400 + * "Use destroy_unit() " + + * "or confirm_unit().") + * bg = unit['background'] # <<<<<<<<<<<<<< + * unit_id = unit['id'] * - * cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): */ - /*finally:*/ { - __pyx_L7_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_15); - __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename; - { - free(__pyx_v_utf8); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); - } - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12); - __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; - __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9; - goto __pyx_L1_error; - } - __pyx_L6_return: { - __pyx_t_15 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_utf8); - __pyx_r = __pyx_t_15; - __pyx_t_15 = 0; - goto __pyx_L0; - } - } + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_bg = __pyx_t_4; + __pyx_t_4 = 0; - /* "src/pyrfc/data_container.pyx":707 - * ) + /* "pyrfc/_cyrfc.pyx":1401 + * "or confirm_unit().") + * bg = unit['background'] + * unit_id = unit['id'] # <<<<<<<<<<<<<< * - * cdef wrapString(const SAP_UC* uc, uclen=-1, rstrip=False): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * if bg is True: */ + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_unit_id = __pyx_t_4; + __pyx_t_4 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapString", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_uclen); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/data_container.pyx":731 - * free(utf8) + /* "pyrfc/_cyrfc.pyx":1403 + * unit_id = unit['id'] * - * cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * if bg is True: # <<<<<<<<<<<<<< + * if len(unit_id) != RFC_UNITID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") */ + __pyx_t_3 = (__pyx_v_bg == Py_True); + __pyx_t_1 = (__pyx_t_3 != 0); + if (__pyx_t_1) { -static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapString(SAP_UC *__pyx_v_uc, struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString *__pyx_optional_args) { - PyObject *__pyx_v_uclen = ((PyObject *)__pyx_int_neg_1); - PyObject *__pyx_v_rstrip = ((PyObject *)Py_True); - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - unsigned int __pyx_v_utf8_size; - char *__pyx_v_utf8; - unsigned int __pyx_v_result_len; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - unsigned int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - char const *__pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("wrapString", 0); - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_uclen = __pyx_optional_args->uclen; - if (__pyx_optional_args->__pyx_n > 1) { - __pyx_v_rstrip = __pyx_optional_args->rstrip; - } - } - } - __Pyx_INCREF(__pyx_v_uclen); - - /* "src/pyrfc/data_container.pyx":734 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if uclen == -1: # <<<<<<<<<<<<<< - * uclen = strlenU(uc) - * if uclen == 0: + /* "pyrfc/_cyrfc.pyx":1404 + * + * if bg is True: + * if len(unit_id) != RFC_UNITID_LN: # <<<<<<<<<<<<<< + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 734, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 734, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_5 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1404, __pyx_L1_error) + __pyx_t_1 = ((__pyx_t_5 != RFC_UNITID_LN) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":735 - * cdef RFC_ERROR_INFO errorInfo - * if uclen == -1: - * uclen = strlenU(uc) # <<<<<<<<<<<<<< - * if uclen == 0: - * return '' + /* "pyrfc/_cyrfc.pyx":1405 + * if bg is True: + * if len(unit_id) != RFC_UNITID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") # <<<<<<<<<<<<<< + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + * elif bg is False: */ - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(strlenU(__pyx_v_uc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_uclen, __pyx_t_1); - __pyx_t_1 = 0; - - /* "src/pyrfc/data_container.pyx":734 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if uclen == -1: # <<<<<<<<<<<<<< - * uclen = strlenU(uc) - * if uclen == 0: - */ - } + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_12 = 127; + __Pyx_INCREF(__pyx_kp_u_Length_of_parameter_unit_id_must); + __pyx_t_5 += 41; + __Pyx_GIVEREF(__pyx_kp_u_Length_of_parameter_unit_id_must); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Length_of_parameter_unit_id_must); + __pyx_t_7 = __Pyx_PyUnicode_From_int(RFC_UNITID_LN, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u_chars_found); + __pyx_t_5 += 14; + __Pyx_GIVEREF(__pyx_kp_u_chars_found); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_chars_found); + __pyx_t_13 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1405, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_13, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__20); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__20); + PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__20); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_5, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1405, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":736 - * if uclen == -1: - * uclen = strlenU(uc) - * if uclen == 0: # <<<<<<<<<<<<<< - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 + /* "pyrfc/_cyrfc.pyx":1404 + * + * if bg is True: + * if len(unit_id) != RFC_UNITID_LN: # <<<<<<<<<<<<<< + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) */ - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 736, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 736, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + } - /* "src/pyrfc/data_container.pyx":737 - * uclen = strlenU(uc) - * if uclen == 0: - * return '' # <<<<<<<<<<<<<< - * cdef unsigned utf8_size = uclen * 5 + 1 - * cdef char *utf8 = malloc(utf8_size) + /* "pyrfc/_cyrfc.pyx":1406 + * if len(unit_id) != RFC_UNITID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) # <<<<<<<<<<<<<< + * elif bg is False: + * if len(unit_id) != RFC_TID_LN: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_kp_s__5); - __pyx_r = __pyx_kp_s__5; - goto __pyx_L0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_and_submit_unit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + __pyx_t_14 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_14 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1406, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1406, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + { + __pyx_t_8 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_INCREF(__pyx_v_unit_id); + __Pyx_GIVEREF(__pyx_v_unit_id); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_14, __pyx_v_unit_id); + __Pyx_INCREF(__pyx_v_calls); + __Pyx_GIVEREF(__pyx_v_calls); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_14, __pyx_v_calls); + __Pyx_INCREF(__pyx_v_queue_names); + __Pyx_GIVEREF(__pyx_v_queue_names); + PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_14, __pyx_v_queue_names); + __Pyx_INCREF(__pyx_v_attributes); + __Pyx_GIVEREF(__pyx_v_attributes); + PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_14, __pyx_v_attributes); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(PyObject_SetItem(__pyx_v_unit, __pyx_n_s_queued, __pyx_t_4) < 0)) __PYX_ERR(0, 1406, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/data_container.pyx":736 - * if uclen == -1: - * uclen = strlenU(uc) - * if uclen == 0: # <<<<<<<<<<<<<< - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 + /* "pyrfc/_cyrfc.pyx":1403 + * unit_id = unit['id'] + * + * if bg is True: # <<<<<<<<<<<<<< + * if len(unit_id) != RFC_UNITID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") */ + goto __pyx_L17; } - /* "src/pyrfc/data_container.pyx":738 - * if uclen == 0: - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 # <<<<<<<<<<<<<< - * cdef char *utf8 = malloc(utf8_size) - * utf8[0] = 0 - */ - __pyx_t_1 = PyNumber_Multiply(__pyx_v_uclen, __pyx_int_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 738, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 738, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_utf8_size = __pyx_t_4; - - /* "src/pyrfc/data_container.pyx":739 - * return '' - * cdef unsigned utf8_size = uclen * 5 + 1 - * cdef char *utf8 = malloc(utf8_size) # <<<<<<<<<<<<<< - * utf8[0] = 0 - * cdef unsigned result_len = 0 - */ - __pyx_v_utf8 = ((char *)malloc(__pyx_v_utf8_size)); - - /* "src/pyrfc/data_container.pyx":740 - * cdef unsigned utf8_size = uclen * 5 + 1 - * cdef char *utf8 = malloc(utf8_size) - * utf8[0] = 0 # <<<<<<<<<<<<<< - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - */ - (__pyx_v_utf8[0]) = 0; - - /* "src/pyrfc/data_container.pyx":741 - * cdef char *utf8 = malloc(utf8_size) - * utf8[0] = 0 - * cdef unsigned result_len = 0 # <<<<<<<<<<<<<< - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1407 + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + * elif bg is False: # <<<<<<<<<<<<<< + * if len(unit_id) != RFC_TID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") */ - __pyx_v_result_len = 0; + __pyx_t_1 = (__pyx_v_bg == Py_False); + __pyx_t_3 = (__pyx_t_1 != 0); + if (likely(__pyx_t_3)) { - /* "src/pyrfc/data_container.pyx":742 - * utf8[0] = 0 - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * # raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1408 + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + * elif bg is False: + * if len(unit_id) != RFC_TID_LN: # <<<<<<<<<<<<<< + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") + * if attributes is not None: */ - __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_v_uclen); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(4, 742, __pyx_L1_error) - __pyx_v_rc = RfcSAPUCToUTF8(__pyx_v_uc, __pyx_t_4, ((RFC_BYTE *)__pyx_v_utf8), (&__pyx_v_utf8_size), (&__pyx_v_result_len), (&__pyx_v_errorInfo)); + __pyx_t_5 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1408, __pyx_L1_error) + __pyx_t_3 = ((__pyx_t_5 != RFC_TID_LN) != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/data_container.pyx":743 - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + /* "pyrfc/_cyrfc.pyx":1409 + * elif bg is False: + * if len(unit_id) != RFC_TID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") # <<<<<<<<<<<<<< + * if attributes is not None: + * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_12 = 127; + __Pyx_INCREF(__pyx_kp_u_Length_of_parameter_unit_id_must); + __pyx_t_5 += 41; + __Pyx_GIVEREF(__pyx_kp_u_Length_of_parameter_unit_id_must); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Length_of_parameter_unit_id_must); + __pyx_t_7 = __Pyx_PyUnicode_From_int(RFC_TID_LN, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u_chars_found); + __pyx_t_5 += 14; + __Pyx_GIVEREF(__pyx_kp_u_chars_found); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_chars_found); + __pyx_t_13 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1409, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_13, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__20); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__20); + PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__20); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_5, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1409, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":745 - * if rc != RFC_OK: - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) # <<<<<<<<<<<<<< - * utf8[result_len] = 0 - * try: + /* "pyrfc/_cyrfc.pyx":1408 + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + * elif bg is False: + * if len(unit_id) != RFC_TID_LN: # <<<<<<<<<<<<<< + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") + * if attributes is not None: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_utf8_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_uclen); - __Pyx_GIVEREF(__pyx_v_uclen); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_uclen); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_wrapString_uclen_u_utf8_size_u, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 745, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(4, 745, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":743 - * cdef unsigned result_len = 0 - * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + /* "pyrfc/_cyrfc.pyx":1410 + * if len(unit_id) != RFC_TID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") + * if attributes is not None: # <<<<<<<<<<<<<< + * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") + * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: */ - } + __pyx_t_3 = (__pyx_v_attributes != Py_None); + __pyx_t_1 = (__pyx_t_3 != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":746 - * # raise wrapError(&errorInfo) - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) - * utf8[result_len] = 0 # <<<<<<<<<<<<<< - * try: - * if rstrip: + /* "pyrfc/_cyrfc.pyx":1411 + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") + * if attributes is not None: + * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") # <<<<<<<<<<<<<< + * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: + * self._create_and_submit_transaction(unit_id, calls) */ - (__pyx_v_utf8[__pyx_v_result_len]) = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_Argument_attributes_not_valid_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Argument_attributes_not_valid_t); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1411, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":747 - * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) - * utf8[result_len] = 0 - * try: # <<<<<<<<<<<<<< - * if rstrip: - * return utf8[:result_len].rstrip().decode() + /* "pyrfc/_cyrfc.pyx":1410 + * if len(unit_id) != RFC_TID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") + * if attributes is not None: # <<<<<<<<<<<<<< + * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") + * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: */ - /*try:*/ { + } - /* "src/pyrfc/data_container.pyx":748 - * utf8[result_len] = 0 - * try: - * if rstrip: # <<<<<<<<<<<<<< - * return utf8[:result_len].rstrip().decode() - * else: + /* "pyrfc/_cyrfc.pyx":1412 + * if attributes is not None: + * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") + * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: # <<<<<<<<<<<<<< + * self._create_and_submit_transaction(unit_id, calls) + * unit['queued'] = False */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rstrip); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 748, __pyx_L7_error) - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_queue_names == Py_None); + __pyx_t_2 = (__pyx_t_3 != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_queue_names)) == ((PyObject *)(&PyList_Type))); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_5 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1412, __pyx_L1_error) + __pyx_t_3 = ((__pyx_t_5 == 0) != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L22_bool_binop_done:; + if (__pyx_t_1) { - /* "src/pyrfc/data_container.pyx":749 - * try: - * if rstrip: - * return utf8[:result_len].rstrip().decode() # <<<<<<<<<<<<<< - * else: - * return utf8[:result_len].decode() + /* "pyrfc/_cyrfc.pyx":1413 + * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") + * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: + * self._create_and_submit_transaction(unit_id, calls) # <<<<<<<<<<<<<< + * unit['queued'] = False + * elif len(queue_names) == 1: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_utf8 + 0, __pyx_v_result_len - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 749, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 749, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_and_submit_transaction); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + __pyx_t_14 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_14 = 1; } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 749, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 749, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_unit_id, __pyx_v_calls}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1413, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_unit_id, __pyx_v_calls}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1413, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + { + __pyx_t_9 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__pyx_t_8) { + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; } + __Pyx_INCREF(__pyx_v_unit_id); + __Pyx_GIVEREF(__pyx_v_unit_id); + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_14, __pyx_v_unit_id); + __Pyx_INCREF(__pyx_v_calls); + __Pyx_GIVEREF(__pyx_v_calls); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_14, __pyx_v_calls); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 749, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L6_return; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/data_container.pyx":748 - * utf8[result_len] = 0 - * try: - * if rstrip: # <<<<<<<<<<<<<< - * return utf8[:result_len].rstrip().decode() - * else: + /* "pyrfc/_cyrfc.pyx":1414 + * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: + * self._create_and_submit_transaction(unit_id, calls) + * unit['queued'] = False # <<<<<<<<<<<<<< + * elif len(queue_names) == 1: + * queue_name = queue_names[0] */ - } + if (unlikely(PyObject_SetItem(__pyx_v_unit, __pyx_n_s_queued, Py_False) < 0)) __PYX_ERR(0, 1414, __pyx_L1_error) - /* "src/pyrfc/data_container.pyx":751 - * return utf8[:result_len].rstrip().decode() - * else: - * return utf8[:result_len].decode() # <<<<<<<<<<<<<< - * finally: - * free(utf8) + /* "pyrfc/_cyrfc.pyx":1412 + * if attributes is not None: + * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") + * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: # <<<<<<<<<<<<<< + * self._create_and_submit_transaction(unit_id, calls) + * unit['queued'] = False */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_utf8, 0, __pyx_v_result_len, NULL, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 751, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L6_return; + goto __pyx_L21; } - } - /* "src/pyrfc/data_container.pyx":753 - * return utf8[:result_len].decode() - * finally: - * free(utf8) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1415 + * self._create_and_submit_transaction(unit_id, calls) + * unit['queued'] = False + * elif len(queue_names) == 1: # <<<<<<<<<<<<<< + * queue_name = queue_names[0] + * self._create_and_submit_transaction(unit_id, calls, queue_name) */ - /*finally:*/ { - __pyx_L7_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_15); - __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename; - { - free(__pyx_v_utf8); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); - } - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12); - __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; - __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9; - goto __pyx_L1_error; - } - __pyx_L6_return: { - __pyx_t_15 = __pyx_r; - __pyx_r = 0; - free(__pyx_v_utf8); - __pyx_r = __pyx_t_15; - __pyx_t_15 = 0; - goto __pyx_L0; - } - } + __pyx_t_5 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1415, __pyx_L1_error) + __pyx_t_1 = ((__pyx_t_5 == 1) != 0); + if (likely(__pyx_t_1)) { - /* "src/pyrfc/data_container.pyx":731 - * free(utf8) - * - * cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":1416 + * unit['queued'] = False + * elif len(queue_names) == 1: + * queue_name = queue_names[0] # <<<<<<<<<<<<<< + * self._create_and_submit_transaction(unit_id, calls, queue_name) + * unit['queued'] = True */ + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_queue_names, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_queue_name = __pyx_t_4; + __pyx_t_4 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pyrfc._cyrfc.wrapString", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_uclen); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":81 - * - * @property - * def version(self): # <<<<<<<<<<<<<< - * """Get SAP NW RFC SDK and PyRFC binding versions - * :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version + /* "pyrfc/_cyrfc.pyx":1417 + * elif len(queue_names) == 1: + * queue_name = queue_names[0] + * self._create_and_submit_transaction(unit_id, calls, queue_name) # <<<<<<<<<<<<<< + * unit['queued'] = True + * else: */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_and_submit_transaction); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + __pyx_t_14 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_14 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_name}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1417, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_name}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1417, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + { + __pyx_t_8 = PyTuple_New(3+__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_INCREF(__pyx_v_unit_id); + __Pyx_GIVEREF(__pyx_v_unit_id); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_14, __pyx_v_unit_id); + __Pyx_INCREF(__pyx_v_calls); + __Pyx_GIVEREF(__pyx_v_calls); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_14, __pyx_v_calls); + __Pyx_INCREF(__pyx_v_queue_name); + __Pyx_GIVEREF(__pyx_v_queue_name); + PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_14, __pyx_v_queue_name); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7version_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7version_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_7version___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_7version___get__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - unsigned int __pyx_v_major; - unsigned int __pyx_v_minor; - unsigned int __pyx_v_patchlevel; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "pyrfc/_cyrfc.pyx":1418 + * queue_name = queue_names[0] + * self._create_and_submit_transaction(unit_id, calls, queue_name) + * unit['queued'] = True # <<<<<<<<<<<<<< + * else: + * raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") + */ + if (unlikely(PyObject_SetItem(__pyx_v_unit, __pyx_n_s_queued, Py_True) < 0)) __PYX_ERR(0, 1418, __pyx_L1_error) - /* "src/pyrfc/client.pyx":85 - * :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version - * """ - * cdef unsigned major = 0 # <<<<<<<<<<<<<< - * cdef unsigned minor = 0 - * cdef unsigned patchlevel = 0 + /* "pyrfc/_cyrfc.pyx":1415 + * self._create_and_submit_transaction(unit_id, calls) + * unit['queued'] = False + * elif len(queue_names) == 1: # <<<<<<<<<<<<<< + * queue_name = queue_names[0] + * self._create_and_submit_transaction(unit_id, calls, queue_name) */ - __pyx_v_major = 0; + goto __pyx_L21; + } - /* "src/pyrfc/client.pyx":86 - * """ - * cdef unsigned major = 0 - * cdef unsigned minor = 0 # <<<<<<<<<<<<<< - * cdef unsigned patchlevel = 0 - * RfcGetVersion(&major, &minor, &patchlevel) + /* "pyrfc/_cyrfc.pyx":1420 + * unit['queued'] = True + * else: + * raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") # <<<<<<<<<<<<<< + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") */ - __pyx_v_minor = 0; + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_Argument_queue_names_not_valid_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Argument_queue_names_not_valid_t); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1420, __pyx_L1_error) + } + __pyx_L21:; - /* "src/pyrfc/client.pyx":87 - * cdef unsigned major = 0 - * cdef unsigned minor = 0 - * cdef unsigned patchlevel = 0 # <<<<<<<<<<<<<< - * RfcGetVersion(&major, &minor, &patchlevel) - * return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} + /* "pyrfc/_cyrfc.pyx":1407 + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + * elif bg is False: # <<<<<<<<<<<<<< + * if len(unit_id) != RFC_TID_LN: + * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") */ - __pyx_v_patchlevel = 0; + goto __pyx_L17; + } - /* "src/pyrfc/client.pyx":88 - * cdef unsigned minor = 0 - * cdef unsigned patchlevel = 0 - * RfcGetVersion(&major, &minor, &patchlevel) # <<<<<<<<<<<<<< - * return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} + /* "pyrfc/_cyrfc.pyx":1422 + * raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< + * return unit * */ - (void)(RfcGetVersion((&__pyx_v_major), (&__pyx_v_minor), (&__pyx_v_patchlevel))); + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1422, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Argument_unit_not_valid_Is_unit); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1422, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1422, __pyx_L1_error) + } + __pyx_L17:; - /* "src/pyrfc/client.pyx":89 - * cdef unsigned patchlevel = 0 - * RfcGetVersion(&major, &minor, &patchlevel) - * return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1423 + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + * return unit # <<<<<<<<<<<<<< * - * @property + * def get_unit_state(self, unit): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_major); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_major, __pyx_t_2) < 0) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_minor); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_minor, __pyx_t_2) < 0) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_patchlevel); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_patchLevel, __pyx_t_2) < 0) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_platform); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_platform, __pyx_t_2) < 0) __PYX_ERR(2, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_v_unit); + __pyx_r = __pyx_v_unit; goto __pyx_L0; - /* "src/pyrfc/client.pyx":81 + /* "pyrfc/_cyrfc.pyx":1334 + * return {'background': background, 'id': id, "queued": False} + * + * def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< + * """ Fills a unit with one or more RFC and submits it to the backend. * - * @property - * def version(self): # <<<<<<<<<<<<<< - * """Get SAP NW RFC SDK and PyRFC binding versions - * :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.fill_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_func_name); + __Pyx_XDECREF(__pyx_v_params); + __Pyx_XDECREF(__pyx_v_bg); + __Pyx_XDECREF(__pyx_v_unit_id); + __Pyx_XDECREF(__pyx_v_queue_name); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":92 +/* "pyrfc/_cyrfc.pyx":1425 + * return unit * - * @property - * def options(self): # <<<<<<<<<<<<<< - * """Client connection configuration + * def get_unit_state(self, unit): # <<<<<<<<<<<<<< + * """Retrieves the processing status of the given background unit. * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7options_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7options_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_63get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_62get_unit_state[] = "Retrieves the processing status of the given background unit.\n\n .. note::\n Only available for background units.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :return: The state of the current bgRFC unit. Possible values are:\n RFC_UNIT_NOT_FOUND\n RFC_UNIT_IN_PROCESS\n RFC_UNIT_COMMITTED\n RFC_UNIT_ROLLED_BACK\n RFC_UNIT_CONFIRMED\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_63get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_7options___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("get_unit_state (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_62get_unit_state(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_7options___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_62get_unit_state(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { + PyObject *__pyx_v_bg = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_unit_state", 0); - /* "src/pyrfc/client.pyx":99 - * :type: dict + /* "pyrfc/_cyrfc.pyx":1440 + * RFC_UNIT_CONFIRMED * """ - * return self.__config # <<<<<<<<<<<<<< - * - * @property + * bg = unit['background'] # <<<<<<<<<<<<<< + * if bg is True: + * return self._get_unit_state(unit) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__config); - __pyx_r = __pyx_v_self->__config; - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bg = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":92 - * - * @property - * def options(self): # <<<<<<<<<<<<<< - * """Client connection configuration - * + /* "pyrfc/_cyrfc.pyx":1441 + * """ + * bg = unit['background'] + * if bg is True: # <<<<<<<<<<<<<< + * return self._get_unit_state(unit) + * elif bg is False: */ + __pyx_t_2 = (__pyx_v_bg == Py_True); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":1442 + * bg = unit['background'] + * if bg is True: + * return self._get_unit_state(unit) # <<<<<<<<<<<<<< + * elif bg is False: + * raise RFCError("No state check possible of non-bgRFC units.") + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_unit_state); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_unit); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; -/* "src/pyrfc/client.pyx":102 - * - * @property - * def handle(self): # <<<<<<<<<<<<<< - * """Get client connection handle - * + /* "pyrfc/_cyrfc.pyx":1441 + * """ + * bg = unit['background'] + * if bg is True: # <<<<<<<<<<<<<< + * return self._get_unit_state(unit) + * elif bg is False: */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_6handle_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_6handle_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_6handle___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + /* "pyrfc/_cyrfc.pyx":1443 + * if bg is True: + * return self._get_unit_state(unit) + * elif bg is False: # <<<<<<<<<<<<<< + * raise RFCError("No state check possible of non-bgRFC units.") + * else: + */ + __pyx_t_3 = (__pyx_v_bg == Py_False); + __pyx_t_2 = (__pyx_t_3 != 0); + if (unlikely(__pyx_t_2)) { - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":1444 + * return self._get_unit_state(unit) + * elif bg is False: + * raise RFCError("No state check possible of non-bgRFC units.") # <<<<<<<<<<<<<< + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_No_state_check_possible_of_non_b) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_No_state_check_possible_of_non_b); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1444, __pyx_L1_error) -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_6handle___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "pyrfc/_cyrfc.pyx":1443 + * if bg is True: + * return self._get_unit_state(unit) + * elif bg is False: # <<<<<<<<<<<<<< + * raise RFCError("No state check possible of non-bgRFC units.") + * else: + */ + } - /* "src/pyrfc/client.pyx":108 - * :type: uintptr_t - * """ - * return self._handle if self._handle is not NULL else None # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1446 + * raise RFCError("No state check possible of non-bgRFC units.") + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< * - * @property + * def destroy_unit(self, unit): */ - __Pyx_XDECREF(__pyx_r); - if (((__pyx_v_self->_handle != NULL) != 0)) { - __pyx_t_2 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __pyx_t_2; - __pyx_t_2 = 0; - } else { - __Pyx_INCREF(Py_None); - __pyx_t_1 = Py_None; + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_unit_not_valid_Is_unit); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1446, __pyx_L1_error) } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - /* "src/pyrfc/client.pyx":102 + /* "pyrfc/_cyrfc.pyx":1425 + * return unit * - * @property - * def handle(self): # <<<<<<<<<<<<<< - * """Get client connection handle + * def get_unit_state(self, unit): # <<<<<<<<<<<<<< + * """Retrieves the processing status of the given background unit. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.get_unit_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_bg); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":111 +/* "pyrfc/_cyrfc.pyx":1448 + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") * - * @property - * def alive(self): # <<<<<<<<<<<<<< - * """Conection alive property + * def destroy_unit(self, unit): # <<<<<<<<<<<<<< + * """ Destroy the current unit. * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5alive_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5alive_1__get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_65destroy_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_64destroy_unit[] = " Destroy the current unit.\n\n E.g. if the completed unit could not be recorded in the frontend.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection attempt fails.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_65destroy_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_5alive___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("destroy_unit (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_64destroy_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_5alive___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_64destroy_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { + PyObject *__pyx_v_bg = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("destroy_unit", 0); - /* "src/pyrfc/client.pyx":117 - * :type: boolean + /* "pyrfc/_cyrfc.pyx":1458 + * thereof if the connection attempt fails. * """ - * return self._handle != NULL # <<<<<<<<<<<<<< - * - * def __init__(self, config=None, **params): + * bg = unit['background'] # <<<<<<<<<<<<<< + * if bg is True: + * self._destroy_unit() */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_handle != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 117, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_v_bg = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L0; - /* "src/pyrfc/client.pyx":111 - * - * @property - * def alive(self): # <<<<<<<<<<<<<< - * """Conection alive property - * + /* "pyrfc/_cyrfc.pyx":1459 + * """ + * bg = unit['background'] + * if bg is True: # <<<<<<<<<<<<<< + * self._destroy_unit() + * elif bg is False: */ + __pyx_t_2 = (__pyx_v_bg == Py_True); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.alive.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":119 - * return self._handle != NULL - * - * def __init__(self, config=None, **params): # <<<<<<<<<<<<<< - * # check and set connection configuration - * config = config or {} + /* "pyrfc/_cyrfc.pyx":1460 + * bg = unit['background'] + * if bg is True: + * self._destroy_unit() # <<<<<<<<<<<<<< + * elif bg is False: + * self._destroy_transaction() */ - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_config = 0; - PyObject *__pyx_v_params = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_v_params = PyDict_New(); if (unlikely(!__pyx_v_params)) return -1; - __Pyx_GOTREF(__pyx_v_params); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_config,0}; - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_config); - if (value) { values[0] = value; kw_args--; } - } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy_unit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_params, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 119, __pyx_L3_error) + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1460, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":1459 + * """ + * bg = unit['background'] + * if bg is True: # <<<<<<<<<<<<<< + * self._destroy_unit() + * elif bg is False: + */ + goto __pyx_L3; + } + + /* "pyrfc/_cyrfc.pyx":1461 + * if bg is True: + * self._destroy_unit() + * elif bg is False: # <<<<<<<<<<<<<< + * self._destroy_transaction() + * else: + */ + __pyx_t_3 = (__pyx_v_bg == Py_False); + __pyx_t_2 = (__pyx_t_3 != 0); + if (likely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":1462 + * self._destroy_unit() + * elif bg is False: + * self._destroy_transaction() # <<<<<<<<<<<<<< + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy_transaction); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":1461 + * if bg is True: + * self._destroy_unit() + * elif bg is False: # <<<<<<<<<<<<<< + * self._destroy_transaction() + * else: + */ + goto __pyx_L3; + } + + /* "pyrfc/_cyrfc.pyx":1464 + * self._destroy_transaction() + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< + * + * def confirm_unit(self, unit): + */ + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_v_config = values[0]; + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_unit_not_valid_Is_unit); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1464, __pyx_L1_error) } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 119, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_params); __pyx_v_params = 0; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L3:; + + /* "pyrfc/_cyrfc.pyx":1448 + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + * + * def destroy_unit(self, unit): # <<<<<<<<<<<<<< + * """ Destroy the current unit. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.destroy_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_bg); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection___init__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_config, __pyx_v_params); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1466 + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + * + * def confirm_unit(self, unit): # <<<<<<<<<<<<<< + * """ Confirm the current unit in the backend. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_67confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_66confirm_unit[] = " Confirm the current unit in the backend.\n\n This also destroys the unit.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection attempt fails.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_67confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("confirm_unit (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_66confirm_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_params); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5pyrfc_6_cyrfc_10Connection___init__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_config, PyObject *__pyx_v_params) { - PyObject *__pyx_v_k = NULL; - int __pyx_r; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_66confirm_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { + PyObject *__pyx_v_bg = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - Py_UCS4 __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - unsigned int __pyx_t_12; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - __Pyx_INCREF(__pyx_v_config); + __Pyx_RefNannySetupContext("confirm_unit", 0); - /* "src/pyrfc/client.pyx":121 - * def __init__(self, config=None, **params): - * # check and set connection configuration - * config = config or {} # <<<<<<<<<<<<<< - * for k in config: - * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: + /* "pyrfc/_cyrfc.pyx":1476 + * thereof if the connection attempt fails. + * """ + * bg = unit['background'] # <<<<<<<<<<<<<< + * if bg is True: + * self._confirm_unit(unit) */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_config); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 121, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __Pyx_INCREF(__pyx_v_config); - __pyx_t_1 = __pyx_v_config; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_L3_bool_binop_done:; - __Pyx_DECREF_SET(__pyx_v_config, __pyx_t_1); + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1476, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_bg = __pyx_t_1; __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":122 - * # check and set connection configuration - * config = config or {} - * for k in config: # <<<<<<<<<<<<<< - * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: - * raise RFCError(f"Connection configuration option '{k}' is not supported") - */ - if (likely(PyList_CheckExact(__pyx_v_config)) || PyTuple_CheckExact(__pyx_v_config)) { - __pyx_t_1 = __pyx_v_config; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 122, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(2, 122, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(2, 122, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_5(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 122, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3); - __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":123 - * config = config or {} - * for k in config: - * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: # <<<<<<<<<<<<<< - * raise RFCError(f"Connection configuration option '{k}' is not supported") - * self.__config = {} + /* "pyrfc/_cyrfc.pyx":1477 + * """ + * bg = unit['background'] + * if bg is True: # <<<<<<<<<<<<<< + * self._confirm_unit(unit) + * elif bg is False: */ - __Pyx_INCREF(__pyx_v_k); - __pyx_t_3 = __pyx_v_k; - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_dtime, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 123, __pyx_L1_error) - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_return_import_params, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 123, __pyx_L1_error) - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_rstrip, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 123, __pyx_L1_error) - if (__pyx_t_6) { - } else { - __pyx_t_2 = __pyx_t_6; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_timeout, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 123, __pyx_L1_error) - __pyx_t_2 = __pyx_t_6; - __pyx_L8_bool_binop_done:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = (__pyx_t_2 != 0); - if (unlikely(__pyx_t_6)) { + __pyx_t_2 = (__pyx_v_bg == Py_True); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":124 - * for k in config: - * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: - * raise RFCError(f"Connection configuration option '{k}' is not supported") # <<<<<<<<<<<<<< - * self.__config = {} - * self.__config['dtime'] = config.get('dtime', False) + /* "pyrfc/_cyrfc.pyx":1478 + * bg = unit['background'] + * if bg is True: + * self._confirm_unit(unit) # <<<<<<<<<<<<<< + * elif bg is False: + * self._confirm_transaction() */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = 0; - __pyx_t_10 = 127; - __Pyx_INCREF(__pyx_kp_u_Connection_configuration_option); - __pyx_t_9 += 33; - __Pyx_GIVEREF(__pyx_kp_u_Connection_configuration_option); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Connection_configuration_option); - __pyx_t_11 = __Pyx_PyObject_FormatSimple(__pyx_v_k, __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_10; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_11); - __pyx_t_11 = 0; - __Pyx_INCREF(__pyx_kp_u_is_not_supported); - __pyx_t_9 += 18; - __Pyx_GIVEREF(__pyx_kp_u_is_not_supported); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u_is_not_supported); - __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_confirm_unit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1478, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); } - __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_11); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 124, __pyx_L1_error) - - /* "src/pyrfc/client.pyx":123 - * config = config or {} - * for k in config: - * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: # <<<<<<<<<<<<<< - * raise RFCError(f"Connection configuration option '{k}' is not supported") - * self.__config = {} - */ } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_unit); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":122 - * # check and set connection configuration - * config = config or {} - * for k in config: # <<<<<<<<<<<<<< - * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: - * raise RFCError(f"Connection configuration option '{k}' is not supported") + /* "pyrfc/_cyrfc.pyx":1477 + * """ + * bg = unit['background'] + * if bg is True: # <<<<<<<<<<<<<< + * self._confirm_unit(unit) + * elif bg is False: */ + goto __pyx_L3; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":125 - * if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: - * raise RFCError(f"Connection configuration option '{k}' is not supported") - * self.__config = {} # <<<<<<<<<<<<<< - * self.__config['dtime'] = config.get('dtime', False) - * self.__config['return_import_params'] = config.get('return_import_params', False) + /* "pyrfc/_cyrfc.pyx":1479 + * if bg is True: + * self._confirm_unit(unit) + * elif bg is False: # <<<<<<<<<<<<<< + * self._confirm_transaction() + * else: */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__config); - __Pyx_DECREF(__pyx_v_self->__config); - __pyx_v_self->__config = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_v_bg == Py_False); + __pyx_t_2 = (__pyx_t_3 != 0); + if (likely(__pyx_t_2)) { - /* "src/pyrfc/client.pyx":126 - * raise RFCError(f"Connection configuration option '{k}' is not supported") - * self.__config = {} - * self.__config['dtime'] = config.get('dtime', False) # <<<<<<<<<<<<<< - * self.__config['return_import_params'] = config.get('return_import_params', False) - * self.__config['rstrip'] = config.get('rstrip', True) + /* "pyrfc/_cyrfc.pyx":1480 + * self._confirm_unit(unit) + * elif bg is False: + * self._confirm_transaction() # <<<<<<<<<<<<<< + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 126, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_dtime, __pyx_t_3) < 0)) __PYX_ERR(2, 126, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_confirm_transaction); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1480, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":127 - * self.__config = {} - * self.__config['dtime'] = config.get('dtime', False) - * self.__config['return_import_params'] = config.get('return_import_params', False) # <<<<<<<<<<<<<< - * self.__config['rstrip'] = config.get('rstrip', True) - * self.__config['timeout'] = config.get('timeout', None) + /* "pyrfc/_cyrfc.pyx":1479 + * if bg is True: + * self._confirm_unit(unit) + * elif bg is False: # <<<<<<<<<<<<<< + * self._confirm_transaction() + * else: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 127, __pyx_L1_error) + goto __pyx_L3; } - if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_return_import_params, __pyx_t_1) < 0)) __PYX_ERR(2, 127, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":128 - * self.__config['dtime'] = config.get('dtime', False) - * self.__config['return_import_params'] = config.get('return_import_params', False) - * self.__config['rstrip'] = config.get('rstrip', True) # <<<<<<<<<<<<<< - * self.__config['timeout'] = config.get('timeout', None) + /* "pyrfc/_cyrfc.pyx":1482 + * self._confirm_transaction() + * else: + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 128, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_rstrip, __pyx_t_3) < 0)) __PYX_ERR(2, 128, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":129 - * self.__config['return_import_params'] = config.get('return_import_params', False) - * self.__config['rstrip'] = config.get('rstrip', True) - * self.__config['timeout'] = config.get('timeout', None) # <<<<<<<<<<<<<< * - * # set internal configuration */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 129, __pyx_L1_error) + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_unit_not_valid_Is_unit); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1482, __pyx_L1_error) } - if (unlikely(PyDict_SetItem(__pyx_v_self->__config, __pyx_n_s_timeout, __pyx_t_1) < 0)) __PYX_ERR(2, 129, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L3:; - /* "src/pyrfc/client.pyx":132 + /* "pyrfc/_cyrfc.pyx":1466 + * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + * + * def confirm_unit(self, unit): # <<<<<<<<<<<<<< + * """ Confirm the current unit in the backend. * - * # set internal configuration - * self.__bconfig = 0 # <<<<<<<<<<<<<< - * if self.__config['dtime']: - * self.__bconfig |= _MASK_DTIME - */ - __pyx_v_self->__pyx___bconfig = 0; - - /* "src/pyrfc/client.pyx":133 - * # set internal configuration - * self.__bconfig = 0 - * if self.__config['dtime']: # <<<<<<<<<<<<<< - * self.__bconfig |= _MASK_DTIME - * if self.__config['return_import_params']: - */ - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 133, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_dtime); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 133, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - - /* "src/pyrfc/client.pyx":134 - * self.__bconfig = 0 - * if self.__config['dtime']: - * self.__bconfig |= _MASK_DTIME # <<<<<<<<<<<<<< - * if self.__config['return_import_params']: - * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS - */ - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_DTIME); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyNumber_InPlaceOr(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_7); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(2, 134, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_self->__pyx___bconfig = __pyx_t_12; - - /* "src/pyrfc/client.pyx":133 - * # set internal configuration - * self.__bconfig = 0 - * if self.__config['dtime']: # <<<<<<<<<<<<<< - * self.__bconfig |= _MASK_DTIME - * if self.__config['return_import_params']: - */ - } - - /* "src/pyrfc/client.pyx":135 - * if self.__config['dtime']: - * self.__bconfig |= _MASK_DTIME - * if self.__config['return_import_params']: # <<<<<<<<<<<<<< - * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS - * if self.__config['rstrip']: - */ - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 135, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_return_import_params); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 135, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_6) { - - /* "src/pyrfc/client.pyx":136 - * self.__bconfig |= _MASK_DTIME - * if self.__config['return_import_params']: - * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS # <<<<<<<<<<<<<< - * if self.__config['rstrip']: - * self.__bconfig |= _MASK_RSTRIP - */ - __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RETURN_IMPORT_PARAMS); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_InPlaceOr(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(2, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx___bconfig = __pyx_t_12; - - /* "src/pyrfc/client.pyx":135 - * if self.__config['dtime']: - * self.__bconfig |= _MASK_DTIME - * if self.__config['return_import_params']: # <<<<<<<<<<<<<< - * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS - * if self.__config['rstrip']: - */ - } - - /* "src/pyrfc/client.pyx":137 - * if self.__config['return_import_params']: - * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS - * if self.__config['rstrip']: # <<<<<<<<<<<<<< - * self.__bconfig |= _MASK_RSTRIP - * - */ - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 137, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 137, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { - - /* "src/pyrfc/client.pyx":138 - * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS - * if self.__config['rstrip']: - * self.__bconfig |= _MASK_RSTRIP # <<<<<<<<<<<<<< - * - * self._connection = ConnectionParameters(**params) - */ - __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyNumber_InPlaceOr(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_7); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_self->__pyx___bconfig = __pyx_t_12; - - /* "src/pyrfc/client.pyx":137 - * if self.__config['return_import_params']: - * self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS - * if self.__config['rstrip']: # <<<<<<<<<<<<<< - * self.__bconfig |= _MASK_RSTRIP - * - */ - } - - /* "src/pyrfc/client.pyx":140 - * self.__bconfig |= _MASK_RSTRIP - * - * self._connection = ConnectionParameters(**params) # <<<<<<<<<<<<<< - * self._handle = NULL - * self.active_transaction = False - */ - __pyx_t_7 = PyDict_Copy(__pyx_v_params); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_ConnectionParameters), __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_connection); - __Pyx_DECREF(((PyObject *)__pyx_v_self->_connection)); - __pyx_v_self->_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_t_3); - __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":141 - * - * self._connection = ConnectionParameters(**params) - * self._handle = NULL # <<<<<<<<<<<<<< - * self.active_transaction = False - * self.active_unit = False - */ - __pyx_v_self->_handle = NULL; - - /* "src/pyrfc/client.pyx":142 - * self._connection = ConnectionParameters(**params) - * self._handle = NULL - * self.active_transaction = False # <<<<<<<<<<<<<< - * self.active_unit = False - * self._open() - */ - __pyx_v_self->active_transaction = 0; - - /* "src/pyrfc/client.pyx":143 - * self._handle = NULL - * self.active_transaction = False - * self.active_unit = False # <<<<<<<<<<<<<< - * self._open() - * - */ - __pyx_v_self->active_unit = 0; - - /* "src/pyrfc/client.pyx":144 - * self.active_transaction = False - * self.active_unit = False - * self._open() # <<<<<<<<<<<<<< - * - * def free(self): - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 144, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":119 - * return self._handle != NULL - * - * def __init__(self, config=None, **params): # <<<<<<<<<<<<<< - * # check and set connection configuration - * config = config or {} */ /* function exit code */ - __pyx_r = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.confirm_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_k); - __Pyx_XDECREF(__pyx_v_config); + __Pyx_XDECREF(__pyx_v_bg); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":146 - * self._open() - * - * def free(self): # <<<<<<<<<<<<<< - * """ Explicitly free connection parameters and close the connection. - * +/* "pyrfc/_cyrfc.pyx":545 + * """ + * cdef unsigned __bconfig + * cdef public dict __config # <<<<<<<<<<<<<< + * cdef bint active_transaction + * cdef bint active_unit */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_2free[] = " Explicitly free connection parameters and close the connection.\n\n Note that this is usually required because the object destruction\n can be delayed by the garbage collection and problems may occur\n when too many connections are opened.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("free (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_2free(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_2free(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__config); + __pyx_r = __pyx_v_self->__config; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("free", 0); - - /* "src/pyrfc/client.pyx":153 - * when too many connections are opened. - * """ - * self.__del__() # <<<<<<<<<<<<<< - * - * def __del__(self): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_del); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":146 - * self._open() - * - * def free(self): # <<<<<<<<<<<<<< - * """ Explicitly free connection parameters and close the connection. - * - */ + __Pyx_RefNannySetupContext("__set__", 0); + if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 545, __pyx_L1_error) + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__config); + __Pyx_DECREF(__pyx_v_self->__config); + __pyx_v_self->__config = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.free", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__config.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":155 - * self.__del__() - * - * def __del__(self): # <<<<<<<<<<<<<< - * self._close() - * self._connection._free() +/* Python wrapper */ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_5__del__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_5__del__(PyObject *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_4__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_4__del__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->__config); + __Pyx_DECREF(__pyx_v_self->__config); + __pyx_v_self->__config = ((PyObject*)Py_None); + + /* function exit code */ + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_5__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_69__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_69__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_4__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_68__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_4__del__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_68__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__del__", 0); - - /* "src/pyrfc/client.pyx":156 - * - * def __del__(self): - * self._close() # <<<<<<<<<<<<<< - * self._connection._free() - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/pyrfc/client.pyx":157 - * def __del__(self): - * self._close() - * self._connection._free() # <<<<<<<<<<<<<< - * - * def __enter__(self): + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_connection), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 157, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/pyrfc/client.pyx":155 - * self.__del__() - * - * def __del__(self): # <<<<<<<<<<<<<< - * self._close() - * self._connection._free() + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":159 - * self._connection._free() - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self - * +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_71__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_71__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_6__enter__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_70__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_6__enter__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_70__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/pyrfc/client.pyx":160 - * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< - * - * def __exit__(self, type, value, traceback): + /* "(tree fragment)":4 + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/pyrfc/client.pyx":159 - * self._connection._free() - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self - * + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") */ /* function exit code */ - __pyx_L0:; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":162 - * return self +/* "pyrfc/_cyrfc.pyx":1501 * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * # Although the _close() method is also called in the destructor, the - * # explicit call assures the immediate closing to the connection. + * + * def default_auth_check(func_name=False, request_context = None): # <<<<<<<<<<<<<< + * request_context = request_context or {} + * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_9__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_type = 0; - CYTHON_UNUSED PyObject *__pyx_v_value = 0; - CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_17default_auth_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_17default_auth_check = {"default_auth_check", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_17default_auth_check, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_17default_auth_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_func_name = 0; + PyObject *__pyx_v_request_context = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + __Pyx_RefNannySetupContext("default_auth_check (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_request_context,0}; + PyObject* values[2] = {0,0}; + values[0] = ((PyObject *)Py_False); + values[1] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 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); @@ -19742,221 +17873,407 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_9__exit__(PyObject *__pyx_ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(2, 162, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_func_name); + if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(2, 162, __pyx_L3_error) + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_request_context); + if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(2, 162, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_auth_check") < 0)) __PYX_ERR(0, 1501, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - 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); + switch (PyTuple_GET_SIZE(__pyx_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; + } } - __pyx_v_type = values[0]; - __pyx_v_value = values[1]; - __pyx_v_traceback = values[2]; + __pyx_v_func_name = values[0]; + __pyx_v_request_context = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 162, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("default_auth_check", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1501, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.default_auth_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__exit__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16default_auth_check(__pyx_self, __pyx_v_func_name, __pyx_v_request_context); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_8__exit__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16default_auth_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_request_context) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + Py_UCS4 __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__exit__", 0); + __Pyx_RefNannySetupContext("default_auth_check", 0); + __Pyx_INCREF(__pyx_v_request_context); - /* "src/pyrfc/client.pyx":165 - * # Although the _close() method is also called in the destructor, the - * # explicit call assures the immediate closing to the connection. - * self._close() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1502 * - * def open(self): + * def default_auth_check(func_name=False, request_context = None): + * request_context = request_context or {} # <<<<<<<<<<<<<< + * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) + * return RFC_OK */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_request_context); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1502, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __Pyx_INCREF(__pyx_v_request_context); + __pyx_t_1 = __pyx_v_request_context; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1502, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3_bool_binop_done:; + __Pyx_DECREF_SET(__pyx_v_request_context, __pyx_t_1); + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":1503 + * def default_auth_check(func_name=False, request_context = None): + * request_context = request_context or {} + * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) # <<<<<<<<<<<<<< + * return RFC_OK + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_6 = 127; + __Pyx_INCREF(__pyx_kp_u_authorization_check_for); + __pyx_t_5 += 25; + __Pyx_GIVEREF(__pyx_kp_u_authorization_check_for); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_authorization_check_for); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_5 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_request_context, __pyx_n_s_server_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = NULL; + __pyx_t_9 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_9 = 1; } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__pyx_t_8) { + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; + } + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_4); + __pyx_t_7 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":162 - * return self + /* "pyrfc/_cyrfc.pyx":1504 + * request_context = request_context or {} + * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) + * return RFC_OK # <<<<<<<<<<<<<< * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * # Although the _close() method is also called in the destructor, the - * # explicit call assures the immediate closing to the connection. + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_RFC_RC(RFC_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1504, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":1501 + * + * + * def default_auth_check(func_name=False, request_context = None): # <<<<<<<<<<<<<< + * request_context = request_context or {} + * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("pyrfc._cyrfc.default_auth_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_request_context); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":167 - * self._close() +/* "pyrfc/_cyrfc.pyx":1507 * - * def open(self): # <<<<<<<<<<<<<< - * """ Open client the connection * + * def _server_log(origin, log_message): # <<<<<<<<<<<<<< + * if server_context["server_log"]: + * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_11open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_10open[] = " Open client the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be opened.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_11open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19_server_log(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_19_server_log = {"_server_log", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_19_server_log, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_19_server_log(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_origin = 0; + PyObject *__pyx_v_log_message = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("open (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_10open(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("_server_log (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_origin,&__pyx_n_s_log_message,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_origin)) != 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_log_message)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_server_log", 1, 2, 2, 1); __PYX_ERR(0, 1507, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_server_log") < 0)) __PYX_ERR(0, 1507, __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_origin = values[0]; + __pyx_v_log_message = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_server_log", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1507, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc._server_log", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_18_server_log(__pyx_self, __pyx_v_origin, __pyx_v_log_message); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_10open(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_18_server_log(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_origin, PyObject *__pyx_v_log_message) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_UCS4 __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("open", 0); + __Pyx_RefNannySetupContext("_server_log", 0); - /* "src/pyrfc/client.pyx":173 - * thereof if the connection cannot be opened. - * """ - * self._open() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1508 + * + * def _server_log(origin, log_message): + * if server_context["server_log"]: # <<<<<<<<<<<<<< + * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") * - * def reopen(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 173, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_server_log_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1508, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":167 - * self._close() + /* "pyrfc/_cyrfc.pyx":1509 + * def _server_log(origin, log_message): + * if server_context["server_log"]: + * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") # <<<<<<<<<<<<<< * - * def open(self): # <<<<<<<<<<<<<< - * """ Open client the connection * */ + __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u__23); + __pyx_t_4 += 1; + __Pyx_GIVEREF(__pyx_kp_u__23); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__23); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utcnow); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u_UTC); + __pyx_t_4 += 6; + __Pyx_GIVEREF(__pyx_kp_u_UTC); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_UTC); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_origin, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__24); + __pyx_t_4 += 2; + __Pyx_GIVEREF(__pyx_kp_u__24); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__24); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_log_message, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_4 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 7, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PrintOne(0, __pyx_t_7) < 0) __PYX_ERR(0, 1509, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.open", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":175 - * self._open() - * - * def reopen(self): # <<<<<<<<<<<<<< - * """ Re-open client the connection + /* "pyrfc/_cyrfc.pyx":1508 * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_13reopen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_12reopen[] = " Re-open client the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be re-opened.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_13reopen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reopen (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_12reopen(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_12reopen(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("reopen", 0); - - /* "src/pyrfc/client.pyx":181 - * thereof if the connection cannot be re-opened. - * """ - * self._reopen() # <<<<<<<<<<<<<< + * def _server_log(origin, log_message): + * if server_context["server_log"]: # <<<<<<<<<<<<<< + * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") * - * def close(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_reopen(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } - /* "src/pyrfc/client.pyx":175 - * self._open() + /* "pyrfc/_cyrfc.pyx":1507 * - * def reopen(self): # <<<<<<<<<<<<<< - * """ Re-open client the connection * + * def _server_log(origin, log_message): # <<<<<<<<<<<<<< + * if server_context["server_log"]: + * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") */ /* function exit code */ @@ -19964,7 +18281,10 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_12reopen(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.reopen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pyrfc._cyrfc._server_log", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -19972,362 +18292,158 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_12reopen(struct __pyx_obj_ return __pyx_r; } -/* "src/pyrfc/client.pyx":183 - * self._reopen() - * - * def close(self): # <<<<<<<<<<<<<< - * """ Close the connection +/* "pyrfc/_cyrfc.pyx":1518 + * cdef public bint rstrip * + * def __init__(self, **params): # <<<<<<<<<<<<<< + * self._connection = ConnectionParameters(**params) + * self._handle = NULL */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_14close[] = " Close the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be closed cleanly.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_params = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_14close(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1; + __pyx_v_params = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_params)) return -1; + __Pyx_GOTREF(__pyx_v_params); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection___init__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), __pyx_v_params); /* function exit code */ + __Pyx_XDECREF(__pyx_v_params); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_14close(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection___init__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, PyObject *__pyx_v_params) { + int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("close", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "src/pyrfc/client.pyx":189 - * thereof if the connection cannot be closed cleanly. - * """ - * self._close() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1519 * - * def cancel(self): + * def __init__(self, **params): + * self._connection = ConnectionParameters(**params) # <<<<<<<<<<<<<< + * self._handle = NULL + * self._open() */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 189, __pyx_L1_error) + __pyx_t_1 = PyDict_Copy(__pyx_v_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_ConnectionParameters), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->_connection); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_connection)); + __pyx_v_self->_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":183 - * self._reopen() + /* "pyrfc/_cyrfc.pyx":1520 + * def __init__(self, **params): + * self._connection = ConnectionParameters(**params) + * self._handle = NULL # <<<<<<<<<<<<<< + * self._open() * - * def close(self): # <<<<<<<<<<<<<< - * """ Close the connection + */ + __pyx_v_self->_handle = NULL; + + /* "pyrfc/_cyrfc.pyx":1521 + * self._connection = ConnectionParameters(**params) + * self._handle = NULL + * self._open() # <<<<<<<<<<<<<< + * + * cdef _open(self): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":1518 + * cdef public bint rstrip * + * def __init__(self, **params): # <<<<<<<<<<<<<< + * self._connection = ConnectionParameters(**params) + * self._handle = NULL */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":191 - * self._close() - * - * def cancel(self): # <<<<<<<<<<<<<< - * """ Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function +/* "pyrfc/_cyrfc.pyx":1523 + * self._open() * + * cdef _open(self): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * with nogil: */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_17cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_16cancel[] = " Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be cancelled cleanly.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_17cancel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("cancel (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_16cancel(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_16cancel(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_16ServerConnection__open(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { + RFC_ERROR_INFO __pyx_v_errorInfo; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cancel", 0); + __Pyx_RefNannySetupContext("_open", 0); - /* "src/pyrfc/client.pyx":197 - * thereof if the connection cannot be cancelled cleanly. - * """ - * cancel_connection(self) # <<<<<<<<<<<<<< - * - * def __bool__(self): + /* "pyrfc/_cyrfc.pyx":1525 + * cdef _open(self): + * cdef RFC_ERROR_INFO errorInfo + * with nogil: # <<<<<<<<<<<<<< + * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) + * if errorInfo.code != RFC_OK: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cancel_connection); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self)); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "src/pyrfc/client.pyx":191 - * self._close() - * - * def cancel(self): # <<<<<<<<<<<<<< - * """ Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function - * + /* "pyrfc/_cyrfc.pyx":1526 + * cdef RFC_ERROR_INFO errorInfo + * with nogil: + * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) # <<<<<<<<<<<<<< + * if errorInfo.code != RFC_OK: + * self._handle = NULL */ + __pyx_v_self->_handle = RfcCreateServer(__pyx_v_self->_connection->_params, __pyx_v_self->_connection->_params_count, (&__pyx_v_errorInfo)); + } - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.cancel", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":199 - * cancel_connection(self) - * - * def __bool__(self): # <<<<<<<<<<<<<< - * return self.alive - * - */ - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_19__bool__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_19__bool__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_18__bool__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_18__bool__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__bool__", 0); - - /* "src/pyrfc/client.pyx":200 - * - * def __bool__(self): - * return self.alive # <<<<<<<<<<<<<< - * - * cdef _reopen(self): - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 200, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - goto __pyx_L0; - - /* "src/pyrfc/client.pyx":199 - * cancel_connection(self) - * - * def __bool__(self): # <<<<<<<<<<<<<< - * return self.alive - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":202 - * return self.alive - * - * cdef _reopen(self): # <<<<<<<<<<<<<< - * self._close() - * self._open() - */ - -static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__reopen(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_reopen", 0); - - /* "src/pyrfc/client.pyx":203 - * - * cdef _reopen(self): - * self._close() # <<<<<<<<<<<<<< - * self._open() - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":204 - * cdef _reopen(self): - * self._close() - * self._open() # <<<<<<<<<<<<<< - * - * cdef _open(self): - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":202 - * return self.alive - * - * cdef _reopen(self): # <<<<<<<<<<<<<< - * self._close() - * self._open() - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._reopen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":206 - * self._open() - * - * cdef _open(self): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * with nogil: - */ - -static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__open(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_ERROR_INFO __pyx_v_errorInfo; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_open", 0); - - /* "src/pyrfc/client.pyx":208 - * cdef _open(self): - * cdef RFC_ERROR_INFO errorInfo - * with nogil: # <<<<<<<<<<<<<< - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) - * if not self._handle: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "src/pyrfc/client.pyx":209 - * cdef RFC_ERROR_INFO errorInfo - * with nogil: - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) # <<<<<<<<<<<<<< - * if not self._handle: - * self._error(&errorInfo) - */ - __pyx_v_self->_handle = RfcOpenConnection(__pyx_v_self->_connection->_params, __pyx_v_self->_connection->_params_count, (&__pyx_v_errorInfo)); - } - - /* "src/pyrfc/client.pyx":208 + /* "pyrfc/_cyrfc.pyx":1525 * cdef _open(self): * cdef RFC_ERROR_INFO errorInfo * with nogil: # <<<<<<<<<<<<<< - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) - * if not self._handle: + * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) + * if errorInfo.code != RFC_OK: */ /*finally:*/ { /*normal exit:*/{ @@ -20341,37 +18457,111 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__open(struct __pyx_obj_5pyr } } - /* "src/pyrfc/client.pyx":210 + /* "pyrfc/_cyrfc.pyx":1527 * with nogil: - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) - * if not self._handle: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * + * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * self._handle = NULL + * raise wrapError(&errorInfo) */ - __pyx_t_1 = ((!(__pyx_v_self->_handle != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_1 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/client.pyx":211 - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) - * if not self._handle: - * self._error(&errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1528 + * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) + * if errorInfo.code != RFC_OK: + * self._handle = NULL # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _server_log("Server connection", f"{self._handle}") + */ + __pyx_v_self->_handle = NULL; + + /* "pyrfc/_cyrfc.pyx":1529 + * if errorInfo.code != RFC_OK: + * self._handle = NULL + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _server_log("Server connection", f"{self._handle}") * - * def _close(self): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 211, __pyx_L1_error) + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1529, __pyx_L1_error) - /* "src/pyrfc/client.pyx":210 + /* "pyrfc/_cyrfc.pyx":1527 * with nogil: - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) - * if not self._handle: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * self._handle = NULL + * raise wrapError(&errorInfo) + */ + } + + /* "pyrfc/_cyrfc.pyx":1530 + * self._handle = NULL + * raise wrapError(&errorInfo) + * _server_log("Server connection", f"{self._handle}") # <<<<<<<<<<<<<< * + * cdef _close(self): */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Server_connection, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Server_connection, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Server_connection); + __Pyx_GIVEREF(__pyx_kp_s_Server_connection); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Server_connection); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":206 + /* "pyrfc/_cyrfc.pyx":1523 * self._open() * * cdef _open(self): # <<<<<<<<<<<<<< @@ -20384,7 +18574,11 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__open(struct __pyx_obj_5pyr goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection._open", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20392,112 +18586,176 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__open(struct __pyx_obj_5pyr return __pyx_r; } -/* "src/pyrfc/client.pyx":213 - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1532 + * _server_log("Server connection", f"{self._handle}") * - * def _close(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * cdef _close(self): # <<<<<<<<<<<<<< + * if self._handle != NULL: + * _server_log("Server close", self._handle) */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_21_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_21_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_close (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_20_close(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_20_close(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_16ServerConnection__close(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_close", 0); - /* "src/pyrfc/client.pyx":216 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":1533 + * + * cdef _close(self): * if self._handle != NULL: # <<<<<<<<<<<<<< - * rc = RfcCloseConnection(self._handle, &errorInfo) - * self._handle = NULL + * _server_log("Server close", self._handle) + * with nogil: */ __pyx_t_1 = ((__pyx_v_self->_handle != NULL) != 0); if (__pyx_t_1) { - /* "src/pyrfc/client.pyx":217 - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":1534 + * cdef _close(self): * if self._handle != NULL: - * rc = RfcCloseConnection(self._handle, &errorInfo) # <<<<<<<<<<<<<< - * self._handle = NULL - * if rc != RFC_OK: + * _server_log("Server close", self._handle) # <<<<<<<<<<<<<< + * with nogil: + * RfcShutdownServer(self._handle, 60, NULL) */ - __pyx_v_rc = RfcCloseConnection(__pyx_v_self->_handle, (&__pyx_v_errorInfo)); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Server_close, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1534, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Server_close, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1534, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Server_close); + __Pyx_GIVEREF(__pyx_kp_s_Server_close); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Server_close); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":218 + /* "pyrfc/_cyrfc.pyx":1535 * if self._handle != NULL: - * rc = RfcCloseConnection(self._handle, &errorInfo) - * self._handle = NULL # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + * _server_log("Server close", self._handle) + * with nogil: # <<<<<<<<<<<<<< + * RfcShutdownServer(self._handle, 60, NULL) + * RfcDestroyServer(self._handle, NULL) */ - __pyx_v_self->_handle = NULL; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "src/pyrfc/client.pyx":219 - * rc = RfcCloseConnection(self._handle, &errorInfo) - * self._handle = NULL - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":1536 + * _server_log("Server close", self._handle) + * with nogil: + * RfcShutdownServer(self._handle, 60, NULL) # <<<<<<<<<<<<<< + * RfcDestroyServer(self._handle, NULL) + * self._handle = NULL */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_1) { + (void)(RfcShutdownServer(__pyx_v_self->_handle, 60, NULL)); - /* "src/pyrfc/client.pyx":220 - * self._handle = NULL - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1537 + * with nogil: + * RfcShutdownServer(self._handle, 60, NULL) + * RfcDestroyServer(self._handle, NULL) # <<<<<<<<<<<<<< + * self._handle = NULL * - * cdef _error(self, RFC_ERROR_INFO* errorInfo): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + (void)(RfcDestroyServer(__pyx_v_self->_handle, NULL)); - /* "src/pyrfc/client.pyx":219 - * rc = RfcCloseConnection(self._handle, &errorInfo) - * self._handle = NULL - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1538 + * RfcShutdownServer(self._handle, 60, NULL) + * RfcDestroyServer(self._handle, NULL) + * self._handle = NULL # <<<<<<<<<<<<<< * + * def open(self): */ + __pyx_v_self->_handle = NULL; + } + + /* "pyrfc/_cyrfc.pyx":1535 + * if self._handle != NULL: + * _server_log("Server close", self._handle) + * with nogil: # <<<<<<<<<<<<<< + * RfcShutdownServer(self._handle, 60, NULL) + * RfcDestroyServer(self._handle, NULL) + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L6; + } + __pyx_L6:; + } } - /* "src/pyrfc/client.pyx":216 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":1533 + * + * cdef _close(self): * if self._handle != NULL: # <<<<<<<<<<<<<< - * rc = RfcCloseConnection(self._handle, &errorInfo) - * self._handle = NULL + * _server_log("Server close", self._handle) + * with nogil: */ } - /* "src/pyrfc/client.pyx":213 - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1532 + * _server_log("Server connection", f"{self._handle}") * - * def _close(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * cdef _close(self): # <<<<<<<<<<<<<< + * if self._handle != NULL: + * _server_log("Server close", self._handle) */ /* function exit code */ @@ -20505,140 +18763,126 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_20_close(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection._close", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":222 - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1540 + * self._handle = NULL + * + * def open(self): # <<<<<<<<<<<<<< + * self._open() * - * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * """ - * Error treatment of a connection. */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Connection__error(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, RFC_ERROR_INFO *__pyx_v_errorInfo) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_3open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_3open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("open (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_2open(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_2open(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_error", 0); + __Pyx_RefNannySetupContext("open", 0); - /* "src/pyrfc/client.pyx":237 - * # self.alive = False + /* "pyrfc/_cyrfc.pyx":1541 * - * raise wrapError(errorInfo) # <<<<<<<<<<<<<< + * def open(self): + * self._open() # <<<<<<<<<<<<<< * - * def ping(self): + * def close(self): */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError(__pyx_v_errorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 237, __pyx_L1_error) - /* "src/pyrfc/client.pyx":222 - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1540 + * self._handle = NULL + * + * def open(self): # <<<<<<<<<<<<<< + * self._open() * - * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * """ - * Error treatment of a connection. */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._error", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":239 - * raise wrapError(errorInfo) +/* "pyrfc/_cyrfc.pyx":1543 + * self._open() * - * def ping(self): # <<<<<<<<<<<<<< - * """ Send a RFC Ping through the current connection + * def close(self): # <<<<<<<<<<<<<< + * self._close() * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_23ping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_22ping[] = " Send a RFC Ping through the current connection\n\n Returns nothing.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the RFC Ping fails.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_23ping(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ping (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_22ping(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("close (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_4close(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_22ping(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_4close(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("ping", 0); - - /* "src/pyrfc/client.pyx":249 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * rc = RfcPing(self._handle, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_rc = RfcPing(__pyx_v_self->_handle, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":250 - * cdef RFC_ERROR_INFO errorInfo - * rc = RfcPing(self._handle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * - */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_1) { + __Pyx_RefNannySetupContext("close", 0); - /* "src/pyrfc/client.pyx":251 - * rc = RfcPing(self._handle, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1544 * - * def reset_server_context(self): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/client.pyx":250 - * cdef RFC_ERROR_INFO errorInfo - * rc = RfcPing(self._handle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + * def close(self): + * self._close() # <<<<<<<<<<<<<< * + * def __bool__(self): */ - } + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":239 - * raise wrapError(errorInfo) + /* "pyrfc/_cyrfc.pyx":1543 + * self._open() * - * def ping(self): # <<<<<<<<<<<<<< - * """ Send a RFC Ping through the current connection + * def close(self): # <<<<<<<<<<<<<< + * self._close() * */ @@ -20646,8 +18890,8 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_22ping(struct __pyx_obj_5p __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.ping", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -20655,481 +18899,246 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_22ping(struct __pyx_obj_5p return __pyx_r; } -/* "src/pyrfc/client.pyx":253 - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1546 + * self._close() + * + * def __bool__(self): # <<<<<<<<<<<<<< + * return self.alive * - * def reset_server_context(self): # <<<<<<<<<<<<<< - * """ Resets the SAP server context ("user context / ABAP session context") - * associated with the given client connection, but does not close the connection */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_25reset_server_context(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_24reset_server_context[] = " Resets the SAP server context (\"user context / ABAP session context\")\n associated with the given client connection, but does not close the connection\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof in case resetting the server context fails.\n (Better close the connection in that case.).\n :exc:`sapnwrf2.CommunicationError` if no conversion\n was found for the\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_25reset_server_context(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_7__bool__(PyObject *__pyx_v_self); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_7__bool__(PyObject *__pyx_v_self) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset_server_context (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_24reset_server_context(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6__bool__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_24reset_server_context(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - PyObject *__pyx_r = NULL; +static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6__bool__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("reset_server_context", 0); - - /* "src/pyrfc/client.pyx":266 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * rc = RfcResetServerContext(self._handle, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_rc = RfcResetServerContext(__pyx_v_self->_handle, (&__pyx_v_errorInfo)); + __Pyx_RefNannySetupContext("__bool__", 0); - /* "src/pyrfc/client.pyx":267 - * cdef RFC_ERROR_INFO errorInfo - * rc = RfcResetServerContext(self._handle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1547 * - */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_1) { - - /* "src/pyrfc/client.pyx":268 - * rc = RfcResetServerContext(self._handle, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< + * def __bool__(self): + * return self.alive # <<<<<<<<<<<<<< * - * def get_connection_attributes(self): + * @property */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 268, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1547, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1547, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":267 - * cdef RFC_ERROR_INFO errorInfo - * rc = RfcResetServerContext(self._handle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1546 + * self._close() * - */ - } - - /* "src/pyrfc/client.pyx":253 - * self._error(&errorInfo) + * def __bool__(self): # <<<<<<<<<<<<<< + * return self.alive * - * def reset_server_context(self): # <<<<<<<<<<<<<< - * """ Resets the SAP server context ("user context / ABAP session context") - * associated with the given client connection, but does not close the connection */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.reset_server_context", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":270 - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1550 * - * def get_connection_attributes(self): # <<<<<<<<<<<<<< - * """ Get connection details + * @property + * def handle(self): # <<<<<<<<<<<<<< + * """Server connection handle * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_27get_connection_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_26get_connection_attributes[] = " Get connection details\n\n :returns: Mapping of connection information keys:\n\n * active_unit: True if there is a filled and submitted unit w/o being confirmed or destroyed.\n * dest: RFC destination\n * host: Own host name\n * partnerHost: Partner host name\n * sysNumber: R/3 system number\n * sysId: R/3 system ID\n * client: Client (\"Mandant\")\n * user: User\n * language: Language\n * trace: Trace level (0-3)\n * isoLanguage: 2-byte ISO-Language\n * codepage: Own code page\n * partnerCodepage: Partner code page\n * rfcRole: C/S: RFC Client / RFC Server\n * type: 2/3/E/R: R/2,R/3,Ext,Reg.Ext\n * partnerType: 2/3/E/R: R/2,R/3,Ext,Reg.Ext\n * rel: My system release\n * partnerRe: Partner system release\n * kernelRel: Partner kernel release\n * cpicConvId: CPI-C Conversation ID\n * progName: Name calling APAB program (report, module pool)\n * partnerBytesPerChar: Bytes per char in backend codepage.\n * partnerSystemCodepage: Partner system code page\n * reserved: Reserved for later use\n\n Note: all values, except ``active_unit`` are right stripped string values.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if the RFC call fails.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_27get_connection_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6handle_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6handle_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_connection_attributes (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_26get_connection_attributes(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6handle___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_26get_connection_attributes(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_ATTRIBUTES __pyx_v_attributes; - PyObject *__pyx_v_result = NULL; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6handle___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_connection_attributes", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/pyrfc/client.pyx":308 - * cdef RFC_ATTRIBUTES attributes - * - * result = {} # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1556 + * :type: uitptr_t + * """ + * return self._handle # <<<<<<<<<<<<<< * - * if self.is_valid(): + * @property */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 308, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_result = __pyx_t_1; + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":310 - * result = {} - * - * if self.is_valid(): # <<<<<<<<<<<<<< - * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) - * if rc != RFC_OK: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_valid); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 310, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { - - /* "src/pyrfc/client.pyx":311 - * - * if self.is_valid(): - * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_rc = RfcGetConnectionAttributes(__pyx_v_self->_handle, (&__pyx_v_attributes), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":312 - * if self.is_valid(): - * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * - */ - __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_4) { - - /* "src/pyrfc/client.pyx":313 - * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * - * result = wrapConnectionAttributes(attributes) - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":312 - * if self.is_valid(): - * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * - */ - } - - /* "src/pyrfc/client.pyx":315 - * self._error(&errorInfo) - * - * result = wrapConnectionAttributes(attributes) # <<<<<<<<<<<<<< - * result.update({ - * 'active_unit': self.active_unit or self.active_transaction - */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapConnectionAttributes(__pyx_v_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 315, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); - __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":316 - * - * result = wrapConnectionAttributes(attributes) - * result.update({ # <<<<<<<<<<<<<< - * 'active_unit': self.active_unit or self.active_transaction - * }) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "src/pyrfc/client.pyx":317 - * result = wrapConnectionAttributes(attributes) - * result.update({ - * 'active_unit': self.active_unit or self.active_transaction # <<<<<<<<<<<<<< - * }) - * return result - */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!__pyx_v_self->active_unit) { - } else { - __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->active_unit); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->active_transaction); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __pyx_t_6; - __pyx_t_6 = 0; - __pyx_L5_bool_binop_done:; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_active_unit, __pyx_t_5) < 0) __PYX_ERR(2, 317, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":310 - * result = {} - * - * if self.is_valid(): # <<<<<<<<<<<<<< - * rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) - * if rc != RFC_OK: - */ - } - - /* "src/pyrfc/client.pyx":319 - * 'active_unit': self.active_unit or self.active_transaction - * }) - * return result # <<<<<<<<<<<<<< - * - * def is_valid(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "src/pyrfc/client.pyx":270 - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1550 * - * def get_connection_attributes(self): # <<<<<<<<<<<<<< - * """ Get connection details + * @property + * def handle(self): # <<<<<<<<<<<<<< + * """Server connection handle * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.get_connection_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":321 - * return result +/* "pyrfc/_cyrfc.pyx":1559 + * + * @property + * def alive(self): # <<<<<<<<<<<<<< + * """Conection alive property * - * def is_valid(self): # <<<<<<<<<<<<<< - * """Checks an RFC connection. Can be used to check whether a client/server connection - * has already been closed, or whether the NW RFC library still "considers" the connection */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_29is_valid(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_28is_valid[] = "Checks an RFC connection. Can be used to check whether a client/server connection\n has already been closed, or whether the NW RFC library still \"considers\" the connection\n to be open.\n\n .. note::\n This does not guarantee that the connection is indeed still alive:\n A firewall may silently have closed the connection without notifying\n the endpoints. If you want to find out, whether the connection is still alive,\n you'll have to use the more expensive RfcPing().\n\n :returns: boolean\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_29is_valid(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5alive_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5alive_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_valid (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_28is_valid(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5alive___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_28is_valid(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_INT __pyx_v_isValid; - RFC_RC __pyx_v_rc; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5alive___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - __Pyx_RefNannySetupContext("is_valid", 0); - - /* "src/pyrfc/client.pyx":337 - * cdef RFC_INT isValid - * - * rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) # <<<<<<<<<<<<<< - * - * if rc != RFC_OK or errorInfo.code != RFC_OK: - */ - __pyx_v_rc = RfcIsConnectionHandleValid(__pyx_v_self->_handle, (&__pyx_v_isValid), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":339 - * rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) - * - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * return False - * return True - */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { - - /* "src/pyrfc/client.pyx":340 - * - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * return False # <<<<<<<<<<<<<< - * return True - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - - /* "src/pyrfc/client.pyx":339 - * rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) - * - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * return False - * return True - */ - } + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/pyrfc/client.pyx":341 - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * return False - * return True # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1565 + * :type: boolean + * """ + * return self._handle != NULL # <<<<<<<<<<<<<< * - * # def c_handle_test(self, p_handle): + * def __del__(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_handle != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "src/pyrfc/client.pyx":321 - * return result + /* "pyrfc/_cyrfc.pyx":1559 + * + * @property + * def alive(self): # <<<<<<<<<<<<<< + * """Conection alive property * - * def is_valid(self): # <<<<<<<<<<<<<< - * """Checks an RFC connection. Can be used to check whether a client/server connection - * has already been closed, or whether the NW RFC library still "considers" the connection */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.alive.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":350 - * # print("c:handle", "ok" if c_handle - self._handle == 0 else "error") - * - * def get_function_description(self, func_name): # <<<<<<<<<<<<<< - * """ Returns a function description of a function module. +/* "pyrfc/_cyrfc.pyx":1567 + * return self._handle != NULL * + * def __del__(self): # <<<<<<<<<<<<<< + * self._close() + * self._connection._free() */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_31get_function_description(PyObject *__pyx_v_self, PyObject *__pyx_v_func_name); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_30get_function_description[] = " Returns a function description of a function module.\n\n :param func_name: Name of the function module whose description\n will be returned.\n :type func_name: string\n\n :return: A :class:`FunctionDescription` object.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_31get_function_description(PyObject *__pyx_v_self, PyObject *__pyx_v_func_name) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_9__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_9__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_function_description (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_30get_function_description(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_func_name)); + __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_30get_function_description(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_func_name) { - RFC_ERROR_INFO __pyx_v_errorInfo; - SAP_UC *__pyx_v_funcName; - RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - SAP_UC *__pyx_t_4; - int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_function_description", 0); + __Pyx_RefNannySetupContext("__del__", 0); - /* "src/pyrfc/client.pyx":360 - * """ - * cdef RFC_ERROR_INFO errorInfo - * funcName = fillString(func_name.upper()) # <<<<<<<<<<<<<< - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) + /* "pyrfc/_cyrfc.pyx":1568 + * + * def __del__(self): + * self._close() # <<<<<<<<<<<<<< + * self._connection._free() + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":1569 + * def __del__(self): + * self._close() + * self._connection._free() # <<<<<<<<<<<<<< + * + * cdef RFC_RC metadataLookup( */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_name, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 360, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_connection), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -21143,89 +19152,156 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_30get_function_description } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 360, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 360, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_funcName = __pyx_t_4; - /* "src/pyrfc/client.pyx":361 - * cdef RFC_ERROR_INFO errorInfo - * funcName = fillString(func_name.upper()) - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< - * free(funcName) - * if not funcDesc: + /* "pyrfc/_cyrfc.pyx":1567 + * return self._handle != NULL + * + * def __del__(self): # <<<<<<<<<<<<<< + * self._close() + * self._connection._free() */ - __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":362 - * funcName = fillString(func_name.upper()) - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) # <<<<<<<<<<<<<< - * if not funcDesc: - * self._error(&errorInfo) + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1515 + * cdef ConnectionParameters _connection + * cdef RFC_SERVER_HANDLE _handle + * cdef public bint debug # <<<<<<<<<<<<<< + * cdef public bint rstrip + * */ - free(__pyx_v_funcName); - /* "src/pyrfc/client.pyx":363 - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapFunctionDescription(funcDesc) - */ - __pyx_t_5 = ((!(__pyx_v_funcDesc != 0)) != 0); - if (__pyx_t_5) { - - /* "src/pyrfc/client.pyx":364 - * free(funcName) - * if not funcDesc: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * return wrapFunctionDescription(funcDesc) - * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); - /* "src/pyrfc/client.pyx":363 - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapFunctionDescription(funcDesc) - */ - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":365 - * if not funcDesc: - * self._error(&errorInfo) - * return wrapFunctionDescription(funcDesc) # <<<<<<<<<<<<<< - * - * def call(self, func_name, options=None, **params): - */ +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapFunctionDescription(__pyx_v_funcDesc); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 365, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "src/pyrfc/client.pyx":350 - * # print("c:handle", "ok" if c_handle - self._handle == 0 else "error") - * - * def get_function_description(self, func_name): # <<<<<<<<<<<<<< - * """ Returns a function description of a function module. + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.debug.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1515, __pyx_L1_error) + __pyx_v_self->debug = __pyx_t_1; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.debug.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1516 + * cdef RFC_SERVER_HANDLE _handle + * cdef public bint debug + * cdef public bint rstrip # <<<<<<<<<<<<<< * + * def __init__(self, **params): */ +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.get_function_description", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.rstrip.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -21233,156 +19309,245 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_30get_function_description return __pyx_r; } -/* "src/pyrfc/client.pyx":367 - * return wrapFunctionDescription(funcDesc) - * - * def call(self, func_name, options=None, **params): # <<<<<<<<<<<<<< - * """ Invokes a remote-enabled function module via RFC. - * +/* Python wrapper */ +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1516, __pyx_L1_error) + __pyx_v_self->rstrip = __pyx_t_1; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.rstrip.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_33call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_32call[] = " Invokes a remote-enabled function module via RFC.\n\n :param func_name: Name of the function module that will be invoked.\n :type func_name: string\n\n :param options: Call options for single remote ABAP function call. Allowed keys:\n\n - ``not_requested`` Allows to deactivate certain parameters in the function module interface.\n This is particularly useful for BAPIs which have many large tables, the Python client is not interested in.\n Deactivate those, to reduce network traffic and memory consumption in your application considerably.\n\n This functionality can be used for input and output parameters. If the parameter is an input, no data for\n that parameter will be sent to the backend. If it's an output, the backend will be informed not to return\n data for that parameter.\n\n - ``timeout`` Cancel RFC connection if ongoing RFC call not completed within ``timeout`` seconds.\n Timeout can be also set as client connection configuration option, in which case is valid for all RFC calls.\n\n Examples: https://github.com/SAP/PyRFC/tree/main/examples/timeout\n\n :type options: dictionary\n\n :param params: Parameter of the function module. All non optional\n IMPORT, CHANGING, and TABLE parameters must be provided.\n :type params: keyword arguments\n\n :return: Dictionary with all EXPORT, CHANGING, and TABLE parameters.\n The IMPORT parameters are also given, if :attr:`Connection.config.return_import_params`\n is set to ``True``.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the RFC call fails.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_33call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_func_name = 0; - PyObject *__pyx_v_options = 0; - PyObject *__pyx_v_params = 0; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_10__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("call (wrapper)", 0); - __pyx_v_params = PyDict_New(); if (unlikely(!__pyx_v_params)) return NULL; - __Pyx_GOTREF(__pyx_v_params); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_options,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 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_func_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_params, values, pos_args, "call") < 0)) __PYX_ERR(2, 367, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_func_name = values[0]; - __pyx_v_options = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("call", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 367, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_params); __pyx_v_params = 0; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.call", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_32call(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_func_name, __pyx_v_options, __pyx_v_params); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_12__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_params); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_32call(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_options, PyObject *__pyx_v_params) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_ERROR_INFO __pyx_v_openErrorInfo; - SAP_UC *__pyx_v_cName; - SAP_UC *__pyx_v_funcName; - RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; - RFC_FUNCTION_HANDLE __pyx_v_funcCont; - int __pyx_v_isActive; - PyObject *__pyx_v_skip_parameters = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_cancel_timer = NULL; - PyObject *__pyx_v_timeout = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_closed_handle = NULL; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._handle cannot be converted to a Python object for pickling") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1571 + * self._connection._free() + * + * cdef RFC_RC metadataLookup( # <<<<<<<<<<<<<< + * const SAP_UC* functionName, + * RFC_ATTRIBUTES rfcAttributes, + */ + +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_metadataLookup(SAP_UC const *__pyx_v_functionName, CYTHON_UNUSED RFC_ATTRIBUTES __pyx_v_rfcAttributes, RFC_FUNCTION_DESC_HANDLE *__pyx_v_funcDescHandle) { + PyObject *__pyx_v_function_name = NULL; + PyObject *__pyx_v_func_metadata = NULL; + RFC_RC __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - SAP_UC *__pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_UCS4 __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - Py_ssize_t __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - char const *__pyx_t_17; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; + Py_ssize_t __pyx_t_6; + Py_UCS4 __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + uintptr_t __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("call", 0); - __Pyx_INCREF(__pyx_v_options); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("metadataLookup", 0); - /* "src/pyrfc/client.pyx":405 - * cdef RFC_ERROR_INFO openErrorInfo - * cdef SAP_UC *cName - * if type(func_name) is not str: # <<<<<<<<<<<<<< - * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) - * cdef SAP_UC *funcName = fillString(func_name) + /* "pyrfc/_cyrfc.pyx":1577 + * ) with gil: + * global server_functions + * function_name = wrapString(functionName) # <<<<<<<<<<<<<< + * if function_name not in server_functions: + * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") */ - __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_func_name)) != ((PyObject *)(&PyString_Type))); - __pyx_t_2 = (__pyx_t_1 != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_functionName, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_function_name = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":406 - * cdef SAP_UC *cName - * if type(func_name) is not str: - * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) # <<<<<<<<<<<<<< - * cdef SAP_UC *funcName = fillString(func_name) - * if self._handle == NULL: + /* "pyrfc/_cyrfc.pyx":1578 + * global server_functions + * function_name = wrapString(functionName) + * if function_name not in server_functions: # <<<<<<<<<<<<<< + * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") + * return RFC_NOT_FOUND + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_function_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1578, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "pyrfc/_cyrfc.pyx":1579 + * function_name = wrapString(functionName) + * if function_name not in server_functions: + * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") # <<<<<<<<<<<<<< + * return RFC_NOT_FOUND + * func_metadata = server_functions[function_name] */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 406, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_server_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = 0; + __pyx_t_7 = 127; + __Pyx_INCREF(__pyx_kp_u_No_metadata_found_for_function); + __pyx_t_6 += 32; + __Pyx_GIVEREF(__pyx_kp_u_No_metadata_found_for_function); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_No_metadata_found_for_function); + __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_function_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7; + __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_kp_u__27); + __pyx_t_6 += 2; + __Pyx_GIVEREF(__pyx_kp_u__27); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__27); + __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { @@ -21390,1377 +19555,2331 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_32call(struct __pyx_obj_5p __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_6 = 1; + __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_kp_s_Remote_function_module_name_must, __pyx_v_func_name, ((PyObject *)Py_TYPE(__pyx_v_func_name))}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 406, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_metadataLookup, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1579, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_kp_s_Remote_function_module_name_must, __pyx_v_func_name, ((PyObject *)Py_TYPE(__pyx_v_func_name))}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 406, __pyx_L1_error) + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_metadataLookup, __pyx_t_8}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1579, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { - __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL; } - __Pyx_INCREF(__pyx_kp_s_Remote_function_module_name_must); - __Pyx_GIVEREF(__pyx_kp_s_Remote_function_module_name_must); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Remote_function_module_name_must); - __Pyx_INCREF(__pyx_v_func_name); - __Pyx_GIVEREF(__pyx_v_func_name); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_func_name); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_func_name))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_func_name))); - PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, ((PyObject *)Py_TYPE(__pyx_v_func_name))); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_n_s_metadataLookup); + __Pyx_GIVEREF(__pyx_n_s_metadataLookup); + PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_n_s_metadataLookup); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1579, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 406, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":405 - * cdef RFC_ERROR_INFO openErrorInfo - * cdef SAP_UC *cName - * if type(func_name) is not str: # <<<<<<<<<<<<<< - * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) - * cdef SAP_UC *funcName = fillString(func_name) + /* "pyrfc/_cyrfc.pyx":1580 + * if function_name not in server_functions: + * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") + * return RFC_NOT_FOUND # <<<<<<<<<<<<<< + * func_metadata = server_functions[function_name] + * # callback = func_metadata['callback'] */ - } + __pyx_r = RFC_NOT_FOUND; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":407 - * if type(func_name) is not str: - * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) - * cdef SAP_UC *funcName = fillString(func_name) # <<<<<<<<<<<<<< - * if self._handle == NULL: - * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") + /* "pyrfc/_cyrfc.pyx":1578 + * global server_functions + * function_name = wrapString(functionName) + * if function_name not in server_functions: # <<<<<<<<<<<<<< + * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") + * return RFC_NOT_FOUND */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(2, 407, __pyx_L1_error) - __pyx_v_funcName = __pyx_t_8; + } - /* "src/pyrfc/client.pyx":408 - * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) - * cdef SAP_UC *funcName = fillString(func_name) - * if self._handle == NULL: # <<<<<<<<<<<<<< - * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1581 + * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") + * return RFC_NOT_FOUND + * func_metadata = server_functions[function_name] # <<<<<<<<<<<<<< + * # callback = func_metadata['callback'] + * funcDescHandle[0] = func_metadata['func_desc_handle'] */ - __pyx_t_2 = ((__pyx_v_self->_handle == NULL) != 0); - if (unlikely(__pyx_t_2)) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1581, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_function_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_func_metadata = __pyx_t_4; + __pyx_t_4 = 0; - /* "src/pyrfc/client.pyx":409 - * cdef SAP_UC *funcName = fillString(func_name) - * if self._handle == NULL: - * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") # <<<<<<<<<<<<<< - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) + /* "pyrfc/_cyrfc.pyx":1583 + * func_metadata = server_functions[function_name] + * # callback = func_metadata['callback'] + * funcDescHandle[0] = func_metadata['func_desc_handle'] # <<<<<<<<<<<<<< + * _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") + * return RFC_OK + */ + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_metadata, __pyx_n_s_func_desc_handle); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_11 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1583, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + (__pyx_v_funcDescHandle[0]) = ((RFC_FUNCTION_DESC_HANDLE)((uintptr_t)__pyx_t_11)); + + /* "pyrfc/_cyrfc.pyx":1584 + * # callback = func_metadata['callback'] + * funcDescHandle[0] = func_metadata['func_desc_handle'] + * _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") # <<<<<<<<<<<<<< + * return RFC_OK + * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_6 = 0; + __pyx_t_7 = 127; + __Pyx_INCREF(__pyx_kp_u_Function); + __pyx_t_6 += 10; + __Pyx_GIVEREF(__pyx_kp_u_Function); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_u_Function); + __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_function_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7; + __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_kp_u_handle_2); + __pyx_t_6 += 9; + __Pyx_GIVEREF(__pyx_kp_u_handle_2); + PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_kp_u_handle_2); + __pyx_t_8 = __Pyx_PyInt_FromSize_t(((uintptr_t)(__pyx_v_funcDescHandle[0]))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_7; + __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_kp_u__20); + __pyx_t_6 += 1; + __Pyx_GIVEREF(__pyx_kp_u__20); + PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_kp_u__20); + __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_10, 5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_9 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_9 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_n_s_metadataLookup, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = 0; - __pyx_t_10 = 127; - __Pyx_INCREF(__pyx_kp_u_Remote_function_module); - __pyx_t_9 += 24; - __Pyx_GIVEREF(__pyx_kp_u_Remote_function_module); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_Remote_function_module); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_10; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_n_s_metadataLookup, __pyx_t_5}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL; + } + __Pyx_INCREF(__pyx_n_s_metadataLookup); + __Pyx_GIVEREF(__pyx_n_s_metadataLookup); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_n_s_metadataLookup); __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_5); __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_kp_u_invocation_rejected_because_the); - __pyx_t_9 += 54; - __Pyx_GIVEREF(__pyx_kp_u_invocation_rejected_because_the); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u_invocation_rejected_because_the); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 409, __pyx_L1_error) - - /* "src/pyrfc/client.pyx":408 - * raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) - * cdef SAP_UC *funcName = fillString(func_name) - * if self._handle == NULL: # <<<<<<<<<<<<<< - * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/client.pyx":410 - * if self._handle == NULL: - * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< - * free(funcName) - * if not funcDesc: + /* "pyrfc/_cyrfc.pyx":1585 + * funcDescHandle[0] = func_metadata['func_desc_handle'] + * _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") + * return RFC_OK # <<<<<<<<<<<<<< + * + * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): */ - __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); + __pyx_r = RFC_OK; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":411 - * raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) # <<<<<<<<<<<<<< - * if not funcDesc: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1571 + * self._connection._free() + * + * cdef RFC_RC metadataLookup( # <<<<<<<<<<<<<< + * const SAP_UC* functionName, + * RFC_ATTRIBUTES rfcAttributes, */ - free(__pyx_v_funcName); - /* "src/pyrfc/client.pyx":412 - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) - */ - __pyx_t_2 = ((!(__pyx_v_funcDesc != 0)) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_WriteUnraisable("pyrfc._cyrfc.metadataLookup", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = (RFC_RC) 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_function_name); + __Pyx_XDECREF(__pyx_v_func_metadata); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "src/pyrfc/client.pyx":413 - * free(funcName) - * if not funcDesc: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: +/* "pyrfc/_cyrfc.pyx":1587 + * return RFC_OK + * + * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): # <<<<<<<<<<<<<< + * cdef RFC_SERVER_CONTEXT context + * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":412 - * cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) - */ - } +static PyObject *__pyx_f_5pyrfc_6_cyrfc_get_server_context(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_ERROR_INFO *__pyx_v_serverErrorInfo) { + RFC_SERVER_CONTEXT __pyx_v_context; + RFC_RC __pyx_v_rc; + PyObject *__pyx_v_server_context = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_server_context", 0); - /* "src/pyrfc/client.pyx":414 - * if not funcDesc: - * self._error(&errorInfo) - * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) # <<<<<<<<<<<<<< - * if not funcCont: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1589 + * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): + * cdef RFC_SERVER_CONTEXT context + * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: + * return None */ - __pyx_v_funcCont = RfcCreateFunction(__pyx_v_funcDesc, (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetServerContext(__pyx_v_rfcHandle, (&__pyx_v_context), __pyx_v_serverErrorInfo); - /* "src/pyrfc/client.pyx":415 - * self._error(&errorInfo) - * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * cdef int isActive = 0 + /* "pyrfc/_cyrfc.pyx":1590 + * cdef RFC_SERVER_CONTEXT context + * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) + * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * return None + * */ - __pyx_t_2 = ((!(__pyx_v_funcCont != 0)) != 0); - if (__pyx_t_2) { + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_serverErrorInfo->code != RFC_OK) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { - /* "src/pyrfc/client.pyx":416 - * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * cdef int isActive = 0 - * options = options or {} + /* "pyrfc/_cyrfc.pyx":1591 + * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) + * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: + * return None # <<<<<<<<<<<<<< + * + * server_context = { */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/pyrfc/client.pyx":415 - * self._error(&errorInfo) - * cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * cdef int isActive = 0 + /* "pyrfc/_cyrfc.pyx":1590 + * cdef RFC_SERVER_CONTEXT context + * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) + * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * return None + * */ } - /* "src/pyrfc/client.pyx":417 - * if not funcCont: - * self._error(&errorInfo) - * cdef int isActive = 0 # <<<<<<<<<<<<<< - * options = options or {} - * try: # now we have a function module + /* "pyrfc/_cyrfc.pyx":1594 + * + * server_context = { + * "call_type": UnitCallType(context.type), # <<<<<<<<<<<<<< + * "is_stateful": context.isStateful != 0 + * } */ - __pyx_v_isActive = 0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_UnitCallType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_From_RFC_CALL_TYPE(__pyx_v_context.type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_call_type, __pyx_t_4) < 0) __PYX_ERR(0, 1594, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/client.pyx":418 - * self._error(&errorInfo) - * cdef int isActive = 0 - * options = options or {} # <<<<<<<<<<<<<< - * try: # now we have a function module - * if 'not_requested' in options: + /* "pyrfc/_cyrfc.pyx":1595 + * server_context = { + * "call_type": UnitCallType(context.type), + * "is_stateful": context.isStateful != 0 # <<<<<<<<<<<<<< + * } + * if context.type != RFC_SYNCHRONOUS: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_options); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 418, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __Pyx_INCREF(__pyx_v_options); - __pyx_t_3 = __pyx_v_options; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 418, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_context.isStateful != 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __pyx_t_4; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_is_stateful, __pyx_t_4) < 0) __PYX_ERR(0, 1594, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_L7_bool_binop_done:; - __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_3); + __pyx_v_server_context = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":419 - * cdef int isActive = 0 - * options = options or {} - * try: # now we have a function module # <<<<<<<<<<<<<< - * if 'not_requested' in options: - * skip_parameters = options['not_requested'] + /* "pyrfc/_cyrfc.pyx":1597 + * "is_stateful": context.isStateful != 0 + * } + * if context.type != RFC_SYNCHRONOUS: # <<<<<<<<<<<<<< + * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) + * if context.type == RFC_BACKGROUND_UNIT: */ - /*try:*/ { + __pyx_t_1 = ((__pyx_v_context.type != RFC_SYNCHRONOUS) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/client.pyx":420 - * options = options or {} - * try: # now we have a function module - * if 'not_requested' in options: # <<<<<<<<<<<<<< - * skip_parameters = options['not_requested'] - * if type(skip_parameters) is not list: + /* "pyrfc/_cyrfc.pyx":1598 + * } + * if context.type != RFC_SYNCHRONOUS: + * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) # <<<<<<<<<<<<<< + * if context.type == RFC_BACKGROUND_UNIT: + * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_not_requested, __pyx_v_options, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 420, __pyx_L10_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_context.unitIdentifier[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyDict_SetItem(__pyx_v_server_context, __pyx_n_s_unit_identifier, __pyx_t_3) < 0)) __PYX_ERR(0, 1598, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":421 - * try: # now we have a function module - * if 'not_requested' in options: - * skip_parameters = options['not_requested'] # <<<<<<<<<<<<<< - * if type(skip_parameters) is not list: - * skip_parameters = [skip_parameters] + /* "pyrfc/_cyrfc.pyx":1597 + * "is_stateful": context.isStateful != 0 + * } + * if context.type != RFC_SYNCHRONOUS: # <<<<<<<<<<<<<< + * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) + * if context.type == RFC_BACKGROUND_UNIT: */ - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_n_s_not_requested); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 421, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_skip_parameters = __pyx_t_3; - __pyx_t_3 = 0; + } - /* "src/pyrfc/client.pyx":422 - * if 'not_requested' in options: - * skip_parameters = options['not_requested'] - * if type(skip_parameters) is not list: # <<<<<<<<<<<<<< - * skip_parameters = [skip_parameters] - * for name in skip_parameters: + /* "pyrfc/_cyrfc.pyx":1599 + * if context.type != RFC_SYNCHRONOUS: + * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) + * if context.type == RFC_BACKGROUND_UNIT: # <<<<<<<<<<<<<< + * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + * */ - __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_skip_parameters)) != ((PyObject *)(&PyList_Type))); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_context.type == RFC_BACKGROUND_UNIT) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/client.pyx":423 - * skip_parameters = options['not_requested'] - * if type(skip_parameters) is not list: - * skip_parameters = [skip_parameters] # <<<<<<<<<<<<<< - * for name in skip_parameters: - * cName = fillString(name) + /* "pyrfc/_cyrfc.pyx":1600 + * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) + * if context.type == RFC_BACKGROUND_UNIT: + * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) # <<<<<<<<<<<<<< + * + * return server_context */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 423, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_skip_parameters); - __Pyx_GIVEREF(__pyx_v_skip_parameters); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_skip_parameters); - __Pyx_DECREF_SET(__pyx_v_skip_parameters, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitAttributes(__pyx_v_context.unitAttributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyDict_SetItem(__pyx_v_server_context, __pyx_n_s_unit_attributes, __pyx_t_3) < 0)) __PYX_ERR(0, 1600, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":422 - * if 'not_requested' in options: - * skip_parameters = options['not_requested'] - * if type(skip_parameters) is not list: # <<<<<<<<<<<<<< - * skip_parameters = [skip_parameters] - * for name in skip_parameters: + /* "pyrfc/_cyrfc.pyx":1599 + * if context.type != RFC_SYNCHRONOUS: + * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) + * if context.type == RFC_BACKGROUND_UNIT: # <<<<<<<<<<<<<< + * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + * */ - } + } - /* "src/pyrfc/client.pyx":424 - * if type(skip_parameters) is not list: - * skip_parameters = [skip_parameters] - * for name in skip_parameters: # <<<<<<<<<<<<<< - * cName = fillString(name) - * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1602 + * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + * + * return server_context # <<<<<<<<<<<<<< + * + * cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: */ - if (likely(PyList_CheckExact(__pyx_v_skip_parameters)) || PyTuple_CheckExact(__pyx_v_skip_parameters)) { - __pyx_t_3 = __pyx_v_skip_parameters; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_skip_parameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 424, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 424, __pyx_L10_error) - } - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(2, 424, __pyx_L10_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 424, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(2, 424, __pyx_L10_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 424, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_11(__pyx_t_3); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 424, __pyx_L10_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_server_context); + __pyx_r = __pyx_v_server_context; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":425 - * skip_parameters = [skip_parameters] - * for name in skip_parameters: - * cName = fillString(name) # <<<<<<<<<<<<<< - * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) - * free(cName) + /* "pyrfc/_cyrfc.pyx":1587 + * return RFC_OK + * + * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): # <<<<<<<<<<<<<< + * cdef RFC_SERVER_CONTEXT context + * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(2, 425, __pyx_L10_error) - __pyx_v_cName = __pyx_t_8; - /* "src/pyrfc/client.pyx":426 - * for name in skip_parameters: - * cName = fillString(name) - * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) # <<<<<<<<<<<<<< - * free(cName) - * if rc != RFC_OK: - */ - __pyx_v_rc = RfcSetParameterActive(__pyx_v_funcCont, __pyx_v_cName, __pyx_v_isActive, (&__pyx_v_errorInfo)); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pyrfc._cyrfc.get_server_context", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_server_context); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":427 - * cName = fillString(name) - * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) - * free(cName) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1604 + * return server_context + * + * cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - free(__pyx_v_cName); - /* "src/pyrfc/client.pyx":428 - * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) - * free(cName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * # set connection timeout, starts before writing input parameters to container +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_genericHandler(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_FUNCTION_HANDLE __pyx_v_funcHandle, RFC_ERROR_INFO *__pyx_v_serverErrorInfo) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_ATTRIBUTES __pyx_v_attributes; + RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; + RFC_ABAP_NAME __pyx_v_funcName; + PyObject *__pyx_v_context = NULL; + PyObject *__pyx_v_err_msg = NULL; + PyObject *__pyx_v_new_error = NULL; + PyObject *__pyx_v_func_name = NULL; + PyObject *__pyx_v_func_data = NULL; + PyObject *__pyx_v_callback = NULL; + PyObject *__pyx_v_server = NULL; + PyObject *__pyx_v_conn_attr = NULL; + PyObject *__pyx_v_request_context = NULL; + PyObject *__pyx_v_auth_function = NULL; + PyObject *__pyx_v_func_handle_variables = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_e = NULL; + CYTHON_UNUSED PyObject *__pyx_v_ex = NULL; + PyObject *__pyx_v_exctype = NULL; + RFC_RC __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_UCS4 __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + RFC_RC __pyx_t_14; + Py_ssize_t __pyx_t_15; + int __pyx_t_16; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + PyObject *(*__pyx_t_20)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("genericHandler", 0); + + /* "pyrfc/_cyrfc.pyx":1614 + * + * # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 + * context = get_server_context(rfcHandle, serverErrorInfo) # <<<<<<<<<<<<<< + * if context is None: + * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_get_server_context(__pyx_v_rfcHandle, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_context = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":429 - * free(cName) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * # set connection timeout, starts before writing input parameters to container - * cancel_timer = None + /* "pyrfc/_cyrfc.pyx":1615 + * # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 + * context = get_server_context(rfcHandle, serverErrorInfo) + * if context is None: # <<<<<<<<<<<<<< + * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" + * new_error = ExternalRuntimeError( */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = (__pyx_v_context == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":428 - * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) - * free(cName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * # set connection timeout, starts before writing input parameters to container + /* "pyrfc/_cyrfc.pyx":1616 + * context = get_server_context(rfcHandle, serverErrorInfo) + * if context is None: + * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" # <<<<<<<<<<<<<< + * new_error = ExternalRuntimeError( + * message=err_msg, */ - } + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Error_code); + __pyx_t_4 += 11; + __Pyx_GIVEREF(__pyx_kp_u_Error_code); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Error_code); + __pyx_t_6 = __Pyx_PyUnicode_From_RFC_RC(__pyx_v_serverErrorInfo->code, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_when_getting_server_context_for); + __pyx_t_4 += 45; + __Pyx_GIVEREF(__pyx_kp_u_when_getting_server_context_for); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_when_getting_server_context_for); + __pyx_t_6 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_4 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_err_msg = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; - /* "src/pyrfc/client.pyx":424 - * if type(skip_parameters) is not list: - * skip_parameters = [skip_parameters] - * for name in skip_parameters: # <<<<<<<<<<<<<< - * cName = fillString(name) - * rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1617 + * if context is None: + * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" + * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< + * message=err_msg, + * code=RFC_EXTERNAL_FAILURE */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "src/pyrfc/client.pyx":420 - * options = options or {} - * try: # now we have a function module - * if 'not_requested' in options: # <<<<<<<<<<<<<< - * skip_parameters = options['not_requested'] - * if type(skip_parameters) is not list: + /* "pyrfc/_cyrfc.pyx":1618 + * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" + * new_error = ExternalRuntimeError( + * message=err_msg, # <<<<<<<<<<<<<< + * code=RFC_EXTERNAL_FAILURE + * ) */ - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1618, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_message, __pyx_v_err_msg) < 0) __PYX_ERR(0, 1618, __pyx_L1_error) - /* "src/pyrfc/client.pyx":431 - * self._error(&errorInfo) - * # set connection timeout, starts before writing input parameters to container - * cancel_timer = None # <<<<<<<<<<<<<< - * timeout = options.get('timeout', self.__config['timeout']) - * if timeout is not None: + /* "pyrfc/_cyrfc.pyx":1619 + * new_error = ExternalRuntimeError( + * message=err_msg, + * code=RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + * ) + * fillError(new_error, serverErrorInfo) */ - __Pyx_INCREF(Py_None); - __pyx_v_cancel_timer = Py_None; + __pyx_t_6 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_code, __pyx_t_6) < 0) __PYX_ERR(0, 1618, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/client.pyx":432 - * # set connection timeout, starts before writing input parameters to container - * cancel_timer = None - * timeout = options.get('timeout', self.__config['timeout']) # <<<<<<<<<<<<<< - * if timeout is not None: - * cancel_timer = Timer(timeout, cancel_connection, (self,)) + /* "pyrfc/_cyrfc.pyx":1617 + * if context is None: + * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" + * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< + * message=err_msg, + * code=RFC_EXTERNAL_FAILURE */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 432, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__pyx_v_self->__config == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 432, __pyx_L10_error) - } - __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_self->__config, __pyx_n_s_timeout); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 432, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = NULL; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_new_error = __pyx_t_6; __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + + /* "pyrfc/_cyrfc.pyx":1621 + * code=RFC_EXTERNAL_FAILURE + * ) + * fillError(new_error, serverErrorInfo) # <<<<<<<<<<<<<< + * return RFC_EXTERNAL_FAILURE + * + */ + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_new_error, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "pyrfc/_cyrfc.pyx":1622 + * ) + * fillError(new_error, serverErrorInfo) + * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + * + * funcDesc = RfcDescribeFunction(funcHandle, NULL) + */ + __pyx_r = RFC_EXTERNAL_FAILURE; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":1615 + * # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 + * context = get_server_context(rfcHandle, serverErrorInfo) + * if context is None: # <<<<<<<<<<<<<< + * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" + * new_error = ExternalRuntimeError( + */ + } + + /* "pyrfc/_cyrfc.pyx":1624 + * return RFC_EXTERNAL_FAILURE + * + * funcDesc = RfcDescribeFunction(funcHandle, NULL) # <<<<<<<<<<<<<< + * RfcGetFunctionName(funcDesc, funcName, NULL) + * + */ + __pyx_v_funcDesc = RfcDescribeFunction(__pyx_v_funcHandle, NULL); + + /* "pyrfc/_cyrfc.pyx":1625 + * + * funcDesc = RfcDescribeFunction(funcHandle, NULL) + * RfcGetFunctionName(funcDesc, funcName, NULL) # <<<<<<<<<<<<<< + * + * func_name = wrapString(funcName) + */ + (void)(RfcGetFunctionName(__pyx_v_funcDesc, __pyx_v_funcName, NULL)); + + /* "pyrfc/_cyrfc.pyx":1627 + * RfcGetFunctionName(funcDesc, funcName, NULL) + * + * func_name = wrapString(funcName) # <<<<<<<<<<<<<< + * if func_name not in server_functions: + * _server_log("genericHandler", f"No metadata found for function '{function_name}'") + */ + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_funcName, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1627, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_func_name = __pyx_t_6; + __pyx_t_6 = 0; + + /* "pyrfc/_cyrfc.pyx":1628 + * + * func_name = wrapString(funcName) + * if func_name not in server_functions: # <<<<<<<<<<<<<< + * _server_log("genericHandler", f"No metadata found for function '{function_name}'") + * return RFC_NOT_FOUND + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_func_name, __pyx_t_6, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1628, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { + + /* "pyrfc/_cyrfc.pyx":1629 + * func_name = wrapString(funcName) + * if func_name not in server_functions: + * _server_log("genericHandler", f"No metadata found for function '{function_name}'") # <<<<<<<<<<<<<< + * return RFC_NOT_FOUND + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_No_metadata_found_for_function); + __pyx_t_4 += 32; + __Pyx_GIVEREF(__pyx_kp_u_No_metadata_found_for_function); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_No_metadata_found_for_function); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_function_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_4 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__6); + __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_6 = 1; + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_10 = 1; } } #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_timeout, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 432, __pyx_L10_error) + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_genericHandler, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1629, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_timeout, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 432, __pyx_L10_error) + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_genericHandler, __pyx_t_9}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1629, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else #endif { - __pyx_t_12 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 432, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; } - __Pyx_INCREF(__pyx_n_s_timeout); - __Pyx_GIVEREF(__pyx_n_s_timeout); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_n_s_timeout); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 432, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_INCREF(__pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_n_s_genericHandler); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_timeout = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/client.pyx":433 - * cancel_timer = None - * timeout = options.get('timeout', self.__config['timeout']) - * if timeout is not None: # <<<<<<<<<<<<<< - * cancel_timer = Timer(timeout, cancel_connection, (self,)) - * cancel_timer.start() + /* "pyrfc/_cyrfc.pyx":1630 + * if func_name not in server_functions: + * _server_log("genericHandler", f"No metadata found for function '{function_name}'") + * return RFC_NOT_FOUND # <<<<<<<<<<<<<< + * + * func_data = server_functions[func_name] */ - __pyx_t_2 = (__pyx_v_timeout != Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_r = RFC_NOT_FOUND; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":434 - * timeout = options.get('timeout', self.__config['timeout']) - * if timeout is not None: - * cancel_timer = Timer(timeout, cancel_connection, (self,)) # <<<<<<<<<<<<<< - * cancel_timer.start() - * for name, value in params.iteritems(): + /* "pyrfc/_cyrfc.pyx":1628 + * + * func_name = wrapString(funcName) + * if func_name not in server_functions: # <<<<<<<<<<<<<< + * _server_log("genericHandler", f"No metadata found for function '{function_name}'") + * return RFC_NOT_FOUND */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Timer); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 434, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_cancel_connection); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 434, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 434, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_7 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_timeout, __pyx_t_12, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 434, __pyx_L10_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_v_timeout, __pyx_t_12, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 434, __pyx_L10_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 434, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_v_timeout); - __Pyx_GIVEREF(__pyx_v_timeout); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_v_timeout); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_6, __pyx_t_5); - __pyx_t_12 = 0; - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 434, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_cancel_timer, __pyx_t_3); - __pyx_t_3 = 0; + } - /* "src/pyrfc/client.pyx":435 - * if timeout is not None: - * cancel_timer = Timer(timeout, cancel_connection, (self,)) - * cancel_timer.start() # <<<<<<<<<<<<<< - * for name, value in params.iteritems(): - * fillFunctionParameter(funcDesc, funcCont, name, value) + /* "pyrfc/_cyrfc.pyx":1632 + * return RFC_NOT_FOUND + * + * func_data = server_functions[func_name] # <<<<<<<<<<<<<< + * callback = func_data['callback'] + * server = func_data['server'] */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cancel_timer, __pyx_n_s_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 435, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 435, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_func_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_func_data = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":433 - * cancel_timer = None - * timeout = options.get('timeout', self.__config['timeout']) - * if timeout is not None: # <<<<<<<<<<<<<< - * cancel_timer = Timer(timeout, cancel_connection, (self,)) - * cancel_timer.start() + /* "pyrfc/_cyrfc.pyx":1633 + * + * func_data = server_functions[func_name] + * callback = func_data['callback'] # <<<<<<<<<<<<<< + * server = func_data['server'] + * # func_desc = func_data['func_desc_handle'] */ - } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_data, __pyx_n_s_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_callback = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":436 - * cancel_timer = Timer(timeout, cancel_connection, (self,)) - * cancel_timer.start() - * for name, value in params.iteritems(): # <<<<<<<<<<<<<< - * fillFunctionParameter(funcDesc, funcCont, name, value) - * # save old handle for troubleshooting + /* "pyrfc/_cyrfc.pyx":1634 + * func_data = server_functions[func_name] + * callback = func_data['callback'] + * server = func_data['server'] # <<<<<<<<<<<<<< + * # func_desc = func_data['func_desc_handle'] + * */ - __pyx_t_9 = 0; - __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_params, 1, __pyx_n_s_iteritems, (&__pyx_t_14), (&__pyx_t_6)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 436, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); - __pyx_t_3 = __pyx_t_4; - __pyx_t_4 = 0; - while (1) { - __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_14, &__pyx_t_9, &__pyx_t_4, &__pyx_t_13, NULL, __pyx_t_6); - if (unlikely(__pyx_t_15 == 0)) break; - if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(2, 436, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_13); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_13); - __pyx_t_13 = 0; + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_data, __pyx_n_s_server); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_server = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":437 - * cancel_timer.start() - * for name, value in params.iteritems(): - * fillFunctionParameter(funcDesc, funcCont, name, value) # <<<<<<<<<<<<<< - * # save old handle for troubleshooting - * with nogil: + /* "pyrfc/_cyrfc.pyx":1637 + * # func_desc = func_data['func_desc_handle'] + * + * try: # <<<<<<<<<<<<<< + * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcCont, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 437, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + /*try:*/ { - /* "src/pyrfc/client.pyx":439 - * fillFunctionParameter(funcDesc, funcCont, name, value) - * # save old handle for troubleshooting - * with nogil: # <<<<<<<<<<<<<< - * rc = RfcInvoke(self._handle, funcCont, &errorInfo) - * if cancel_timer is not None: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + /* "pyrfc/_cyrfc.pyx":1638 + * + * try: + * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + */ + __pyx_v_rc = RfcGetConnectionAttributes(__pyx_v_rfcHandle, (&__pyx_v_attributes), (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":440 - * # save old handle for troubleshooting - * with nogil: - * rc = RfcInvoke(self._handle, funcCont, &errorInfo) # <<<<<<<<<<<<<< - * if cancel_timer is not None: - * cancel_timer.cancel() + /* "pyrfc/_cyrfc.pyx":1639 + * try: + * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + * if not server.debug: */ - __pyx_v_rc = RfcInvoke(__pyx_v_self->_handle, __pyx_v_funcCont, (&__pyx_v_errorInfo)); - } + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/client.pyx":439 - * fillFunctionParameter(funcDesc, funcCont, name, value) - * # save old handle for troubleshooting - * with nogil: # <<<<<<<<<<<<<< - * rc = RfcInvoke(self._handle, funcCont, &errorInfo) - * if cancel_timer is not None: + /* "pyrfc/_cyrfc.pyx":1640 + * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) + * if rc != RFC_OK: + * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") # <<<<<<<<<<<<<< + * if not server.debug: + * raise ExternalRuntimeError(message="Invalid connection handle.") */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L22; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Request_for); + __pyx_t_4 += 13; + __Pyx_GIVEREF(__pyx_kp_u_Request_for); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Request_for); + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_kp_u_Error_while_retrieving_connecti); + __pyx_t_4 += 52; + __Pyx_GIVEREF(__pyx_kp_u_Error_while_retrieving_connecti); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u_Error_while_retrieving_connecti); + __pyx_t_9 = __Pyx_PyUnicode_From_RFC_RC(__pyx_v_rc, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_kp_u__28); + __pyx_t_4 += 2; + __Pyx_GIVEREF(__pyx_kp_u__28); + PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u__28); + __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_10 = 1; } - __pyx_L22:; } - } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_8) { + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL; + } + __Pyx_INCREF(__pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_n_s_genericHandler); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_10, __pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_10, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":441 - * with nogil: - * rc = RfcInvoke(self._handle, funcCont, &errorInfo) - * if cancel_timer is not None: # <<<<<<<<<<<<<< - * cancel_timer.cancel() - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + /* "pyrfc/_cyrfc.pyx":1641 + * if rc != RFC_OK: + * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + * if not server.debug: # <<<<<<<<<<<<<< + * raise ExternalRuntimeError(message="Invalid connection handle.") + * conn_attr = {} */ - __pyx_t_1 = (__pyx_v_cancel_timer != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_server, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1641, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1641, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((!__pyx_t_2) != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/client.pyx":442 - * rc = RfcInvoke(self._handle, funcCont, &errorInfo) - * if cancel_timer is not None: - * cancel_timer.cancel() # <<<<<<<<<<<<<< - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1642 + * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + * if not server.debug: + * raise ExternalRuntimeError(message="Invalid connection handle.") # <<<<<<<<<<<<<< + * conn_attr = {} + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1642, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1642, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_message, __pyx_kp_s_Invalid_connection_handle) < 0) __PYX_ERR(0, 1642, __pyx_L5_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1642, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_7, 0, 0, 0); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __PYX_ERR(0, 1642, __pyx_L5_error) + + /* "pyrfc/_cyrfc.pyx":1641 + * if rc != RFC_OK: + * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + * if not server.debug: # <<<<<<<<<<<<<< + * raise ExternalRuntimeError(message="Invalid connection handle.") + * conn_attr = {} */ - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_cancel_timer, __pyx_n_s_cancel); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 442, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); } + + /* "pyrfc/_cyrfc.pyx":1643 + * if not server.debug: + * raise ExternalRuntimeError(message="Invalid connection handle.") + * conn_attr = {} # <<<<<<<<<<<<<< + * else: + * conn_attr = wrapConnectionAttributes(attributes) + */ + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1643, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_conn_attr = __pyx_t_7; + __pyx_t_7 = 0; + + /* "pyrfc/_cyrfc.pyx":1639 + * try: + * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + * if not server.debug: + */ + goto __pyx_L11; } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 442, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":441 - * with nogil: - * rc = RfcInvoke(self._handle, funcCont, &errorInfo) - * if cancel_timer is not None: # <<<<<<<<<<<<<< - * cancel_timer.cancel() - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + /* "pyrfc/_cyrfc.pyx":1645 + * conn_attr = {} + * else: + * conn_attr = wrapConnectionAttributes(attributes) # <<<<<<<<<<<<<< + * _server_log( + * "genericHandler", */ - } + /*else*/ { + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapConnectionAttributes(__pyx_v_attributes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1645, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_conn_attr = __pyx_t_7; + __pyx_t_7 = 0; - /* "src/pyrfc/client.pyx":444 - * cancel_timer.cancel() - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * if errorInfo.code in ( - * RFC_COMMUNICATION_FAILURE, + /* "pyrfc/_cyrfc.pyx":1646 + * else: + * conn_attr = wrapConnectionAttributes(attributes) + * _server_log( # <<<<<<<<<<<<<< + * "genericHandler", + * "User '{user}' from system '{sysId}' client '{client}' host '{partnerHost}' invokes '{func_name}'" */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1646, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); - /* "src/pyrfc/client.pyx":445 - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - * if rc != RFC_OK: - * if errorInfo.code in ( # <<<<<<<<<<<<<< - * RFC_COMMUNICATION_FAILURE, - * RFC_ABAP_RUNTIME_FAILURE, + /* "pyrfc/_cyrfc.pyx":1649 + * "genericHandler", + * "User '{user}' from system '{sysId}' client '{client}' host '{partnerHost}' invokes '{func_name}'" + * .format(func_name=func_name, **conn_attr) # <<<<<<<<<<<<<< + * ) + * */ - switch (__pyx_v_errorInfo.code) { - case RFC_COMMUNICATION_FAILURE: + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_User_user_from_system_sysId_clie, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1649, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1649, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_func_name, __pyx_v_func_name) < 0) __PYX_ERR(0, 1649, __pyx_L5_error) + __pyx_t_9 = __pyx_t_8; + __pyx_t_8 = 0; + if (unlikely(__pyx_v_conn_attr == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 1649, __pyx_L5_error) + } + if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_conn_attr) < 0) __PYX_ERR(0, 1649, __pyx_L5_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1649, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_s_genericHandler, __pyx_t_8}; + __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1646, __pyx_L5_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_s_genericHandler, __pyx_t_8}; + __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1646, __pyx_L5_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + #endif + { + __pyx_t_1 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1646, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_INCREF(__pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_n_s_genericHandler); + PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_10, __pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_10, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1646, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L11:; - /* "src/pyrfc/client.pyx":446 - * if rc != RFC_OK: - * if errorInfo.code in ( - * RFC_COMMUNICATION_FAILURE, # <<<<<<<<<<<<<< - * RFC_ABAP_RUNTIME_FAILURE, - * RFC_ABAP_MESSAGE, + /* "pyrfc/_cyrfc.pyx":1654 + * # Context of the request. Might later be extended by activeParameter information. + * request_context = { + * 'connection_attributes': conn_attr, # <<<<<<<<<<<<<< + * 'server_context': context + * } */ - case RFC_ABAP_RUNTIME_FAILURE: + __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1654, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_connection_attributes, __pyx_v_conn_attr) < 0) __PYX_ERR(0, 1654, __pyx_L5_error) - /* "src/pyrfc/client.pyx":447 - * if errorInfo.code in ( - * RFC_COMMUNICATION_FAILURE, - * RFC_ABAP_RUNTIME_FAILURE, # <<<<<<<<<<<<<< - * RFC_ABAP_MESSAGE, - * RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":1655 + * request_context = { + * 'connection_attributes': conn_attr, + * 'server_context': context # <<<<<<<<<<<<<< + * } + * */ - case RFC_ABAP_MESSAGE: + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_server_context, __pyx_v_context) < 0) __PYX_ERR(0, 1654, __pyx_L5_error) + __pyx_v_request_context = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; - /* "src/pyrfc/client.pyx":448 - * RFC_COMMUNICATION_FAILURE, - * RFC_ABAP_RUNTIME_FAILURE, - * RFC_ABAP_MESSAGE, # <<<<<<<<<<<<<< - * RFC_EXTERNAL_FAILURE - * ) or errorInfo.group in ( + /* "pyrfc/_cyrfc.pyx":1659 + * + * # Authorization check + * auth_function = server_context["auth_check"] # <<<<<<<<<<<<<< + * rc = auth_function(func_name, request_context) + * if rc != RFC_OK: */ - case RFC_EXTERNAL_FAILURE: + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_server_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1659, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_n_s_auth_check); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1659, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_auth_function = __pyx_t_6; + __pyx_t_6 = 0; - /* "src/pyrfc/client.pyx":445 - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - * if rc != RFC_OK: - * if errorInfo.code in ( # <<<<<<<<<<<<<< - * RFC_COMMUNICATION_FAILURE, - * RFC_ABAP_RUNTIME_FAILURE, + /* "pyrfc/_cyrfc.pyx":1660 + * # Authorization check + * auth_function = server_context["auth_check"] + * rc = auth_function(func_name, request_context) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * new_error = ExternalRuntimeError( */ - __pyx_t_1 = 1; - break; - default: - __pyx_t_1 = 0; - break; + __Pyx_INCREF(__pyx_v_auth_function); + __pyx_t_7 = __pyx_v_auth_function; __pyx_t_1 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_10 = 1; + } } - __pyx_t_16 = (__pyx_t_1 != 0); - if (!__pyx_t_16) { - } else { - __pyx_t_2 = __pyx_t_16; - goto __pyx_L26_bool_binop_done; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_func_name, __pyx_v_request_context}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L5_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_6); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_func_name, __pyx_v_request_context}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L5_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_6); + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1660, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL; + } + __Pyx_INCREF(__pyx_v_func_name); + __Pyx_GIVEREF(__pyx_v_func_name); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_func_name); + __Pyx_INCREF(__pyx_v_request_context); + __Pyx_GIVEREF(__pyx_v_request_context); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_request_context); + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_14 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_6)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1660, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_rc = __pyx_t_14; - /* "src/pyrfc/client.pyx":450 - * RFC_ABAP_MESSAGE, - * RFC_EXTERNAL_FAILURE - * ) or errorInfo.group in ( # <<<<<<<<<<<<<< - * ABAP_RUNTIME_FAILURE, - * LOGON_FAILURE, + /* "pyrfc/_cyrfc.pyx":1661 + * auth_function = server_context["auth_check"] + * rc = auth_function(func_name, request_context) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * new_error = ExternalRuntimeError( + * message=f"Authentication exception raised by callback function: '{func_name}'", */ - switch (__pyx_v_errorInfo.group) { - case ABAP_RUNTIME_FAILURE: + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":451 - * RFC_EXTERNAL_FAILURE - * ) or errorInfo.group in ( - * ABAP_RUNTIME_FAILURE, # <<<<<<<<<<<<<< - * LOGON_FAILURE, - * COMMUNICATION_FAILURE, + /* "pyrfc/_cyrfc.pyx":1662 + * rc = auth_function(func_name, request_context) + * if rc != RFC_OK: + * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< + * message=f"Authentication exception raised by callback function: '{func_name}'", + * code=RFC_EXTERNAL_FAILURE */ - case LOGON_FAILURE: + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1662, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); - /* "src/pyrfc/client.pyx":452 - * ) or errorInfo.group in ( - * ABAP_RUNTIME_FAILURE, - * LOGON_FAILURE, # <<<<<<<<<<<<<< - * COMMUNICATION_FAILURE, - * EXTERNAL_RUNTIME_FAILURE): + /* "pyrfc/_cyrfc.pyx":1663 + * if rc != RFC_OK: + * new_error = ExternalRuntimeError( + * message=f"Authentication exception raised by callback function: '{func_name}'", # <<<<<<<<<<<<<< + * code=RFC_EXTERNAL_FAILURE + * ) */ - case COMMUNICATION_FAILURE: + __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1663, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1663, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Authentication_exception_raised); + __pyx_t_4 += 55; + __Pyx_GIVEREF(__pyx_kp_u_Authentication_exception_raised); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Authentication_exception_raised); + __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1663, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); + __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_4 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__6); + __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1663, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_message, __pyx_t_1) < 0) __PYX_ERR(0, 1663, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":453 - * ABAP_RUNTIME_FAILURE, - * LOGON_FAILURE, - * COMMUNICATION_FAILURE, # <<<<<<<<<<<<<< - * EXTERNAL_RUNTIME_FAILURE): - * # Connection closed, re-open + /* "pyrfc/_cyrfc.pyx":1664 + * new_error = ExternalRuntimeError( + * message=f"Authentication exception raised by callback function: '{func_name}'", + * code=RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + * ) + * fillError(new_error, serverErrorInfo) */ - case EXTERNAL_RUNTIME_FAILURE: + __pyx_t_1 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_code, __pyx_t_1) < 0) __PYX_ERR(0, 1663, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":450 - * RFC_ABAP_MESSAGE, - * RFC_EXTERNAL_FAILURE - * ) or errorInfo.group in ( # <<<<<<<<<<<<<< - * ABAP_RUNTIME_FAILURE, - * LOGON_FAILURE, + /* "pyrfc/_cyrfc.pyx":1662 + * rc = auth_function(func_name, request_context) + * if rc != RFC_OK: + * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< + * message=f"Authentication exception raised by callback function: '{func_name}'", + * code=RFC_EXTERNAL_FAILURE */ - __pyx_t_16 = 1; - break; - default: - __pyx_t_16 = 0; - break; - } - __pyx_t_1 = (__pyx_t_16 != 0); - __pyx_t_2 = __pyx_t_1; - __pyx_L26_bool_binop_done:; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1662, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_new_error = __pyx_t_1; + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":445 - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - * if rc != RFC_OK: - * if errorInfo.code in ( # <<<<<<<<<<<<<< - * RFC_COMMUNICATION_FAILURE, - * RFC_ABAP_RUNTIME_FAILURE, + /* "pyrfc/_cyrfc.pyx":1666 + * code=RFC_EXTERNAL_FAILURE + * ) + * fillError(new_error, serverErrorInfo) # <<<<<<<<<<<<<< + * return RFC_EXTERNAL_FAILURE + * */ - if (__pyx_t_2) { + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_new_error, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1666, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":456 - * EXTERNAL_RUNTIME_FAILURE): - * # Connection closed, re-open - * closed_handle = self.handle # <<<<<<<<<<<<<< - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) - * if openErrorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1667 + * ) + * fillError(new_error, serverErrorInfo) + * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + * + * # Filter out variables that are of direction u'RFC_EXPORT' */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 456, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_closed_handle = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_r = RFC_EXTERNAL_FAILURE; + goto __pyx_L9_try_return; - /* "src/pyrfc/client.pyx":457 - * # Connection closed, re-open - * closed_handle = self.handle - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) # <<<<<<<<<<<<<< - * if openErrorInfo.code != RFC_OK: - * self._handle = NULL + /* "pyrfc/_cyrfc.pyx":1661 + * auth_function = server_context["auth_check"] + * rc = auth_function(func_name, request_context) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * new_error = ExternalRuntimeError( + * message=f"Authentication exception raised by callback function: '{func_name}'", */ - __pyx_v_self->_handle = RfcOpenConnection(__pyx_v_self->_connection->_params, __pyx_v_self->_connection->_params_count, (&__pyx_v_openErrorInfo)); + } - /* "src/pyrfc/client.pyx":458 - * closed_handle = self.handle - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) - * if openErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * self._handle = NULL - * # Communication error returned as error + /* "pyrfc/_cyrfc.pyx":1671 + * # Filter out variables that are of direction u'RFC_EXPORT' + * # (these will be set by the callback function) + * func_handle_variables = wrapResult(funcDesc, funcHandle, RFC_EXPORT, server.rstrip) # <<<<<<<<<<<<<< + * + * # Invoke callback function */ - __pyx_t_2 = ((__pyx_v_openErrorInfo.code != RFC_OK) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_server, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1671, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapResult(__pyx_v_funcDesc, __pyx_v_funcHandle, RFC_EXPORT, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1671, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_func_handle_variables = __pyx_t_7; + __pyx_t_7 = 0; - /* "src/pyrfc/client.pyx":459 - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) - * if openErrorInfo.code != RFC_OK: - * self._handle = NULL # <<<<<<<<<<<<<< - * # Communication error returned as error - * errorInfo = openErrorInfo + /* "pyrfc/_cyrfc.pyx":1674 + * + * # Invoke callback function + * result = callback(request_context, **func_handle_variables) # <<<<<<<<<<<<<< + * + * # Return results */ - __pyx_v_self->_handle = NULL; + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1674, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_request_context); + __Pyx_GIVEREF(__pyx_v_request_context); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_request_context); + if (unlikely(__pyx_v_func_handle_variables == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 1674, __pyx_L5_error) + } + if (likely(PyDict_CheckExact(__pyx_v_func_handle_variables))) { + __pyx_t_1 = PyDict_Copy(__pyx_v_func_handle_variables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1674, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_func_handle_variables, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1674, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_callback, __pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1674, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_result = __pyx_t_6; + __pyx_t_6 = 0; - /* "src/pyrfc/client.pyx":461 - * self._handle = NULL - * # Communication error returned as error - * errorInfo = openErrorInfo # <<<<<<<<<<<<<< - * elif errorInfo.code == RFC_CANCELED: - * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") + /* "pyrfc/_cyrfc.pyx":1677 + * + * # Return results + * if context["call_type"] != UnitCallType.background_unit: # <<<<<<<<<<<<<< + * for name, value in result.iteritems(): + * fillFunctionParameter(funcDesc, funcHandle, name, value) */ - __pyx_v_errorInfo = __pyx_v_openErrorInfo; + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_context, __pyx_n_s_call_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1677, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_UnitCallType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1677, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_background_unit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1677, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1677, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1677, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":458 - * closed_handle = self.handle - * self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) - * if openErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * self._handle = NULL - * # Communication error returned as error + /* "pyrfc/_cyrfc.pyx":1678 + * # Return results + * if context["call_type"] != UnitCallType.background_unit: + * for name, value in result.iteritems(): # <<<<<<<<<<<<<< + * fillFunctionParameter(funcDesc, funcHandle, name, value) + * */ - goto __pyx_L28; + __pyx_t_4 = 0; + if (unlikely(__pyx_v_result == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(0, 1678, __pyx_L5_error) } + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_result, 0, __pyx_n_s_iteritems, (&__pyx_t_15), (&__pyx_t_10)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1678, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_7; + __pyx_t_7 = 0; + while (1) { + __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_15, &__pyx_t_4, &__pyx_t_7, &__pyx_t_6, NULL, __pyx_t_10); + if (unlikely(__pyx_t_16 == 0)) break; + if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 1678, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; - /* "src/pyrfc/client.pyx":462 - * # Communication error returned as error - * errorInfo = openErrorInfo - * elif errorInfo.code == RFC_CANCELED: # <<<<<<<<<<<<<< - * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") - * self._error(&errorInfo) - */ - __pyx_t_2 = ((__pyx_v_errorInfo.code == RFC_CANCELED) != 0); - if (__pyx_t_2) { - - /* "src/pyrfc/client.pyx":463 - * errorInfo = openErrorInfo - * elif errorInfo.code == RFC_CANCELED: - * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: - */ - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 463, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_14 = 0; - __pyx_t_10 = 127; - __Pyx_INCREF(__pyx_kp_u_Connection_was_canceled); - __pyx_t_14 += 25; - __Pyx_GIVEREF(__pyx_kp_u_Connection_was_canceled); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Connection_was_canceled); - __pyx_t_13 = __Pyx_PyObject_FormatSimple(__pyx_v_closed_handle, __pyx_empty_unicode); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 463, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13) : __pyx_t_10; - __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_13); - __pyx_t_13 = 0; - __Pyx_INCREF(__pyx_kp_u_New_handle); - __pyx_t_14 += 14; - __Pyx_GIVEREF(__pyx_kp_u_New_handle); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_New_handle); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_handle); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 463, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_13, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 463, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_10; - __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 4, __pyx_t_14, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 463, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_4); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(2, 463, __pyx_L10_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - memcpy(&(__pyx_v_errorInfo.message[0]), __pyx_t_8, sizeof(__pyx_v_errorInfo.message[0]) * (0x200 - 0)); - - /* "src/pyrfc/client.pyx":462 - * # Communication error returned as error - * errorInfo = openErrorInfo - * elif errorInfo.code == RFC_CANCELED: # <<<<<<<<<<<<<< - * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1679 + * if context["call_type"] != UnitCallType.background_unit: + * for name, value in result.iteritems(): + * fillFunctionParameter(funcDesc, funcHandle, name, value) # <<<<<<<<<<<<<< + * + * # Server exception handling: cf. SAP NetWeaver RFC SDK 7.50 */ + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcHandle, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1679, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_L28:; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":445 - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - * if rc != RFC_OK: - * if errorInfo.code in ( # <<<<<<<<<<<<<< - * RFC_COMMUNICATION_FAILURE, - * RFC_ABAP_RUNTIME_FAILURE, + /* "pyrfc/_cyrfc.pyx":1677 + * + * # Return results + * if context["call_type"] != UnitCallType.background_unit: # <<<<<<<<<<<<<< + * for name, value in result.iteritems(): + * fillFunctionParameter(funcDesc, funcHandle, name, value) */ } - /* "src/pyrfc/client.pyx":464 - * elif errorInfo.code == RFC_CANCELED: - * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: - * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) - */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 464, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "src/pyrfc/client.pyx":444 - * cancel_timer.cancel() - * # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * if errorInfo.code in ( - * RFC_COMMUNICATION_FAILURE, + /* "pyrfc/_cyrfc.pyx":1637 + * # func_desc = func_data['func_desc_handle'] + * + * try: # <<<<<<<<<<<<<< + * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) + * if rc != RFC_OK: */ } + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L10_try_end; + __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/pyrfc/client.pyx":465 - * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") - * self._error(&errorInfo) - * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: # <<<<<<<<<<<<<< - * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) - * else: - */ - __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 465, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RETURN_IMPORT_PARAMS); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 465, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = PyNumber_And(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 465, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 465, __pyx_L10_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (__pyx_t_2) { - - /* "src/pyrfc/client.pyx":466 - * self._error(&errorInfo) - * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: - * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) # <<<<<<<<<<<<<< - * else: - * return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) + /* "pyrfc/_cyrfc.pyx":1683 + * # Server exception handling: cf. SAP NetWeaver RFC SDK 7.50 + * # 5.1 Preparing a Server Program for Receiving RFC Requests + * except ExternalRuntimeError as e: # System failure # <<<<<<<<<<<<<< + * # Parameter: message (optional: msg_type, msg_class, msg_number, msg_v1-v4) + * # returns: RFC_EXTERNAL_FAILURE */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_13 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 466, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapResult(__pyx_v_funcDesc, __pyx_v_funcCont, ((RFC_DIRECTION)0), __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 466, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L9_return; + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1683, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 1683, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __pyx_v_e = __pyx_t_6; - /* "src/pyrfc/client.pyx":465 - * errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") - * self._error(&errorInfo) - * if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: # <<<<<<<<<<<<<< - * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) - * else: + /* "pyrfc/_cyrfc.pyx":1686 + * # Parameter: message (optional: msg_type, msg_class, msg_number, msg_v1-v4) + * # returns: RFC_EXTERNAL_FAILURE + * fillError(e, serverErrorInfo) # <<<<<<<<<<<<<< + * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") */ - } + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_e, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1686, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/pyrfc/client.pyx":468 - * return wrapResult(funcDesc, funcCont, 0, self.__bconfig) - * else: - * return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) # <<<<<<<<<<<<<< - * finally: - * RfcDestroyFunction(funcCont, NULL) + /* "pyrfc/_cyrfc.pyx":1687 + * # returns: RFC_EXTERNAL_FAILURE + * fillError(e, serverErrorInfo) + * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. # <<<<<<<<<<<<<< + * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") + * return RFC_EXTERNAL_FAILURE */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_self->__pyx___bconfig); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 468, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_wrapResult(__pyx_v_funcDesc, __pyx_v_funcCont, RFC_IMPORT, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 468, __pyx_L10_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_13; - __pyx_t_13 = 0; - goto __pyx_L9_return; - } - } + __pyx_v_serverErrorInfo->code = RFC_EXTERNAL_FAILURE; - /* "src/pyrfc/client.pyx":470 - * return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) - * finally: - * RfcDestroyFunction(funcCont, NULL) # <<<<<<<<<<<<<< - * - * ########################################################################## + /* "pyrfc/_cyrfc.pyx":1688 + * fillError(e, serverErrorInfo) + * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") # <<<<<<<<<<<<<< + * return RFC_EXTERNAL_FAILURE + * except ABAPRuntimeError as e: # ABAP Message */ - /*finally:*/ { - __pyx_L10_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __pyx_t_6 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_17 = __pyx_filename; - { - (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_server_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_17 = PyTuple_New(5); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_15 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Request_for); + __pyx_t_15 += 13; + __Pyx_GIVEREF(__pyx_kp_u_Request_for); + PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_kp_u_Request_for); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_raises_ExternalRuntimeError); + __pyx_t_15 += 30; + __Pyx_GIVEREF(__pyx_kp_u_raises_ExternalRuntimeError); + PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_kp_u_raises_ExternalRuntimeError); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_code_set_to_RFC_EXTERNAL_FAILUR); + __pyx_t_15 += 36; + __Pyx_GIVEREF(__pyx_kp_u_code_set_to_RFC_EXTERNAL_FAILUR); + PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_kp_u_code_set_to_RFC_EXTERNAL_FAILUR); + __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_17, 5, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; + } } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + { + __pyx_t_19 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_19); + if (__pyx_t_17) { + __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17); __pyx_t_17 = NULL; + } + __Pyx_INCREF(__pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_n_s_genericHandler); + PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_18); + __pyx_t_18 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_19, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1688, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; } - __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); - __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; - __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_17; - goto __pyx_L1_error; - } - __pyx_L9_return: { - __pyx_t_23 = __pyx_r; - __pyx_r = 0; - (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); - __pyx_r = __pyx_t_23; - __pyx_t_23 = 0; - goto __pyx_L0; - } - } - - /* "src/pyrfc/client.pyx":367 - * return wrapFunctionDescription(funcDesc) - * - * def call(self, func_name, options=None, **params): # <<<<<<<<<<<<<< - * """ Invokes a remote-enabled function module via RFC. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.call", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_skip_parameters); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_cancel_timer); - __Pyx_XDECREF(__pyx_v_timeout); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_closed_handle); - __Pyx_XDECREF(__pyx_v_options); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":475 - * # HELPER METHODS - * - * def type_desc_get(self, type_name): # <<<<<<<<<<<<<< - * """Removes the Type Description from SAP NW RFC Lib cache - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_35type_desc_get(PyObject *__pyx_v_self, PyObject *__pyx_v_type_name); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_34type_desc_get[] = "Removes the Type Description from SAP NW RFC Lib cache\n\n :param type_name: system id (connection parameters sysid)\n :type type_name: string\n\n :returns: error code\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_35type_desc_get(PyObject *__pyx_v_self, PyObject *__pyx_v_type_name) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("type_desc_get (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_34type_desc_get(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_type_name)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_34type_desc_get(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_type_name) { - RFC_ERROR_INFO __pyx_v_errorInfo; - SAP_UC *__pyx_v_typeName; - RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - SAP_UC *__pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("type_desc_get", 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/pyrfc/client.pyx":484 - * """ - * cdef RFC_ERROR_INFO errorInfo - * typeName = fillString(type_name.upper()) # <<<<<<<<<<<<<< - * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) - * free(typeName) + /* "pyrfc/_cyrfc.pyx":1689 + * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") + * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + * except ABAPRuntimeError as e: # ABAP Message + * # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_name, __pyx_n_s_upper); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_r = RFC_EXTERNAL_FAILURE; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L8_except_return; } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 484, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_typeName = __pyx_t_4; - /* "src/pyrfc/client.pyx":485 - * cdef RFC_ERROR_INFO errorInfo - * typeName = fillString(type_name.upper()) - * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) # <<<<<<<<<<<<<< - * free(typeName) - * if typeDesc == NULL: + /* "pyrfc/_cyrfc.pyx":1690 + * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") + * return RFC_EXTERNAL_FAILURE + * except ABAPRuntimeError as e: # ABAP Message # <<<<<<<<<<<<<< + * # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 + * # returns: RFC_ABAP_MESSAGE */ - __pyx_v_typeDesc = RfcGetTypeDesc(__pyx_v_self->_handle, __pyx_v_typeName, (&__pyx_v_errorInfo)); + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ABAPRuntimeError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1690, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 1690, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __pyx_v_e = __pyx_t_6; - /* "src/pyrfc/client.pyx":486 - * typeName = fillString(type_name.upper()) - * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) - * free(typeName) # <<<<<<<<<<<<<< - * if typeDesc == NULL: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1693 + * # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 + * # returns: RFC_ABAP_MESSAGE + * fillError(e, serverErrorInfo) # <<<<<<<<<<<<<< + * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") */ - free(__pyx_v_typeName); + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_e, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1693, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/pyrfc/client.pyx":487 - * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) - * free(typeName) - * if typeDesc == NULL: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapTypeDescription(typeDesc) + /* "pyrfc/_cyrfc.pyx":1694 + * # returns: RFC_ABAP_MESSAGE + * fillError(e, serverErrorInfo) + * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. # <<<<<<<<<<<<<< + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") + * return RFC_ABAP_MESSAGE */ - __pyx_t_5 = ((__pyx_v_typeDesc == NULL) != 0); - if (__pyx_t_5) { + __pyx_v_serverErrorInfo->code = RFC_ABAP_MESSAGE; - /* "src/pyrfc/client.pyx":488 - * free(typeName) - * if typeDesc == NULL: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * return wrapTypeDescription(typeDesc) - * + /* "pyrfc/_cyrfc.pyx":1695 + * fillError(e, serverErrorInfo) + * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") # <<<<<<<<<<<<<< + * return RFC_ABAP_MESSAGE + * except ABAPApplicationError as e: # ABAP Exception in implementing function */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_server_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_19 = PyTuple_New(5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_15 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Request_for); + __pyx_t_15 += 13; + __Pyx_GIVEREF(__pyx_kp_u_Request_for); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_u_Request_for); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_raises_ABAPRuntimeError); + __pyx_t_15 += 26; + __Pyx_GIVEREF(__pyx_kp_u_raises_ABAPRuntimeError); + PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_u_raises_ABAPRuntimeError); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_code_set_to_RFC_ABAP_MESSAGE); + __pyx_t_15 += 32; + __Pyx_GIVEREF(__pyx_kp_u_code_set_to_RFC_ABAP_MESSAGE); + PyTuple_SET_ITEM(__pyx_t_19, 4, __pyx_kp_u_code_set_to_RFC_ABAP_MESSAGE); + __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_19, 5, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + { + __pyx_t_17 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_17); + if (__pyx_t_19) { + __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_19); __pyx_t_19 = NULL; + } + __Pyx_INCREF(__pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_n_s_genericHandler); + PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_10, __pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_10, __pyx_t_18); + __pyx_t_18 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_17, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1695, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "src/pyrfc/client.pyx":487 - * cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) - * free(typeName) - * if typeDesc == NULL: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapTypeDescription(typeDesc) + /* "pyrfc/_cyrfc.pyx":1696 + * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") + * return RFC_ABAP_MESSAGE # <<<<<<<<<<<<<< + * except ABAPApplicationError as e: # ABAP Exception in implementing function + * # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) + */ + __pyx_r = RFC_ABAP_MESSAGE; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L8_except_return; + } + + /* "pyrfc/_cyrfc.pyx":1697 + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") + * return RFC_ABAP_MESSAGE + * except ABAPApplicationError as e: # ABAP Exception in implementing function # <<<<<<<<<<<<<< + * # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) + * # returns: RFC_ABAP_EXCEPTION + */ + __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ABAPApplicationError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1697, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7); + __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(0, 1697, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __pyx_v_e = __pyx_t_6; + + /* "pyrfc/_cyrfc.pyx":1700 + * # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) + * # returns: RFC_ABAP_EXCEPTION + * fillError(e, serverErrorInfo) # <<<<<<<<<<<<<< + * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") + */ + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_e, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1700, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "pyrfc/_cyrfc.pyx":1701 + * # returns: RFC_ABAP_EXCEPTION + * fillError(e, serverErrorInfo) + * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. # <<<<<<<<<<<<<< + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") + * return RFC_ABAP_EXCEPTION + */ + __pyx_v_serverErrorInfo->code = RFC_ABAP_EXCEPTION; + + /* "pyrfc/_cyrfc.pyx":1702 + * fillError(e, serverErrorInfo) + * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") # <<<<<<<<<<<<<< + * return RFC_ABAP_EXCEPTION + * except Exception as ex: + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_server_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_17 = PyTuple_New(5); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_17); + __pyx_t_15 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Request_for); + __pyx_t_15 += 13; + __Pyx_GIVEREF(__pyx_kp_u_Request_for); + PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_kp_u_Request_for); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_raises_ABAPApplicationError); + __pyx_t_15 += 30; + __Pyx_GIVEREF(__pyx_kp_u_raises_ABAPApplicationError); + PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_kp_u_raises_ABAPApplicationError); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_code_set_to_RFC_ABAP_EXCEPTION); + __pyx_t_15 += 34; + __Pyx_GIVEREF(__pyx_kp_u_code_set_to_RFC_ABAP_EXCEPTION); + PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_kp_u_code_set_to_RFC_ABAP_EXCEPTION); + __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_17, 5, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_17 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + { + __pyx_t_19 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_19); + if (__pyx_t_17) { + __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17); __pyx_t_17 = NULL; + } + __Pyx_INCREF(__pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_n_s_genericHandler); + PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_18); + __pyx_t_18 = 0; + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_19, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1702, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "pyrfc/_cyrfc.pyx":1703 + * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") + * return RFC_ABAP_EXCEPTION # <<<<<<<<<<<<<< + * except Exception as ex: + * exctype, value = exc_info()[:2] + */ + __pyx_r = RFC_ABAP_EXCEPTION; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L8_except_return; + } + + /* "pyrfc/_cyrfc.pyx":1704 + * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") + * return RFC_ABAP_EXCEPTION + * except Exception as ex: # <<<<<<<<<<<<<< + * exctype, value = exc_info()[:2] + * _server_log( + */ + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1704, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __pyx_v_ex = __pyx_t_6; + + /* "pyrfc/_cyrfc.pyx":1705 + * return RFC_ABAP_EXCEPTION + * except Exception as ex: + * exctype, value = exc_info()[:2] # <<<<<<<<<<<<<< + * _server_log( + * "genericHandler", + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1705, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_19 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + __pyx_t_8 = (__pyx_t_19) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_19) : __Pyx_PyObject_CallNoArg(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1705, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_t_8, 0, 2, NULL, NULL, &__pyx_slice__29, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1705, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { + PyObject* sequence = __pyx_t_9; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1705, __pyx_L7_except_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_19 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + __pyx_t_19 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_19); + #else + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1705, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_19 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1705, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_19); + #endif + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_18 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1705, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_20 = Py_TYPE(__pyx_t_18)->tp_iternext; + index = 0; __pyx_t_8 = __pyx_t_20(__pyx_t_18); if (unlikely(!__pyx_t_8)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_19 = __pyx_t_20(__pyx_t_18); if (unlikely(!__pyx_t_19)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_19); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_18), 2) < 0) __PYX_ERR(0, 1705, __pyx_L7_except_error) + __pyx_t_20 = NULL; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L26_unpacking_done; + __pyx_L25_unpacking_failed:; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_20 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1705, __pyx_L7_except_error) + __pyx_L26_unpacking_done:; + } + __pyx_v_exctype = __pyx_t_8; + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_19); + __pyx_t_19 = 0; + + /* "pyrfc/_cyrfc.pyx":1706 + * except Exception as ex: + * exctype, value = exc_info()[:2] + * _server_log( # <<<<<<<<<<<<<< + * "genericHandler", + * f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" + */ + __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_server_log); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1706, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_19); + + /* "pyrfc/_cyrfc.pyx":1708 + * _server_log( + * "genericHandler", + * f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" # <<<<<<<<<<<<<< + * "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" + * "The values of the request were:\n" + */ + __pyx_t_8 = PyTuple_New(10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1708, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_15 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Request_for); + __pyx_t_15 += 13; + __Pyx_GIVEREF(__pyx_kp_u_Request_for); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Request_for); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1708, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_raises_an_invalid_exception_Exc); + __pyx_t_15 += 43; + __Pyx_GIVEREF(__pyx_kp_u_raises_an_invalid_exception_Exc); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u_raises_an_invalid_exception_Exc); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_exctype, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1708, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_Values); + __pyx_t_15 += 10; + __Pyx_GIVEREF(__pyx_kp_u_Values); + PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_Values); + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1708, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_Callback_functions_may_only_rai); + __pyx_t_15 += 140; + __Pyx_GIVEREF(__pyx_kp_u_Callback_functions_may_only_rai); + PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_kp_u_Callback_functions_may_only_rai); + + /* "pyrfc/_cyrfc.pyx":1711 + * "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" + * "The values of the request were:\n" + * f"params: {func_handle_variables}\nrequest_context: {request_context}" # <<<<<<<<<<<<<< + * ) + * new_error = ExternalRuntimeError( + */ + if (unlikely(!__pyx_v_func_handle_variables)) { __Pyx_RaiseUnboundLocalError("func_handle_variables"); __PYX_ERR(0, 1711, __pyx_L7_except_error) } + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_handle_variables, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1711, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_INCREF(__pyx_kp_u_request_context_2); + __pyx_t_15 += 18; + __Pyx_GIVEREF(__pyx_kp_u_request_context_2); + PyTuple_SET_ITEM(__pyx_t_8, 8, __pyx_kp_u_request_context_2); + if (unlikely(!__pyx_v_request_context)) { __Pyx_RaiseUnboundLocalError("request_context"); __PYX_ERR(0, 1711, __pyx_L7_except_error) } + __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_request_context, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1711, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; + __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_8, 9, __pyx_t_18); + __pyx_t_18 = 0; + + /* "pyrfc/_cyrfc.pyx":1708 + * _server_log( + * "genericHandler", + * f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" # <<<<<<<<<<<<<< + * "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" + * "The values of the request were:\n" + */ + __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_8, 10, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1708, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1706, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_18}; + __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1706, __pyx_L7_except_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + { + __pyx_t_17 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1706, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_17); + if (__pyx_t_8) { + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_8); __pyx_t_8 = NULL; + } + __Pyx_INCREF(__pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_n_s_genericHandler); + PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_10, __pyx_n_s_genericHandler); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_10, __pyx_t_18); + __pyx_t_18 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_17, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1706, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + } + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "pyrfc/_cyrfc.pyx":1713 + * f"params: {func_handle_variables}\nrequest_context: {request_context}" + * ) + * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< + * message="Invalid exception raised by callback function.", + * code=RFC_EXTERNAL_FAILURE + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1713, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_9); + + /* "pyrfc/_cyrfc.pyx":1714 + * ) + * new_error = ExternalRuntimeError( + * message="Invalid exception raised by callback function.", # <<<<<<<<<<<<<< + * code=RFC_EXTERNAL_FAILURE + * ) + */ + __pyx_t_19 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1714, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_19); + if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_message, __pyx_kp_s_Invalid_exception_raised_by_call) < 0) __PYX_ERR(0, 1714, __pyx_L7_except_error) + + /* "pyrfc/_cyrfc.pyx":1715 + * new_error = ExternalRuntimeError( + * message="Invalid exception raised by callback function.", + * code=RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + * ) + * fillError(new_error, serverErrorInfo) + */ + __pyx_t_17 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1715, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_17); + if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_code, __pyx_t_17) < 0) __PYX_ERR(0, 1714, __pyx_L7_except_error) + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + + /* "pyrfc/_cyrfc.pyx":1713 + * f"params: {func_handle_variables}\nrequest_context: {request_context}" + * ) + * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< + * message="Invalid exception raised by callback function.", + * code=RFC_EXTERNAL_FAILURE + */ + __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1713, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF_SET(__pyx_v_new_error, __pyx_t_17); + __pyx_t_17 = 0; + + /* "pyrfc/_cyrfc.pyx":1717 + * code=RFC_EXTERNAL_FAILURE + * ) + * fillError(new_error, serverErrorInfo) # <<<<<<<<<<<<<< + * return RFC_EXTERNAL_FAILURE + * + */ + __pyx_t_17 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_new_error, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1717, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + + /* "pyrfc/_cyrfc.pyx":1718 + * ) + * fillError(new_error, serverErrorInfo) + * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + * + * return RFC_OK + */ + __pyx_r = RFC_EXTERNAL_FAILURE; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L8_except_return; + } + goto __pyx_L7_except_error; + __pyx_L7_except_error:; + + /* "pyrfc/_cyrfc.pyx":1637 + * # func_desc = func_data['func_desc_handle'] + * + * try: # <<<<<<<<<<<<<< + * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) + * if rc != RFC_OK: */ + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L1_error; + __pyx_L9_try_return:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L0; + __pyx_L8_except_return:; + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); + goto __pyx_L0; + __pyx_L10_try_end:; } - /* "src/pyrfc/client.pyx":489 - * if typeDesc == NULL: - * self._error(&errorInfo) - * return wrapTypeDescription(typeDesc) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1720 + * return RFC_EXTERNAL_FAILURE + * + * return RFC_OK # <<<<<<<<<<<<<< + * * - * def type_desc_remove(self, sysid, type_name): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(__pyx_v_typeDesc); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = RFC_OK; goto __pyx_L0; - /* "src/pyrfc/client.pyx":475 - * # HELPER METHODS - * - * def type_desc_get(self, type_name): # <<<<<<<<<<<<<< - * """Removes the Type Description from SAP NW RFC Lib cache + /* "pyrfc/_cyrfc.pyx":1604 + * return server_context * + * cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.type_desc_get", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_WriteUnraisable("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = (RFC_RC) 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_context); + __Pyx_XDECREF(__pyx_v_err_msg); + __Pyx_XDECREF(__pyx_v_new_error); + __Pyx_XDECREF(__pyx_v_func_name); + __Pyx_XDECREF(__pyx_v_func_data); + __Pyx_XDECREF(__pyx_v_callback); + __Pyx_XDECREF(__pyx_v_server); + __Pyx_XDECREF(__pyx_v_conn_attr); + __Pyx_XDECREF(__pyx_v_request_context); + __Pyx_XDECREF(__pyx_v_auth_function); + __Pyx_XDECREF(__pyx_v_func_handle_variables); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_v_ex); + __Pyx_XDECREF(__pyx_v_exctype); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "src/pyrfc/client.pyx":491 - * return wrapTypeDescription(typeDesc) - * - * def type_desc_remove(self, sysid, type_name): # <<<<<<<<<<<<<< - * """Removes the Type Description from SAP NW RFC Lib cache +/* "pyrfc/_cyrfc.pyx":1769 + * } * + * def __cinit__(self, server_params, client_params, config=None): # <<<<<<<<<<<<<< + * # config parsing + * config = config or {} */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_37type_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_36type_desc_remove[] = "Removes the Type Description from SAP NW RFC Lib cache\n\n :param sysid: system id (connection parameters sysid)\n :type sysid: string\n\n :param type_name: Name of the type to be removed\n :type func_name: string\n\n :returns: error code\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_37type_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_sysid = 0; - PyObject *__pyx_v_type_name = 0; +static int __pyx_pw_5pyrfc_6_cyrfc_6Server_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_6Server_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_server_params = 0; + PyObject *__pyx_v_client_params = 0; + PyObject *__pyx_v_config = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("type_desc_remove (wrapper)", 0); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sysid,&__pyx_n_s_type_name,0}; - PyObject* values[2] = {0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_server_params,&__pyx_n_s_client_params,&__pyx_n_s_config,0}; + PyObject* values[3] = {0,0,0}; + values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 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); @@ -22771,2007 +21890,2393 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_37type_desc_remove(PyObjec kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sysid)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_server_params)) != 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_type_name)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_client_params)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("type_desc_remove", 1, 2, 2, 1); __PYX_ERR(2, 491, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(0, 1769, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_config); + if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "type_desc_remove") < 0)) __PYX_ERR(2, 491, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1769, __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); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } - __pyx_v_sysid = values[0]; - __pyx_v_type_name = values[1]; + __pyx_v_server_params = values[0]; + __pyx_v_client_params = values[1]; + __pyx_v_config = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("type_desc_remove", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 491, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1769, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.type_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_36type_desc_remove(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_sysid, __pyx_v_type_name); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server___cinit__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), __pyx_v_server_params, __pyx_v_client_params, __pyx_v_config); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_36type_desc_remove(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_sysid, PyObject *__pyx_v_type_name) { - RFC_ERROR_INFO __pyx_v_errorInfo; - SAP_UC *__pyx_v_sysId; - SAP_UC *__pyx_v_typeName; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; +static int __pyx_pf_5pyrfc_6_cyrfc_6Server___cinit__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_server_params, PyObject *__pyx_v_client_params, PyObject *__pyx_v_config) { + int __pyx_r; __Pyx_RefNannyDeclarations - SAP_UC *__pyx_t_1; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("type_desc_remove", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_INCREF(__pyx_v_config); - /* "src/pyrfc/client.pyx":503 - * """ - * cdef RFC_ERROR_INFO errorInfo - * sysId = fillString(sysid) # <<<<<<<<<<<<<< - * typeName = fillString(type_name) - * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1771 + * def __cinit__(self, server_params, client_params, config=None): + * # config parsing + * config = config or {} # <<<<<<<<<<<<<< + * self.debug = config.get('debug', False) + * self.rstrip = config.get('rstrip', True) */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_sysid); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(2, 503, __pyx_L1_error) - __pyx_v_sysId = __pyx_t_1; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_config); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1771, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __Pyx_INCREF(__pyx_v_config); + __pyx_t_1 = __pyx_v_config; + goto __pyx_L3_bool_binop_done; + } + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_L3_bool_binop_done:; + __Pyx_DECREF_SET(__pyx_v_config, __pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":504 - * cdef RFC_ERROR_INFO errorInfo - * sysId = fillString(sysid) - * typeName = fillString(type_name) # <<<<<<<<<<<<<< - * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) - * free(sysId) - */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_type_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(2, 504, __pyx_L1_error) - __pyx_v_typeName = __pyx_t_1; - - /* "src/pyrfc/client.pyx":505 - * sysId = fillString(sysid) - * typeName = fillString(type_name) - * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) # <<<<<<<<<<<<<< - * free(sysId) - * free(typeName) - */ - __pyx_v_rc = RfcRemoveTypeDesc(__pyx_v_sysId, __pyx_v_typeName, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":506 - * typeName = fillString(type_name) - * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) - * free(sysId) # <<<<<<<<<<<<<< - * free(typeName) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1772 + * # config parsing + * config = config or {} + * self.debug = config.get('debug', False) # <<<<<<<<<<<<<< + * self.rstrip = config.get('rstrip', True) + * server_context["server_log"] = config.get("server_log", False) */ - free(__pyx_v_sysId); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1772, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->debug = __pyx_t_2; - /* "src/pyrfc/client.pyx":507 - * cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) - * free(sysId) - * free(typeName) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1773 + * config = config or {} + * self.debug = config.get('debug', False) + * self.rstrip = config.get('rstrip', True) # <<<<<<<<<<<<<< + * server_context["server_log"] = config.get("server_log", False) + * server_context["auth_check"] = config.get("auth_check", default_auth_check) */ - free(__pyx_v_typeName); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1773, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->rstrip = __pyx_t_2; - /* "src/pyrfc/client.pyx":508 - * free(sysId) - * free(typeName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return rc + /* "pyrfc/_cyrfc.pyx":1774 + * self.debug = config.get('debug', False) + * self.rstrip = config.get('rstrip', True) + * server_context["server_log"] = config.get("server_log", False) # <<<<<<<<<<<<<< + * server_context["auth_check"] = config.get("auth_check", default_auth_check) + * server_context["port"] = config.get("port", 8080) */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_server_log_2, __pyx_t_3) < 0)) __PYX_ERR(0, 1774, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":509 - * free(typeName) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * return rc + /* "pyrfc/_cyrfc.pyx":1775 + * self.rstrip = config.get('rstrip', True) + * server_context["server_log"] = config.get("server_log", False) + * server_context["auth_check"] = config.get("auth_check", default_auth_check) # <<<<<<<<<<<<<< + * server_context["port"] = config.get("port", 8080) * */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 509, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_default_auth_check); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_auth_check, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":508 - * free(sysId) - * free(typeName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return rc - */ + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_auth_check, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_INCREF(__pyx_n_s_auth_check); + __Pyx_GIVEREF(__pyx_n_s_auth_check); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_s_auth_check); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_auth_check, __pyx_t_3) < 0)) __PYX_ERR(0, 1775, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":510 - * if rc != RFC_OK: - * self._error(&errorInfo) - * return rc # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1776 + * server_context["server_log"] = config.get("server_log", False) + * server_context["auth_check"] = config.get("auth_check", default_auth_check) + * server_context["port"] = config.get("port", 8080) # <<<<<<<<<<<<<< * - * def func_desc_remove(self, sysid, func_name): + * self._client_connection = Connection(**client_params) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 510, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_port, __pyx_t_1) < 0)) __PYX_ERR(0, 1776, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":491 - * return wrapTypeDescription(typeDesc) - * - * def type_desc_remove(self, sysid, type_name): # <<<<<<<<<<<<<< - * """Removes the Type Description from SAP NW RFC Lib cache + /* "pyrfc/_cyrfc.pyx":1778 + * server_context["port"] = config.get("port", 8080) * + * self._client_connection = Connection(**client_params) # <<<<<<<<<<<<<< + * self._server_connection = ServerConnection(**server_params) + * self._server_thread=Thread(target=self.serve) */ + if (unlikely(__pyx_v_client_params == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 1778, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_v_client_params))) { + __pyx_t_1 = PyDict_Copy(__pyx_v_client_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1778, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_client_params, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1778, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Connection), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1778, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->_client_connection); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_client_connection)); + __pyx_v_self->_client_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_t_3); + __pyx_t_3 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.type_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":512 - * return rc + /* "pyrfc/_cyrfc.pyx":1779 * - * def func_desc_remove(self, sysid, func_name): # <<<<<<<<<<<<<< - * """Removes the Function Description from SAP NW RFC Lib cache + * self._client_connection = Connection(**client_params) + * self._server_connection = ServerConnection(**server_params) # <<<<<<<<<<<<<< + * self._server_thread=Thread(target=self.serve) * */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_39func_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_38func_desc_remove[] = "Removes the Function Description from SAP NW RFC Lib cache\n\n :param sysid: system id (connection parameters sysid)\n :type sysid: string\n\n :param func_name: Name of the function module to be removed\n :type func_name: string\n\n :returns: error code\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_39func_desc_remove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_sysid = 0; - PyObject *__pyx_v_func_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("func_desc_remove (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sysid,&__pyx_n_s_func_name,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_sysid)) != 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_func_name)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("func_desc_remove", 1, 2, 2, 1); __PYX_ERR(2, 512, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "func_desc_remove") < 0)) __PYX_ERR(2, 512, __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_sysid = values[0]; - __pyx_v_func_name = values[1]; + if (unlikely(__pyx_v_server_params == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 1779, __pyx_L1_error) } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("func_desc_remove", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 512, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.func_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_38func_desc_remove(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_sysid, __pyx_v_func_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_38func_desc_remove(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_sysid, PyObject *__pyx_v_func_name) { - RFC_ERROR_INFO __pyx_v_errorInfo; - SAP_UC *__pyx_v_sysId; - SAP_UC *__pyx_v_funcName; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - SAP_UC *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("func_desc_remove", 0); - - /* "src/pyrfc/client.pyx":524 - * """ - * cdef RFC_ERROR_INFO errorInfo - * sysId = fillString(sysid) # <<<<<<<<<<<<<< - * funcName = fillString(func_name) - * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) - */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_sysid); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(2, 524, __pyx_L1_error) - __pyx_v_sysId = __pyx_t_1; - - /* "src/pyrfc/client.pyx":525 - * cdef RFC_ERROR_INFO errorInfo - * sysId = fillString(sysid) - * funcName = fillString(func_name) # <<<<<<<<<<<<<< - * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) - * free(sysId) - */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(2, 525, __pyx_L1_error) - __pyx_v_funcName = __pyx_t_1; - - /* "src/pyrfc/client.pyx":526 - * sysId = fillString(sysid) - * funcName = fillString(func_name) - * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) # <<<<<<<<<<<<<< - * free(sysId) - * free(funcName) - */ - __pyx_v_rc = RfcRemoveFunctionDesc(__pyx_v_sysId, __pyx_v_funcName, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":527 - * funcName = fillString(func_name) - * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) - * free(sysId) # <<<<<<<<<<<<<< - * free(funcName) - * if rc != RFC_OK: - */ - free(__pyx_v_sysId); - - /* "src/pyrfc/client.pyx":528 - * cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) - * free(sysId) - * free(funcName) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - free(__pyx_v_funcName); - - /* "src/pyrfc/client.pyx":529 - * free(sysId) - * free(funcName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return rc - */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_2) { - - /* "src/pyrfc/client.pyx":530 - * free(funcName) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * return rc - * - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 530, __pyx_L1_error) + if (likely(PyDict_CheckExact(__pyx_v_server_params))) { + __pyx_t_3 = PyDict_Copy(__pyx_v_server_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_server_params, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":529 - * free(sysId) - * free(funcName) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return rc - */ } + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_ServerConnection), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->_server_connection); + __Pyx_DECREF(((PyObject *)__pyx_v_self->_server_connection)); + __pyx_v_self->_server_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":531 - * if rc != RFC_OK: - * self._error(&errorInfo) - * return rc # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1780 + * self._client_connection = Connection(**client_params) + * self._server_connection = ServerConnection(**server_params) + * self._server_thread=Thread(target=self.serve) # <<<<<<<<<<<<<< * - * ########################################################################## + * @staticmethod */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 531, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_serve); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, __pyx_t_7) < 0) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_v_self->_server_thread); + __Pyx_DECREF(__pyx_v_self->_server_thread); + __pyx_v_self->_server_thread = __pyx_t_7; + __pyx_t_7 = 0; - /* "src/pyrfc/client.pyx":512 - * return rc - * - * def func_desc_remove(self, sysid, func_name): # <<<<<<<<<<<<<< - * """Removes the Function Description from SAP NW RFC Lib cache + /* "pyrfc/_cyrfc.pyx":1769 + * } * + * def __cinit__(self, server_params, client_params, config=None): # <<<<<<<<<<<<<< + * # config parsing + * config = config or {} */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.func_desc_remove", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_config); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":536 - * # TRANSACTIONAL / QUEUED RFC +/* "pyrfc/_cyrfc.pyx":1783 * - * def _get_transaction_id(self): # <<<<<<<<<<<<<< - * """ Returns a unique 24 char transaction ID (GUID).""" - * cdef RFC_RC rc + * @staticmethod + * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["check"] + * if handler is None: */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_41_get_transaction_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_40_get_transaction_id[] = " Returns a unique 24 char transaction ID (GUID)."; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_41_get_transaction_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_transaction_id (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_40_get_transaction_id(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_40_get_transaction_id(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_TID __pyx_v_tid; - PyObject *__pyx_r = NULL; +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onCheckFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { + PyObject *__pyx_v_handler = NULL; + PyObject *__pyx_v_unit_identifier = NULL; + PyObject *__pyx_v_ex = NULL; + RFC_RC __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_5; + int __pyx_t_4; + RFC_RC __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_get_transaction_id", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("__onCheckFunction", 0); - /* "src/pyrfc/client.pyx":542 - * cdef RFC_TID tid - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1784 + * @staticmethod + * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["check"] # <<<<<<<<<<<<<< + * if handler is None: + * return RCStatus.OK.value */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 542, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1784, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 542, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_check); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1784, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (__pyx_t_3) { + __pyx_v_handler = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":543 - * - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1785 + * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["check"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * try: + */ + __pyx_t_3 = (__pyx_v_handler == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "pyrfc/_cyrfc.pyx":1786 + * handler = Server.__bgRfcFunction["check"] + * if handler is None: + * return RCStatus.OK.value # <<<<<<<<<<<<<< + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 543, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1786, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":542 - * cdef RFC_TID tid - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1785 + * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["check"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * try: */ } - /* "src/pyrfc/client.pyx":544 - * if not self.alive: - * self._open() - * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1787 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ - __pyx_v_rc = RfcGetTransactionID(__pyx_v_self->_handle, __pyx_v_tid, (&__pyx_v_errorInfo)); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { - /* "src/pyrfc/client.pyx":545 - * self._open() - * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapString(tid, RFC_TID_LN) + /* "pyrfc/_cyrfc.pyx":1788 + * return RCStatus.OK.value + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_3) { + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1788, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_unit_identifier = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":546 - * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * return wrapString(tid, RFC_TID_LN) - * + /* "pyrfc/_cyrfc.pyx":1789 + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< + * except Exception as ex: + * _server_log("Error in bgRFC handler onCheck:", ex) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1789, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_handler); + __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1789, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1789, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1789, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; + } + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); + __Pyx_INCREF(__pyx_v_unit_identifier); + __Pyx_GIVEREF(__pyx_v_unit_identifier); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); + __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1789, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1789, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1789, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L8_try_return; - /* "src/pyrfc/client.pyx":545 - * self._open() - * rc = RfcGetTransactionID(self._handle, tid, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapString(tid, RFC_TID_LN) + /* "pyrfc/_cyrfc.pyx":1787 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ - } + } + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/pyrfc/client.pyx":547 - * if rc != RFC_OK: - * self._error(&errorInfo) - * return wrapString(tid, RFC_TID_LN) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1790 + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: # <<<<<<<<<<<<<< + * _server_log("Error in bgRFC handler onCheck:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value + */ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_11) { + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onCheckFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(0, 1790, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_ex = __pyx_t_2; + + /* "pyrfc/_cyrfc.pyx":1791 + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: + * _server_log("Error in bgRFC handler onCheck:", ex) # <<<<<<<<<<<<<< + * return RCStatus.RFC_EXTERNAL_FAILURE.value * - * def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(RFC_TID_LN); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5.__pyx_n = 1; - __pyx_t_5.uclen = __pyx_t_1; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_tid, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1791, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCheck, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1791, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCheck, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1791, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1791, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_14); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onCheck); + __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onCheck); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onCheck); + __Pyx_INCREF(__pyx_v_ex); + __Pyx_GIVEREF(__pyx_v_ex); + PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1791, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":536 - * # TRANSACTIONAL / QUEUED RFC + /* "pyrfc/_cyrfc.pyx":1792 + * except Exception as ex: + * _server_log("Error in bgRFC handler onCheck:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< * - * def _get_transaction_id(self): # <<<<<<<<<<<<<< - * """ Returns a unique 24 char transaction ID (GUID).""" - * cdef RFC_RC rc + * @staticmethod + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1792, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1792, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1792, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1792, __pyx_L6_except_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + __pyx_L6_except_error:; + + /* "pyrfc/_cyrfc.pyx":1787 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value + */ + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L1_error; + __pyx_L8_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + } + + /* "pyrfc/_cyrfc.pyx":1783 + * + * @staticmethod + * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["check"] + * if handler is None: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._get_transaction_id", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onCheckFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = (RFC_RC) 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_handler); + __Pyx_XDECREF(__pyx_v_unit_identifier); + __Pyx_XDECREF(__pyx_v_ex); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "src/pyrfc/client.pyx":549 - * return wrapString(tid, RFC_TID_LN) +/* "pyrfc/_cyrfc.pyx":1795 * - * def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): # <<<<<<<<<<<<<< - * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) - * cdef RFC_RC rc + * @staticmethod + * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["commit"] + * if handler is None: */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_43_create_and_submit_transaction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_43_create_and_submit_transaction(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_transaction_id = 0; - PyObject *__pyx_v_calls = 0; - PyObject *__pyx_v_queue_name = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_create_and_submit_transaction (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transaction_id,&__pyx_n_s_calls,&__pyx_n_s_queue_name,0}; - PyObject* values[3] = {0,0,0}; - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 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_transaction_id)) != 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_calls)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_create_and_submit_transaction", 0, 2, 3, 1); __PYX_ERR(2, 549, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_name); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_and_submit_transaction") < 0)) __PYX_ERR(2, 549, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_transaction_id = values[0]; - __pyx_v_calls = values[1]; - __pyx_v_queue_name = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_create_and_submit_transaction", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 549, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_42_create_and_submit_transaction(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_transaction_id, __pyx_v_calls, __pyx_v_queue_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_42_create_and_submit_transaction(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_transaction_id, PyObject *__pyx_v_calls, PyObject *__pyx_v_queue_name) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - SAP_UC *__pyx_v_queueName; - RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; - RFC_FUNCTION_HANDLE __pyx_v_funcCont; - SAP_UC *__pyx_v_tid; - PyObject *__pyx_v_func_name = NULL; - PyObject *__pyx_v_params = NULL; - SAP_UC *__pyx_v_funcName; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_value = NULL; - CYTHON_UNUSED PyObject *__pyx_v_e = NULL; - PyObject *__pyx_r = NULL; +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onCommitFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { + PyObject *__pyx_v_handler = NULL; + PyObject *__pyx_v_unit_identifier = NULL; + PyObject *__pyx_v_ex = NULL; + RFC_RC __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - SAP_UC *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_4; + RFC_RC __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; + int __pyx_t_11; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; - PyObject *(*__pyx_t_14)(PyObject *); - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - char const *__pyx_t_19; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - PyObject *__pyx_t_25 = NULL; - char const *__pyx_t_26; + PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_create_and_submit_transaction", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("__onCommitFunction", 0); - /* "src/pyrfc/client.pyx":557 - * cdef RFC_FUNCTION_HANDLE funcCont - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * + /* "pyrfc/_cyrfc.pyx":1796 + * @staticmethod + * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["commit"] # <<<<<<<<<<<<<< + * if handler is None: + * return RCStatus.OK.value */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 557, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 557, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_commit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":558 - * - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * - * tid = fillString(transaction_id) - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 558, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":557 - * cdef RFC_FUNCTION_HANDLE funcCont - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * - */ - } - - /* "src/pyrfc/client.pyx":560 - * self._open() - * - * tid = fillString(transaction_id) # <<<<<<<<<<<<<< - * queueName = NULL - * if queue_name: - */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_transaction_id); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 560, __pyx_L1_error) - __pyx_v_tid = __pyx_t_4; - - /* "src/pyrfc/client.pyx":561 - * - * tid = fillString(transaction_id) - * queueName = NULL # <<<<<<<<<<<<<< - * if queue_name: - * queueName = fillString(queue_name) - */ - __pyx_v_queueName = NULL; - - /* "src/pyrfc/client.pyx":562 - * tid = fillString(transaction_id) - * queueName = NULL - * if queue_name: # <<<<<<<<<<<<<< - * queueName = fillString(queue_name) - * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) - */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_queue_name); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 562, __pyx_L1_error) - if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":563 - * queueName = NULL - * if queue_name: - * queueName = fillString(queue_name) # <<<<<<<<<<<<<< - * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) - * - */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_queue_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 563, __pyx_L1_error) - __pyx_v_queueName = __pyx_t_4; - - /* "src/pyrfc/client.pyx":562 - * tid = fillString(transaction_id) - * queueName = NULL - * if queue_name: # <<<<<<<<<<<<<< - * queueName = fillString(queue_name) - * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) - */ - } - - /* "src/pyrfc/client.pyx":564 - * if queue_name: - * queueName = fillString(queue_name) - * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) # <<<<<<<<<<<<<< - * - * if queue_name: - */ - __pyx_v_self->_tHandle = RfcCreateTransaction(__pyx_v_self->_handle, __pyx_v_tid, __pyx_v_queueName, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":566 - * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) - * - * if queue_name: # <<<<<<<<<<<<<< - * free(queueName) - * free(tid) - */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_queue_name); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 566, __pyx_L1_error) - if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":567 - * - * if queue_name: - * free(queueName) # <<<<<<<<<<<<<< - * free(tid) - * if self._tHandle == NULL: - */ - free(__pyx_v_queueName); - - /* "src/pyrfc/client.pyx":566 - * self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) - * - * if queue_name: # <<<<<<<<<<<<<< - * free(queueName) - * free(tid) - */ - } - - /* "src/pyrfc/client.pyx":568 - * if queue_name: - * free(queueName) - * free(tid) # <<<<<<<<<<<<<< - * if self._tHandle == NULL: - * self._error(&errorInfo) - */ - free(__pyx_v_tid); + __pyx_v_handler = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":569 - * free(queueName) - * free(tid) - * if self._tHandle == NULL: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * self.active_transaction = True + /* "pyrfc/_cyrfc.pyx":1797 + * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["commit"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * try: */ - __pyx_t_3 = ((__pyx_v_self->_tHandle == NULL) != 0); - if (__pyx_t_3) { + __pyx_t_3 = (__pyx_v_handler == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { - /* "src/pyrfc/client.pyx":570 - * free(tid) - * if self._tHandle == NULL: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * self.active_transaction = True - * + /* "pyrfc/_cyrfc.pyx":1798 + * handler = Server.__bgRfcFunction["commit"] + * if handler is None: + * return RCStatus.OK.value # <<<<<<<<<<<<<< + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 570, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1798, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":569 - * free(queueName) - * free(tid) - * if self._tHandle == NULL: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * self.active_transaction = True - */ - } - - /* "src/pyrfc/client.pyx":571 - * if self._tHandle == NULL: - * self._error(&errorInfo) - * self.active_transaction = True # <<<<<<<<<<<<<< - * + /* "pyrfc/_cyrfc.pyx":1797 + * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["commit"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value * try: */ - __pyx_v_self->active_transaction = 1; + } - /* "src/pyrfc/client.pyx":573 - * self.active_transaction = True - * + /* "pyrfc/_cyrfc.pyx":1799 + * if handler is None: + * return RCStatus.OK.value * try: # <<<<<<<<<<<<<< - * for func_name, params in calls: - * funcName = fillString(func_name) + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_5); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "src/pyrfc/client.pyx":574 - * + /* "pyrfc/_cyrfc.pyx":1800 + * return RCStatus.OK.value * try: - * for func_name, params in calls: # <<<<<<<<<<<<<< - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: */ - if (likely(PyList_CheckExact(__pyx_v_calls)) || PyTuple_CheckExact(__pyx_v_calls)) { - __pyx_t_1 = __pyx_v_calls; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_calls); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 574, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 574, __pyx_L7_error) - } - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(2, 574, __pyx_L7_error) - #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 574, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_10); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(2, 574, __pyx_L7_error) - #else - __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 574, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_10); - #endif - } - } else { - __pyx_t_10 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_10)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 574, __pyx_L7_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_10); - } - if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { - PyObject* sequence = __pyx_t_10; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 574, __pyx_L7_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_11 = PyList_GET_ITEM(sequence, 0); - __pyx_t_12 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(__pyx_t_12); - #else - __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 574, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 574, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_12); - #endif - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_13 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 574, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext; - index = 0; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_11); - index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_12); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) __PYX_ERR(2, 574, __pyx_L7_error) - __pyx_t_14 = NULL; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L16_unpacking_done; - __pyx_L15_unpacking_failed:; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_14 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(2, 574, __pyx_L7_error) - __pyx_L16_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_11); - __pyx_t_11 = 0; - __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_12); - __pyx_t_12 = 0; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1800, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_unit_identifier = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":575 + /* "pyrfc/_cyrfc.pyx":1801 * try: - * for func_name, params in calls: - * funcName = fillString(func_name) # <<<<<<<<<<<<<< - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< + * except Exception as ex: + * _server_log("Error in bgRFC handler onCommit:", ex) */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 575, __pyx_L7_error) - __pyx_v_funcName = __pyx_t_4; + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1801, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_handler); + __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1801, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1801, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1801, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; + } + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); + __Pyx_INCREF(__pyx_v_unit_identifier); + __Pyx_GIVEREF(__pyx_v_unit_identifier); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); + __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1801, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1801, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1801, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L8_try_return; - /* "src/pyrfc/client.pyx":576 - * for func_name, params in calls: - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< - * free(funcName) - * if not funcDesc: + /* "pyrfc/_cyrfc.pyx":1799 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ - __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); + } + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/pyrfc/client.pyx":577 - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) # <<<<<<<<<<<<<< - * if not funcDesc: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1802 + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: # <<<<<<<<<<<<<< + * _server_log("Error in bgRFC handler onCommit:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value */ - free(__pyx_v_funcName); + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_11) { + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onCommitFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(0, 1802, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_ex = __pyx_t_2; - /* "src/pyrfc/client.pyx":578 - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1803 + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: + * _server_log("Error in bgRFC handler onCommit:", ex) # <<<<<<<<<<<<<< + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * */ - __pyx_t_3 = ((!(__pyx_v_funcDesc != 0)) != 0); - if (__pyx_t_3) { + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1803, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCommit, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1803, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCommit, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1803, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1803, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_14); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onCommit); + __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onCommit); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onCommit); + __Pyx_INCREF(__pyx_v_ex); + __Pyx_GIVEREF(__pyx_v_ex); + PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1803, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":579 - * free(funcName) - * if not funcDesc: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: + /* "pyrfc/_cyrfc.pyx":1804 + * except Exception as ex: + * _server_log("Error in bgRFC handler onCommit:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< + * + * @staticmethod */ - __pyx_t_10 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 579, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1804, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1804, __pyx_L6_except_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + __pyx_L6_except_error:; - /* "src/pyrfc/client.pyx":578 - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1799 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ - } + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L1_error; + __pyx_L8_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + } - /* "src/pyrfc/client.pyx":580 - * if not funcDesc: - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) # <<<<<<<<<<<<<< - * if not funcCont: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1795 + * + * @staticmethod + * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["commit"] + * if handler is None: */ - __pyx_v_funcCont = RfcCreateFunction(__pyx_v_funcDesc, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":581 - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * try: - */ - __pyx_t_3 = ((!(__pyx_v_funcCont != 0)) != 0); - if (__pyx_t_3) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onCommitFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = (RFC_RC) 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_handler); + __Pyx_XDECREF(__pyx_v_unit_identifier); + __Pyx_XDECREF(__pyx_v_ex); + __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif + return __pyx_r; +} - /* "src/pyrfc/client.pyx":582 - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * try: - * for name, value in params.iteritems(): +/* "pyrfc/_cyrfc.pyx":1807 + * + * @staticmethod + * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["rollback"] + * if handler is None: */ - __pyx_t_10 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 582, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "src/pyrfc/client.pyx":581 - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * try: - */ - } +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onRollbackFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { + PyObject *__pyx_v_handler = NULL; + PyObject *__pyx_v_unit_identifier = NULL; + PyObject *__pyx_v_ex = NULL; + RFC_RC __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + RFC_RC __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("__onRollbackFunction", 0); - /* "src/pyrfc/client.pyx":583 - * if not funcCont: - * self._error(&errorInfo) - * try: # <<<<<<<<<<<<<< - * for name, value in params.iteritems(): - * fillFunctionParameter(funcDesc, funcCont, name, value) + /* "pyrfc/_cyrfc.pyx":1808 + * @staticmethod + * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["rollback"] # <<<<<<<<<<<<<< + * if handler is None: + * return RCStatus.OK.value */ - /*try:*/ { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_rollback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_handler = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":584 - * self._error(&errorInfo) - * try: - * for name, value in params.iteritems(): # <<<<<<<<<<<<<< - * fillFunctionParameter(funcDesc, funcCont, name, value) - * # Add RFC call to transaction + /* "pyrfc/_cyrfc.pyx":1809 + * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["rollback"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * try: */ - __pyx_t_15 = 0; - if (unlikely(__pyx_v_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); - __PYX_ERR(2, 584, __pyx_L22_error) - } - __pyx_t_12 = __Pyx_dict_iterator(__pyx_v_params, 0, __pyx_n_s_iteritems, (&__pyx_t_16), (&__pyx_t_17)); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 584, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_10); - __pyx_t_10 = __pyx_t_12; - __pyx_t_12 = 0; - while (1) { - __pyx_t_18 = __Pyx_dict_iter_next(__pyx_t_10, __pyx_t_16, &__pyx_t_15, &__pyx_t_12, &__pyx_t_11, NULL, __pyx_t_17); - if (unlikely(__pyx_t_18 == 0)) break; - if (unlikely(__pyx_t_18 == -1)) __PYX_ERR(2, 584, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_12); - __pyx_t_12 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); - __pyx_t_11 = 0; + __pyx_t_3 = (__pyx_v_handler == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { - /* "src/pyrfc/client.pyx":585 - * try: - * for name, value in params.iteritems(): - * fillFunctionParameter(funcDesc, funcCont, name, value) # <<<<<<<<<<<<<< - * # Add RFC call to transaction - * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1810 + * handler = Server.__bgRfcFunction["rollback"] + * if handler is None: + * return RCStatus.OK.value # <<<<<<<<<<<<<< + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) */ - __pyx_t_11 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcCont, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 585, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1810, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":587 - * fillFunctionParameter(funcDesc, funcCont, name, value) - * # Add RFC call to transaction - * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1809 + * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["rollback"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * try: */ - __pyx_v_rc = RfcInvokeInTransaction(__pyx_v_self->_tHandle, __pyx_v_funcCont, (&__pyx_v_errorInfo)); + } - /* "src/pyrfc/client.pyx":588 - * # Add RFC call to transaction - * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * finally: + /* "pyrfc/_cyrfc.pyx":1811 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_3) { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { - /* "src/pyrfc/client.pyx":589 - * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * finally: - * RfcDestroyFunction(funcCont, NULL) + /* "pyrfc/_cyrfc.pyx":1812 + * return RCStatus.OK.value + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: */ - __pyx_t_10 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 589, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1812, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_unit_identifier = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":588 - * # Add RFC call to transaction - * rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * finally: + /* "pyrfc/_cyrfc.pyx":1813 + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< + * except Exception as ex: + * _server_log("Error in bgRFC handler onRollback:", ex) */ - } + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1813, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_handler); + __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_11 = 1; } - - /* "src/pyrfc/client.pyx":591 - * self._error(&errorInfo) - * finally: - * RfcDestroyFunction(funcCont, NULL) # <<<<<<<<<<<<<< - * # execute - * with nogil: - */ - /*finally:*/ { - /*normal exit:*/{ - (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); - goto __pyx_L23; - } - __pyx_L22_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_25); - __pyx_t_17 = __pyx_lineno; __pyx_t_18 = __pyx_clineno; __pyx_t_19 = __pyx_filename; - { - (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25); - } - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_22); - __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; - __pyx_lineno = __pyx_t_17; __pyx_clineno = __pyx_t_18; __pyx_filename = __pyx_t_19; - goto __pyx_L7_error; - } - __pyx_L23:; - } - - /* "src/pyrfc/client.pyx":574 - * - * try: - * for func_name, params in calls: # <<<<<<<<<<<<<< - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":593 - * RfcDestroyFunction(funcCont, NULL) - * # execute - * with nogil: # <<<<<<<<<<<<<< - * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "src/pyrfc/client.pyx":594 - * # execute - * with nogil: - * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_rc = RfcSubmitTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); - } - - /* "src/pyrfc/client.pyx":593 - * RfcDestroyFunction(funcCont, NULL) - * # execute - * with nogil: # <<<<<<<<<<<<<< - * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L33; - } - __pyx_L33:; - } } - - /* "src/pyrfc/client.pyx":595 - * with nogil: - * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * - */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":596 - * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * - * except RFCError as e: - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 596, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_1); + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1813, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":595 - * with nogil: - * rc = RfcSubmitTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * - */ + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1813, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1813, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; + } + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); + __Pyx_INCREF(__pyx_v_unit_identifier); + __Pyx_GIVEREF(__pyx_v_unit_identifier); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); + __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1813, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1813, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1813, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L8_try_return; - /* "src/pyrfc/client.pyx":573 - * self.active_transaction = True - * + /* "pyrfc/_cyrfc.pyx":1811 + * if handler is None: + * return RCStatus.OK.value * try: # <<<<<<<<<<<<<< - * for func_name, params in calls: - * funcName = fillString(func_name) + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ } - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L12_try_end; - __pyx_L7_error:; + __pyx_L4_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "src/pyrfc/client.pyx":598 - * self._error(&errorInfo) - * - * except RFCError as e: # <<<<<<<<<<<<<< - * # clean up actions - * RfcDestroyTransaction(self._tHandle, NULL) - */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_10, &__pyx_t_11); - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 598, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_12); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_10, __pyx_t_11); - __pyx_t_1 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; - if (__pyx_t_18) { - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_1) < 0) __PYX_ERR(2, 598, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_10); - __pyx_v_e = __pyx_t_10; - /*try:*/ { + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "src/pyrfc/client.pyx":600 - * except RFCError as e: - * # clean up actions - * RfcDestroyTransaction(self._tHandle, NULL) # <<<<<<<<<<<<<< - * raise - * + /* "pyrfc/_cyrfc.pyx":1814 + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: # <<<<<<<<<<<<<< + * _server_log("Error in bgRFC handler onRollback:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value */ - (void)(RfcDestroyTransaction(__pyx_v_self->_tHandle, NULL)); + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_11) { + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onRollbackFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(0, 1814, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_ex = __pyx_t_2; - /* "src/pyrfc/client.pyx":601 - * # clean up actions - * RfcDestroyTransaction(self._tHandle, NULL) - * raise # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1815 + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: + * _server_log("Error in bgRFC handler onRollback:", ex) # <<<<<<<<<<<<<< + * return RCStatus.RFC_EXTERNAL_FAILURE.value * - * def _destroy_transaction(self): */ - __Pyx_GIVEREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_10, __pyx_t_1); - __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_1 = 0; - __PYX_ERR(2, 601, __pyx_L40_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1815, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onRollbac, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1815, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onRollbac, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1815, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1815, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_14); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onRollbac); + __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onRollbac); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onRollbac); + __Pyx_INCREF(__pyx_v_ex); + __Pyx_GIVEREF(__pyx_v_ex); + PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1815, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":598 - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1816 + * except Exception as ex: + * _server_log("Error in bgRFC handler onRollback:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< * - * except RFCError as e: # <<<<<<<<<<<<<< - * # clean up actions - * RfcDestroyTransaction(self._tHandle, NULL) + * @staticmethod */ - /*finally:*/ { - __pyx_L40_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_20 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23) < 0)) __Pyx_ErrFetch(&__pyx_t_25, &__pyx_t_24, &__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_20); - __pyx_t_18 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_26 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_21, __pyx_t_20); - } - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_ErrRestore(__pyx_t_25, __pyx_t_24, __pyx_t_23); - __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; __pyx_t_20 = 0; - __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_26; - goto __pyx_L9_except_error; - } - } + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1816, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1816, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1816, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1816, __pyx_L6_except_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L7_except_return; } - goto __pyx_L9_except_error; - __pyx_L9_except_error:; + goto __pyx_L6_except_error; + __pyx_L6_except_error:; - /* "src/pyrfc/client.pyx":573 - * self.active_transaction = True - * + /* "pyrfc/_cyrfc.pyx":1811 + * if handler is None: + * return RCStatus.OK.value * try: # <<<<<<<<<<<<<< - * for func_name, params in calls: - * funcName = fillString(func_name) + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ - __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; - __pyx_L12_try_end:; + __pyx_L8_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; } - /* "src/pyrfc/client.pyx":549 - * return wrapString(tid, RFC_TID_LN) + /* "pyrfc/_cyrfc.pyx":1807 * - * def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): # <<<<<<<<<<<<<< - * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) - * cdef RFC_RC rc + * @staticmethod + * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["rollback"] + * if handler is None: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_14); + __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onRollbackFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = (RFC_RC) 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_func_name); - __Pyx_XDECREF(__pyx_v_params); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_handler); + __Pyx_XDECREF(__pyx_v_unit_identifier); + __Pyx_XDECREF(__pyx_v_ex); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "src/pyrfc/client.pyx":603 - * raise +/* "pyrfc/_cyrfc.pyx":1819 * - * def _destroy_transaction(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * @staticmethod + * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["confirm"] + * if handler is None: */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_45_destroy_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_45_destroy_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_destroy_transaction (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_44_destroy_transaction(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_44_destroy_transaction(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - PyObject *__pyx_r = NULL; +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onConfirmFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { + PyObject *__pyx_v_handler = NULL; + PyObject *__pyx_v_unit_identifier = NULL; + PyObject *__pyx_v_ex = NULL; + RFC_RC __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; + int __pyx_t_3; + int __pyx_t_4; + RFC_RC __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_destroy_transaction", 0); - - /* "src/pyrfc/client.pyx":606 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_transaction: # <<<<<<<<<<<<<< - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: - */ - __pyx_t_1 = ((!(__pyx_v_self->active_transaction != 0)) != 0); - if (unlikely(__pyx_t_1)) { - - /* "src/pyrfc/client.pyx":607 - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_transaction: - * raise RFCError("No transaction handle for this connection available.") # <<<<<<<<<<<<<< - * if not self.alive: - * self._open() - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_transaction_handle_for_this_c) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_transaction_handle_for_this_c); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 607, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 607, __pyx_L1_error) + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("__onConfirmFunction", 0); - /* "src/pyrfc/client.pyx":606 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_transaction: # <<<<<<<<<<<<<< - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: + /* "pyrfc/_cyrfc.pyx":1820 + * @staticmethod + * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["confirm"] # <<<<<<<<<<<<<< + * if handler is None: + * return RCStatus.OK.value */ - } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1820, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_confirm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1820, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_handler = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":608 - * if not self.active_transaction: - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1821 + * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["confirm"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * try: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 608, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((!__pyx_t_1) != 0); - if (__pyx_t_5) { + __pyx_t_3 = (__pyx_v_handler == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { - /* "src/pyrfc/client.pyx":609 - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False + /* "pyrfc/_cyrfc.pyx":1822 + * handler = Server.__bgRfcFunction["confirm"] + * if handler is None: + * return RCStatus.OK.value # <<<<<<<<<<<<<< + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 609, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1822, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1822, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":608 - * if not self.active_transaction: - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1821 + * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + * handler = Server.__bgRfcFunction["confirm"] + * if handler is None: # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * try: */ } - /* "src/pyrfc/client.pyx":610 - * if not self.alive: - * self._open() - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< - * self.active_transaction = False - * if rc != RFC_OK: - */ - __pyx_v_rc = RfcDestroyTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":611 - * self._open() - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1823 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ - __pyx_v_self->active_transaction = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { - /* "src/pyrfc/client.pyx":612 - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":1824 + * return RCStatus.OK.value + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: */ - __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_5) { + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1824, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_unit_identifier = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":613 - * self.active_transaction = False - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * - * def _confirm_transaction(self): + /* "pyrfc/_cyrfc.pyx":1825 + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< + * except Exception as ex: + * _server_log("Error in bgRFC handler onConfirm:", ex) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/client.pyx":612 - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1825, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_handler); + __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1825, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1825, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1825, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; + } + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); + __Pyx_INCREF(__pyx_v_unit_identifier); + __Pyx_GIVEREF(__pyx_v_unit_identifier); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); + __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1825, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1825, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_r = __pyx_t_5; + goto __pyx_L8_try_return; + + /* "pyrfc/_cyrfc.pyx":1823 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value + */ + } + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "pyrfc/_cyrfc.pyx":1826 + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: # <<<<<<<<<<<<<< + * _server_log("Error in bgRFC handler onConfirm:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value + */ + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_11) { + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onConfirmFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(0, 1826, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_ex = __pyx_t_2; + + /* "pyrfc/_cyrfc.pyx":1827 + * return handler(rfcHandle, unit_identifier).value + * except Exception as ex: + * _server_log("Error in bgRFC handler onConfirm:", ex) # <<<<<<<<<<<<<< + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1827, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onConfirm, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1827, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onConfirm, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1827, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1827, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_14); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onConfirm); + __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onConfirm); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onConfirm); + __Pyx_INCREF(__pyx_v_ex); + __Pyx_GIVEREF(__pyx_v_ex); + PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1827, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":1828 + * except Exception as ex: + * _server_log("Error in bgRFC handler onConfirm:", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< * + * @staticmethod + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1828, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1828, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1828, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1828, __pyx_L6_except_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + __pyx_L6_except_error:; + + /* "pyrfc/_cyrfc.pyx":1823 + * if handler is None: + * return RCStatus.OK.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * return handler(rfcHandle, unit_identifier).value */ + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L1_error; + __pyx_L8_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; } - /* "src/pyrfc/client.pyx":603 - * raise + /* "pyrfc/_cyrfc.pyx":1819 * - * def _destroy_transaction(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * @staticmethod + * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< + * handler = Server.__bgRfcFunction["confirm"] + * if handler is None: */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - 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); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._destroy_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onConfirmFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = (RFC_RC) 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_handler); + __Pyx_XDECREF(__pyx_v_unit_identifier); + __Pyx_XDECREF(__pyx_v_ex); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "src/pyrfc/client.pyx":615 - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1831 * - * def _confirm_transaction(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * @staticmethod + * cdef RFC_RC __onGetStateFunction( # <<<<<<<<<<<<<< + * RFC_CONNECTION_HANDLE rfcHandle, + * const RFC_UNIT_IDENTIFIER *identifier, */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_47_confirm_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_47_confirm_transaction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_confirm_transaction (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_46_confirm_transaction(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_46_confirm_transaction(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - PyObject *__pyx_r = NULL; +static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onGetStateFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier, RFC_UNIT_STATE *__pyx_v_unitState) { + PyObject *__pyx_v_handler = NULL; + PyObject *__pyx_v_unit_identifier = NULL; + PyObject *__pyx_v_state = NULL; + PyObject *__pyx_v_ex = NULL; + RFC_RC __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + RFC_RC __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_13; + Py_UCS4 __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_confirm_transaction", 0); + #ifdef WITH_THREAD + PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); + #endif + __Pyx_RefNannySetupContext("__onGetStateFunction", 0); - /* "src/pyrfc/client.pyx":618 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_transaction: # <<<<<<<<<<<<<< - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: + /* "pyrfc/_cyrfc.pyx":1836 + * RFC_UNIT_STATE *unitState + * ) with gil: + * handler = Server.__bgRfcFunction["getState"] # <<<<<<<<<<<<<< + * if handler is None: + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") */ - __pyx_t_1 = ((!(__pyx_v_self->active_transaction != 0)) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_getState); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1836, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_handler = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":619 - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_transaction: - * raise RFCError("No transaction handle for this connection available.") # <<<<<<<<<<<<<< - * if not self.alive: - * self._open() + /* "pyrfc/_cyrfc.pyx":1837 + * ) with gil: + * handler = Server.__bgRfcFunction["getState"] + * if handler is None: # <<<<<<<<<<<<<< + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + * return RCStatus.RFC_EXTERNAL_FAILURE.value */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); + __pyx_t_3 = (__pyx_v_handler == Py_None); + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { + + /* "pyrfc/_cyrfc.pyx":1838 + * handler = Server.__bgRfcFunction["getState"] + * if handler is None: + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") # <<<<<<<<<<<<<< + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * try: + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_transaction_handle_for_this_c) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_transaction_handle_for_this_c); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 619, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_kp_s_bgRFC_handler_onGetState_is_not) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_bgRFC_handler_onGetState_is_not); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1838, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 619, __pyx_L1_error) - - /* "src/pyrfc/client.pyx":618 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_transaction: # <<<<<<<<<<<<<< - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: - */ - } - - /* "src/pyrfc/client.pyx":620 - * if not self.active_transaction: - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 620, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((!__pyx_t_1) != 0); - if (__pyx_t_5) { - /* "src/pyrfc/client.pyx":621 - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1839 + * if handler is None: + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 621, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1839, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":620 - * if not self.active_transaction: - * raise RFCError("No transaction handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1837 + * ) with gil: + * handler = Server.__bgRfcFunction["getState"] + * if handler is None: # <<<<<<<<<<<<<< + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + * return RCStatus.RFC_EXTERNAL_FAILURE.value */ } - /* "src/pyrfc/client.pyx":622 - * if not self.alive: - * self._open() - * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1840 + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * state = handler(rfcHandle, unit_identifier) */ - __pyx_v_rc = RfcConfirmTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { - /* "src/pyrfc/client.pyx":623 - * self._open() - * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1841 + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< + * state = handler(rfcHandle, unit_identifier) + * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 */ - __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_5) { + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1841, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_unit_identifier = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":624 - * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False + /* "pyrfc/_cyrfc.pyx":1842 + * try: + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * state = handler(rfcHandle, unit_identifier) # <<<<<<<<<<<<<< + * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 + * if state == UnitState.created or state == UnitState.executed: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1842, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_handler); + __pyx_t_5 = __pyx_v_handler; __pyx_t_10 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1842, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1842, __pyx_L4_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1842, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; + } + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); + __Pyx_INCREF(__pyx_v_unit_identifier); + __Pyx_GIVEREF(__pyx_v_unit_identifier); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); + __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1842, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_state = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":623 - * self._open() - * rc = RfcConfirmTransaction(self._tHandle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1844 + * state = handler(rfcHandle, unit_identifier) + * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 + * if state == UnitState.created or state == UnitState.executed: # <<<<<<<<<<<<<< + * unitState[0] = RFC_UNIT_IN_PROCESS + * elif state == UnitState.committed: */ - } + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_created); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_3) { + } else { + __pyx_t_4 = __pyx_t_3; + goto __pyx_L11_bool_binop_done; + } + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_executed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1844, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_t_3; + __pyx_L11_bool_binop_done:; + if (__pyx_t_4) { - /* "src/pyrfc/client.pyx":625 - * if rc != RFC_OK: - * self._error(&errorInfo) - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) # <<<<<<<<<<<<<< - * self.active_transaction = False - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1845 + * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 + * if state == UnitState.created or state == UnitState.executed: + * unitState[0] = RFC_UNIT_IN_PROCESS # <<<<<<<<<<<<<< + * elif state == UnitState.committed: + * idunitStateentifier[0] = RFC_UNIT_COMMITTED */ - __pyx_v_rc = RfcDestroyTransaction(__pyx_v_self->_tHandle, (&__pyx_v_errorInfo)); + (__pyx_v_unitState[0]) = RFC_UNIT_IN_PROCESS; - /* "src/pyrfc/client.pyx":626 - * self._error(&errorInfo) - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1844 + * state = handler(rfcHandle, unit_identifier) + * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 + * if state == UnitState.created or state == UnitState.executed: # <<<<<<<<<<<<<< + * unitState[0] = RFC_UNIT_IN_PROCESS + * elif state == UnitState.committed: */ - __pyx_v_self->active_transaction = 0; + goto __pyx_L10; + } - /* "src/pyrfc/client.pyx":627 - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":1846 + * if state == UnitState.created or state == UnitState.executed: + * unitState[0] = RFC_UNIT_IN_PROCESS + * elif state == UnitState.committed: # <<<<<<<<<<<<<< + * idunitStateentifier[0] = RFC_UNIT_COMMITTED + * elif state == UnitState.rolled_back: */ - __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_5) { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1846, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_committed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1846, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1846, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1846, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { - /* "src/pyrfc/client.pyx":628 - * self.active_transaction = False - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * - * ########################################################################## - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/client.pyx":627 - * rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - * self.active_transaction = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":1847 + * unitState[0] = RFC_UNIT_IN_PROCESS + * elif state == UnitState.committed: + * idunitStateentifier[0] = RFC_UNIT_COMMITTED # <<<<<<<<<<<<<< + * elif state == UnitState.rolled_back: + * unitState[0] = RFC_UNIT_ROLLED_BACK */ - } + __pyx_t_2 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_COMMITTED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1847, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_idunitStateentifier); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1847, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_SetItemInt(__pyx_t_5, 0, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 1847, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":615 - * self._error(&errorInfo) - * - * def _confirm_transaction(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":1846 + * if state == UnitState.created or state == UnitState.executed: + * unitState[0] = RFC_UNIT_IN_PROCESS + * elif state == UnitState.committed: # <<<<<<<<<<<<<< + * idunitStateentifier[0] = RFC_UNIT_COMMITTED + * elif state == UnitState.rolled_back: */ + goto __pyx_L10; + } - /* 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_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._confirm_transaction", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":1848 + * elif state == UnitState.committed: + * idunitStateentifier[0] = RFC_UNIT_COMMITTED + * elif state == UnitState.rolled_back: # <<<<<<<<<<<<<< + * unitState[0] = RFC_UNIT_ROLLED_BACK + * elif state == UnitState.confirmed: + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1848, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rolled_back); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1848, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1848, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1848, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { -/* "src/pyrfc/client.pyx":633 - * # BACKGROUND RFC - * - * def _get_unit_id(self): # <<<<<<<<<<<<<< - * """Returns a unique 32 char bgRFC unit ID (GUID).""" - * cdef RFC_RC rc + /* "pyrfc/_cyrfc.pyx":1849 + * idunitStateentifier[0] = RFC_UNIT_COMMITTED + * elif state == UnitState.rolled_back: + * unitState[0] = RFC_UNIT_ROLLED_BACK # <<<<<<<<<<<<<< + * elif state == UnitState.confirmed: + * unitState[0] = RFC_UNIT_CONFIRMED */ + (__pyx_v_unitState[0]) = RFC_UNIT_ROLLED_BACK; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_49_get_unit_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_48_get_unit_id[] = "Returns a unique 32 char bgRFC unit ID (GUID)."; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_49_get_unit_id(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_unit_id (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_48_get_unit_id(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + /* "pyrfc/_cyrfc.pyx":1848 + * elif state == UnitState.committed: + * idunitStateentifier[0] = RFC_UNIT_COMMITTED + * elif state == UnitState.rolled_back: # <<<<<<<<<<<<<< + * unitState[0] = RFC_UNIT_ROLLED_BACK + * elif state == UnitState.confirmed: + */ + goto __pyx_L10; + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":1850 + * elif state == UnitState.rolled_back: + * unitState[0] = RFC_UNIT_ROLLED_BACK + * elif state == UnitState.confirmed: # <<<<<<<<<<<<<< + * unitState[0] = RFC_UNIT_CONFIRMED + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1850, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_confirmed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1850, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1850, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1850, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (likely(__pyx_t_4)) { -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_48_get_unit_id(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_UNITID __pyx_v_uid; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_get_unit_id", 0); + /* "pyrfc/_cyrfc.pyx":1851 + * unitState[0] = RFC_UNIT_ROLLED_BACK + * elif state == UnitState.confirmed: + * unitState[0] = RFC_UNIT_CONFIRMED # <<<<<<<<<<<<<< + * else: + * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") + */ + (__pyx_v_unitState[0]) = RFC_UNIT_CONFIRMED; - /* "src/pyrfc/client.pyx":639 - * cdef RFC_UNITID uid - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcGetUnitID(self._handle, uid, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1850 + * elif state == UnitState.rolled_back: + * unitState[0] = RFC_UNIT_ROLLED_BACK + * elif state == UnitState.confirmed: # <<<<<<<<<<<<<< + * unitState[0] = RFC_UNIT_CONFIRMED + * else: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 639, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (__pyx_t_3) { + goto __pyx_L10; + } - /* "src/pyrfc/client.pyx":640 - * - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * rc = RfcGetUnitID(self._handle, uid, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":1853 + * unitState[0] = RFC_UNIT_CONFIRMED + * else: + * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") # <<<<<<<<<<<<<< + * return RCStatus.OK.value + * except Exception as ex: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*else*/ { + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1853, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = 0; + __pyx_t_14 = 127; + __Pyx_INCREF(__pyx_kp_u_TID); + __pyx_t_13 += 4; + __Pyx_GIVEREF(__pyx_kp_u_TID); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_TID); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit_identifier, __pyx_n_s_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1853, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1853, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_14; + __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_12); + __pyx_t_12 = 0; + __Pyx_INCREF(__pyx_kp_u_invalid_state); + __pyx_t_13 += 16; + __Pyx_GIVEREF(__pyx_kp_u_invalid_state); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_invalid_state); + __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_state, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1853, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_14; + __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_12); + __pyx_t_12 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_13 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__6); + __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1853, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1853, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1853, __pyx_L4_error) + } + __pyx_L10:; - /* "src/pyrfc/client.pyx":639 - * cdef RFC_UNITID uid - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcGetUnitID(self._handle, uid, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1854 + * else: + * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") + * return RCStatus.OK.value # <<<<<<<<<<<<<< + * except Exception as ex: + * _server_log("Error in bgRFC handler onGetState:\n", ex) */ - } + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1854, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1854, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1854, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_6 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1854, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + goto __pyx_L8_try_return; - /* "src/pyrfc/client.pyx":641 - * if not self.alive: - * self._open() - * rc = RfcGetUnitID(self._handle, uid, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1840 + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * state = handler(rfcHandle, unit_identifier) */ - __pyx_v_rc = RfcGetUnitID(__pyx_v_self->_handle, __pyx_v_uid, (&__pyx_v_errorInfo)); + } + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/pyrfc/client.pyx":642 - * self._open() - * rc = RfcGetUnitID(self._handle, uid, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapString(uid, RFC_UNITID_LN) + /* "pyrfc/_cyrfc.pyx":1855 + * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") + * return RCStatus.OK.value + * except Exception as ex: # <<<<<<<<<<<<<< + * _server_log("Error in bgRFC handler onGetState:\n", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_3) { + __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_11) { + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onGetStateFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_12, &__pyx_t_5) < 0) __PYX_ERR(0, 1855, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_12); + __pyx_v_ex = __pyx_t_12; - /* "src/pyrfc/client.pyx":643 - * rc = RfcGetUnitID(self._handle, uid, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * return wrapString(uid, RFC_UNITID_LN) + /* "pyrfc/_cyrfc.pyx":1856 + * return RCStatus.OK.value + * except Exception as ex: + * _server_log("Error in bgRFC handler onGetState:\n", ex) # <<<<<<<<<<<<<< + * return RCStatus.RFC_EXTERNAL_FAILURE.value * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 643, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1856, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_15)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_15); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_kp_s_Error_in_bgRFC_handler_onGetStat, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1856, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { + PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_kp_s_Error_in_bgRFC_handler_onGetStat, __pyx_v_ex}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1856, __pyx_L6_except_error) + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_16 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1856, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_16); + if (__pyx_t_15) { + __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onGetStat); + __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onGetStat); + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onGetStat); + __Pyx_INCREF(__pyx_v_ex); + __Pyx_GIVEREF(__pyx_v_ex); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_11, __pyx_v_ex); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1856, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":642 - * self._open() - * rc = RfcGetUnitID(self._handle, uid, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * return wrapString(uid, RFC_UNITID_LN) + /* "pyrfc/_cyrfc.pyx":1857 + * except Exception as ex: + * _server_log("Error in bgRFC handler onGetState:\n", ex) + * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< + * + * def bgrfc_init(self, sysId, bgRfcFunction): */ - } + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1857, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1857, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1857, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_6 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1857, __pyx_L6_except_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_6; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L7_except_return; + } + goto __pyx_L6_except_error; + __pyx_L6_except_error:; - /* "src/pyrfc/client.pyx":644 - * if rc != RFC_OK: - * self._error(&errorInfo) - * return wrapString(uid, RFC_UNITID_LN) # <<<<<<<<<<<<<< - * - * def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): + /* "pyrfc/_cyrfc.pyx":1840 + * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * try: # <<<<<<<<<<<<<< + * unit_identifier = wrapUnitIdentifier(identifier[0]) + * state = handler(rfcHandle, unit_identifier) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(RFC_UNITID_LN); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 644, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5.__pyx_n = 1; - __pyx_t_5.uclen = __pyx_t_1; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uid, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 644, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L1_error; + __pyx_L8_try_return:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L0; + __pyx_L7_except_return:; + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L0; + } - /* "src/pyrfc/client.pyx":633 - * # BACKGROUND RFC + /* "pyrfc/_cyrfc.pyx":1831 * - * def _get_unit_id(self): # <<<<<<<<<<<<<< - * """Returns a unique 32 char bgRFC unit ID (GUID).""" - * cdef RFC_RC rc + * @staticmethod + * cdef RFC_RC __onGetStateFunction( # <<<<<<<<<<<<<< + * RFC_CONNECTION_HANDLE rfcHandle, + * const RFC_UNIT_IDENTIFIER *identifier, */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._get_unit_id", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onGetStateFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = (RFC_RC) 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_handler); + __Pyx_XDECREF(__pyx_v_unit_identifier); + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v_ex); __Pyx_RefNannyFinishContext(); + #ifdef WITH_THREAD + __Pyx_PyGILState_Release(__pyx_gilstate_save); + #endif return __pyx_r; } -/* "src/pyrfc/client.pyx":646 - * return wrapString(uid, RFC_UNITID_LN) +/* "pyrfc/_cyrfc.pyx":1859 + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * + * def bgrfc_init(self, sysId, bgRfcFunction): # <<<<<<<<<<<<<< + * """Installs the necessary callback functions for processing incoming bgRFC calls. * - * def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< - * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) - * cdef RFC_RC rc */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_51_create_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_51_create_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_unit_id = 0; - PyObject *__pyx_v_calls = 0; - PyObject *__pyx_v_queue_names = 0; - PyObject *__pyx_v_attributes = 0; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_3bgrfc_init(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_2bgrfc_init[] = "Installs the necessary callback functions for processing incoming bgRFC calls.\n\n These functions need to be implemented by Python application and will be used by the RFC runtime.\n When no callback function is provided, the default one is used,\n not necessarily matching your application requirements.\n\n For more info search for the ``RfcInstallBgRfcHandlers`` method in\n `SAP NetWeaver RFC SDK Doxygen Documentation `_\n\n :param sysId: System ID of the SAP system for which to use this set of transaction handlers, or None\n When None value provided, the transaction handlers will be used for bgRFC calls from\n any backend system, for which no explicit handlers have been installed.\n :type sysId: string or None\n\n :param bgRfcFunction: Function callbacks\n :type bgRfcFunction: dict(str, function)\n\n * \"check\": onCheckFunction,\n * \"commit\": onCommitFunction,\n * \"rollback\": onRollbackFunction,\n * \"confirm\": onConfirmFunction,\n * \"getState\": onGetStateFunction,\n\n :return: error code, zero when no error\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_3bgrfc_init(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_sysId = 0; + PyObject *__pyx_v_bgRfcFunction = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_create_and_submit_unit (wrapper)", 0); + __Pyx_RefNannySetupContext("bgrfc_init (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unit_id,&__pyx_n_s_calls,&__pyx_n_s_queue_names,&__pyx_n_s_attributes,0}; - PyObject* values[4] = {0,0,0,0}; - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)Py_None); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sysId,&__pyx_n_s_bgRfcFunction_2,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 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); @@ -24782,1989 +24287,1792 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_51_create_and_submit_unit( kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unit_id)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sysId)) != 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_calls)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bgRfcFunction_2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_create_and_submit_unit", 0, 2, 4, 1); __PYX_ERR(2, 646, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_names); - if (value) { values[2] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes); - if (value) { values[3] = value; kw_args--; } + __Pyx_RaiseArgtupleInvalid("bgrfc_init", 1, 2, 2, 1); __PYX_ERR(0, 1859, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_create_and_submit_unit") < 0)) __PYX_ERR(2, 646, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bgrfc_init") < 0)) __PYX_ERR(0, 1859, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_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); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_unit_id = values[0]; - __pyx_v_calls = values[1]; - __pyx_v_queue_names = values[2]; - __pyx_v_attributes = values[3]; + __pyx_v_sysId = values[0]; + __pyx_v_bgRfcFunction = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_create_and_submit_unit", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 646, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("bgrfc_init", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1859, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.bgrfc_init", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_50_create_and_submit_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_2bgrfc_init(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), __pyx_v_sysId, __pyx_v_bgRfcFunction); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_50_create_and_submit_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit_id, PyObject *__pyx_v_calls, PyObject *__pyx_v_queue_names, PyObject *__pyx_v_attributes) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - int __pyx_v_queueNameCount; - SAP_UC **__pyx_v_queueNames; - RFC_UNIT_ATTRIBUTES __pyx_v_unitAttr; - RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; - RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; - RFC_FUNCTION_HANDLE __pyx_v_funcCont; - SAP_UC *__pyx_v_sapuc; - SAP_UC *__pyx_v_uid; - PyObject *__pyx_v_i = NULL; - PyObject *__pyx_v_queue_name = NULL; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_2bgrfc_init(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_sysId, PyObject *__pyx_v_bgRfcFunction) { PyObject *__pyx_v_func_name = NULL; - PyObject *__pyx_v_params = NULL; - SAP_UC *__pyx_v_funcName; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_value = NULL; - CYTHON_UNUSED PyObject *__pyx_v_e = NULL; - PyObject *__pyx_v_unit_identifier = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - SAP_UC *__pyx_t_4; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - short __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - PyObject *(*__pyx_t_17)(PyObject *); - Py_ssize_t __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - char const *__pyx_t_21; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - PyObject *__pyx_t_25 = NULL; - PyObject *__pyx_t_26 = NULL; - PyObject *__pyx_t_27 = NULL; - char const *__pyx_t_28; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + Py_UCS4 __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_create_and_submit_unit", 0); - __Pyx_INCREF(__pyx_v_queue_names); - - /* "src/pyrfc/client.pyx":659 - * cdef SAP_UC* sapuc - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 659, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (__pyx_t_3) { + __Pyx_RefNannySetupContext("bgrfc_init", 0); - /* "src/pyrfc/client.pyx":660 - * - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * - * # uid + /* "pyrfc/_cyrfc.pyx":1885 + * :return: error code, zero when no error + * """ + * for func_name in bgRfcFunction: # <<<<<<<<<<<<<< + * if func_name not in Server.__bgRfcFunction: + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":659 - * cdef SAP_UC* sapuc - * - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * - */ - } - - /* "src/pyrfc/client.pyx":663 - * - * # uid - * uid = fillString(unit_id) # <<<<<<<<<<<<<< - * # queue - * queue_names = queue_names or [] - */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_unit_id); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 663, __pyx_L1_error) - __pyx_v_uid = __pyx_t_4; - - /* "src/pyrfc/client.pyx":665 - * uid = fillString(unit_id) - * # queue - * queue_names = queue_names or [] # <<<<<<<<<<<<<< - * if len(queue_names) == 0: - * queueNameCount = 0 - */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_queue_names); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 665, __pyx_L1_error) - if (!__pyx_t_3) { + if (likely(PyList_CheckExact(__pyx_v_bgRfcFunction)) || PyTuple_CheckExact(__pyx_v_bgRfcFunction)) { + __pyx_t_1 = __pyx_v_bgRfcFunction; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; } else { - __Pyx_INCREF(__pyx_v_queue_names); - __pyx_t_1 = __pyx_v_queue_names; - goto __pyx_L4_bool_binop_done; + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1885, __pyx_L1_error) } - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 665, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_5); - __pyx_t_1 = __pyx_t_5; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_L4_bool_binop_done:; - __Pyx_DECREF_SET(__pyx_v_queue_names, __pyx_t_1); - __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1885, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1885, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 1885, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_4); + __pyx_t_4 = 0; - /* "src/pyrfc/client.pyx":666 - * # queue - * queue_names = queue_names or [] - * if len(queue_names) == 0: # <<<<<<<<<<<<<< - * queueNameCount = 0 - * queueNames = NULL + /* "pyrfc/_cyrfc.pyx":1886 + * """ + * for func_name in bgRfcFunction: + * if func_name not in Server.__bgRfcFunction: # <<<<<<<<<<<<<< + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") + * if not callable(bgRfcFunction[func_name]): */ - __pyx_t_6 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 666, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_6 == 0) != 0); - if (__pyx_t_3) { + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1886, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_func_name, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1886, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (__pyx_t_5 != 0); + if (unlikely(__pyx_t_6)) { - /* "src/pyrfc/client.pyx":667 - * queue_names = queue_names or [] - * if len(queue_names) == 0: - * queueNameCount = 0 # <<<<<<<<<<<<<< - * queueNames = NULL - * else: + /* "pyrfc/_cyrfc.pyx":1887 + * for func_name in bgRfcFunction: + * if func_name not in Server.__bgRfcFunction: + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") # <<<<<<<<<<<<<< + * if not callable(bgRfcFunction[func_name]): + * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") */ - __pyx_v_queueNameCount = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = 0; + __pyx_t_8 = 127; + __Pyx_INCREF(__pyx_kp_u_BgRfc_callback_function_key_not); + __pyx_t_7 += 44; + __Pyx_GIVEREF(__pyx_kp_u_BgRfc_callback_function_key_not); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_BgRfc_callback_function_key_not); + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; + __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_7 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__6); + __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1887, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1887, __pyx_L1_error) - /* "src/pyrfc/client.pyx":668 - * if len(queue_names) == 0: - * queueNameCount = 0 - * queueNames = NULL # <<<<<<<<<<<<<< - * else: - * queueNameCount = int(len(queue_names)) + /* "pyrfc/_cyrfc.pyx":1886 + * """ + * for func_name in bgRfcFunction: + * if func_name not in Server.__bgRfcFunction: # <<<<<<<<<<<<<< + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") + * if not callable(bgRfcFunction[func_name]): */ - __pyx_v_queueNames = NULL; + } - /* "src/pyrfc/client.pyx":666 - * # queue - * queue_names = queue_names or [] - * if len(queue_names) == 0: # <<<<<<<<<<<<<< - * queueNameCount = 0 - * queueNames = NULL + /* "pyrfc/_cyrfc.pyx":1888 + * if func_name not in Server.__bgRfcFunction: + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") + * if not callable(bgRfcFunction[func_name]): # <<<<<<<<<<<<<< + * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") + * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] */ - goto __pyx_L6; - } + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_bgRfcFunction, __pyx_v_func_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1888, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_t_4); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1888, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0); + if (unlikely(__pyx_t_5)) { - /* "src/pyrfc/client.pyx":670 - * queueNames = NULL - * else: - * queueNameCount = int(len(queue_names)) # <<<<<<<<<<<<<< - * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) - * for i, queue_name in enumerate(queue_names): + /* "pyrfc/_cyrfc.pyx":1889 + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") + * if not callable(bgRfcFunction[func_name]): + * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") # <<<<<<<<<<<<<< + * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] + * return self.install_bgrfc_handlers(sysId) */ - /*else*/ { - __pyx_t_6 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 670, __pyx_L1_error) - __pyx_v_queueNameCount = ((int)__pyx_t_6); + __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = 0; + __pyx_t_8 = 127; + __Pyx_INCREF(__pyx_kp_u_BgRfc_callback_function_referenc); + __pyx_t_7 += 39; + __Pyx_GIVEREF(__pyx_kp_u_BgRfc_callback_function_referenc); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_BgRfc_callback_function_referenc); + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; + __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_kp_u_is_not_callable); + __pyx_t_7 += 20; + __Pyx_GIVEREF(__pyx_kp_u_is_not_callable); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_is_not_callable); + __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_bgRfcFunction, __pyx_v_func_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_t_9, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_8; + __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_10); + __pyx_t_10 = 0; + __Pyx_INCREF(__pyx_kp_u__6); + __pyx_t_7 += 1; + __Pyx_GIVEREF(__pyx_kp_u__6); + PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__6); + __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 1889, __pyx_L1_error) - /* "src/pyrfc/client.pyx":671 - * else: - * queueNameCount = int(len(queue_names)) - * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) # <<<<<<<<<<<<<< - * for i, queue_name in enumerate(queue_names): - * queueNames[i] = fillString(queue_name) + /* "pyrfc/_cyrfc.pyx":1888 + * if func_name not in Server.__bgRfcFunction: + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") + * if not callable(bgRfcFunction[func_name]): # <<<<<<<<<<<<<< + * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") + * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] */ - __pyx_v_queueNames = ((SAP_UC **)mallocU((__pyx_v_queueNameCount * (sizeof(SAP_UC *))))); + } - /* "src/pyrfc/client.pyx":672 - * queueNameCount = int(len(queue_names)) - * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) - * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< - * queueNames[i] = fillString(queue_name) - * # attributes + /* "pyrfc/_cyrfc.pyx":1890 + * if not callable(bgRfcFunction[func_name]): + * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") + * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] # <<<<<<<<<<<<<< + * return self.install_bgrfc_handlers(sysId) + * */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_queue_names)) || PyTuple_CheckExact(__pyx_v_queue_names)) { - __pyx_t_5 = __pyx_v_queue_names; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_queue_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 672, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(2, 672, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(2, 672, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } - } else { - __pyx_t_8 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_8)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 672, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF_SET(__pyx_v_queue_name, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_bgRfcFunction, __pyx_v_func_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_v_func_name, __pyx_t_4) < 0)) __PYX_ERR(0, 1890, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/client.pyx":673 - * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) - * for i, queue_name in enumerate(queue_names): - * queueNames[i] = fillString(queue_name) # <<<<<<<<<<<<<< - * # attributes - * # set default values + /* "pyrfc/_cyrfc.pyx":1885 + * :return: error code, zero when no error + * """ + * for func_name in bgRfcFunction: # <<<<<<<<<<<<<< + * if func_name not in Server.__bgRfcFunction: + * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_queue_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 673, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 673, __pyx_L1_error) - (__pyx_v_queueNames[__pyx_t_9]) = __pyx_t_4; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":672 - * queueNameCount = int(len(queue_names)) - * queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) - * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< - * queueNames[i] = fillString(queue_name) - * # attributes + /* "pyrfc/_cyrfc.pyx":1891 + * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") + * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] + * return self.install_bgrfc_handlers(sysId) # <<<<<<<<<<<<<< + * + * def install_bgrfc_handlers(self, sysId): */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_install_bgrfc_handlers); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __pyx_L6:; + __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_v_sysId) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_sysId); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":676 - * # attributes - * # set default values - * memsetR(&unitAttr, 0, sizeof(RFC_UNIT_ATTRIBUTES)) # <<<<<<<<<<<<<< - * memsetR(&uIdentifier, 0, sizeof(RFC_UNIT_IDENTIFIER)) - * # unitAttr.kernelTrace = 0 (short) If != 0, the backend will write kernel traces, while executing this unit. + /* "pyrfc/_cyrfc.pyx":1859 + * return RCStatus.RFC_EXTERNAL_FAILURE.value + * + * def bgrfc_init(self, sysId, bgRfcFunction): # <<<<<<<<<<<<<< + * """Installs the necessary callback functions for processing incoming bgRFC calls. + * */ - memsetR((&__pyx_v_unitAttr), 0, (sizeof(RFC_UNIT_ATTRIBUTES))); - /* "src/pyrfc/client.pyx":677 - * # set default values - * memsetR(&unitAttr, 0, sizeof(RFC_UNIT_ATTRIBUTES)) - * memsetR(&uIdentifier, 0, sizeof(RFC_UNIT_IDENTIFIER)) # <<<<<<<<<<<<<< - * # unitAttr.kernelTrace = 0 (short) If != 0, the backend will write kernel traces, while executing this unit. - * # unitAttr.satTrace = 0 (short) If != 0, the backend will keep a "history" for this unit. - */ - memsetR((&__pyx_v_uIdentifier), 0, (sizeof(RFC_UNIT_IDENTIFIER))); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.bgrfc_init", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_func_name); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":704 - * # Sending time in UTC (GMT-0). Used only when the external program is server. - * # In the client case the nwrfclib fills this automatically. - * if attributes is not None: # <<<<<<<<<<<<<< - * if 'kernel_trace' in attributes: - * unitAttr.kernelTrace = attributes['kernel_trace'] +/* "pyrfc/_cyrfc.pyx":1893 + * return self.install_bgrfc_handlers(sysId) + * + * def install_bgrfc_handlers(self, sysId): # <<<<<<<<<<<<<< + * ucSysId = fillString(sysId) if sysId is not None else NULL + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_3 = (__pyx_v_attributes != Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - /* "src/pyrfc/client.pyx":705 - * # In the client case the nwrfclib fills this automatically. - * if attributes is not None: - * if 'kernel_trace' in attributes: # <<<<<<<<<<<<<< - * unitAttr.kernelTrace = attributes['kernel_trace'] - * if 'sat_trace' in attributes: - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_kernel_trace, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 705, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5install_bgrfc_handlers(PyObject *__pyx_v_self, PyObject *__pyx_v_sysId); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5install_bgrfc_handlers(PyObject *__pyx_v_self, PyObject *__pyx_v_sysId) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("install_bgrfc_handlers (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_4install_bgrfc_handlers(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v_sysId)); - /* "src/pyrfc/client.pyx":706 - * if attributes is not None: - * if 'kernel_trace' in attributes: - * unitAttr.kernelTrace = attributes['kernel_trace'] # <<<<<<<<<<<<<< - * if 'sat_trace' in attributes: - * unitAttr.satTrace = attributes['sat_trace'] - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_kernel_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 706, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(2, 706, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_unitAttr.kernelTrace = __pyx_t_10; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":705 - * # In the client case the nwrfclib fills this automatically. - * if attributes is not None: - * if 'kernel_trace' in attributes: # <<<<<<<<<<<<<< - * unitAttr.kernelTrace = attributes['kernel_trace'] - * if 'sat_trace' in attributes: - */ - } +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_4install_bgrfc_handlers(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_sysId) { + SAP_UC *__pyx_v_ucSysId; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_RC __pyx_v_rc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + SAP_UC *__pyx_t_1; + int __pyx_t_2; + SAP_UC *__pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("install_bgrfc_handlers", 0); - /* "src/pyrfc/client.pyx":707 - * if 'kernel_trace' in attributes: - * unitAttr.kernelTrace = attributes['kernel_trace'] - * if 'sat_trace' in attributes: # <<<<<<<<<<<<<< - * unitAttr.satTrace = attributes['sat_trace'] - * if 'unit_history' in attributes: + /* "pyrfc/_cyrfc.pyx":1894 + * + * def install_bgrfc_handlers(self, sysId): + * ucSysId = fillString(sysId) if sysId is not None else NULL # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcInstallBgRfcHandlers( */ - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_sat_trace, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 707, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __pyx_t_2 = (__pyx_v_sysId != Py_None); + if ((__pyx_t_2 != 0)) { + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_sysId); if (unlikely(__pyx_t_3 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1894, __pyx_L1_error) + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = NULL; + } + __pyx_v_ucSysId = __pyx_t_1; - /* "src/pyrfc/client.pyx":708 - * unitAttr.kernelTrace = attributes['kernel_trace'] - * if 'sat_trace' in attributes: - * unitAttr.satTrace = attributes['sat_trace'] # <<<<<<<<<<<<<< - * if 'unit_history' in attributes: - * unitAttr.unitHistory = attributes['unit_history'] + /* "pyrfc/_cyrfc.pyx":1896 + * ucSysId = fillString(sysId) if sysId is not None else NULL + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcInstallBgRfcHandlers( # <<<<<<<<<<<<<< + * ucSysId, + * Server.__onCheckFunction, */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_sat_trace); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 708, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(2, 708, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_unitAttr.satTrace = __pyx_t_10; + __pyx_v_rc = RfcInstallBgRfcHandlers(__pyx_v_ucSysId, __pyx_f_5pyrfc_6_cyrfc_6Server___onCheckFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onCommitFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onRollbackFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onConfirmFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onGetStateFunction, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":707 - * if 'kernel_trace' in attributes: - * unitAttr.kernelTrace = attributes['kernel_trace'] - * if 'sat_trace' in attributes: # <<<<<<<<<<<<<< - * unitAttr.satTrace = attributes['sat_trace'] - * if 'unit_history' in attributes: + /* "pyrfc/_cyrfc.pyx":1905 + * &errorInfo + * ) + * free(ucSysId) # <<<<<<<<<<<<<< + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) */ - } + free(__pyx_v_ucSysId); - /* "src/pyrfc/client.pyx":709 - * if 'sat_trace' in attributes: - * unitAttr.satTrace = attributes['sat_trace'] - * if 'unit_history' in attributes: # <<<<<<<<<<<<<< - * unitAttr.unitHistory = attributes['unit_history'] - * if 'lock' in attributes: + /* "pyrfc/_cyrfc.pyx":1906 + * ) + * free(ucSysId) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return rc */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_unit_history, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 709, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); + if (!__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + __pyx_t_2 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/client.pyx":710 - * unitAttr.satTrace = attributes['sat_trace'] - * if 'unit_history' in attributes: - * unitAttr.unitHistory = attributes['unit_history'] # <<<<<<<<<<<<<< - * if 'lock' in attributes: - * unitAttr.lock = attributes['lock'] + /* "pyrfc/_cyrfc.pyx":1907 + * free(ucSysId) + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return rc + * */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_unit_history); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 710, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(2, 710, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_unitAttr.unitHistory = __pyx_t_10; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1907, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __PYX_ERR(0, 1907, __pyx_L1_error) - /* "src/pyrfc/client.pyx":709 - * if 'sat_trace' in attributes: - * unitAttr.satTrace = attributes['sat_trace'] - * if 'unit_history' in attributes: # <<<<<<<<<<<<<< - * unitAttr.unitHistory = attributes['unit_history'] - * if 'lock' in attributes: + /* "pyrfc/_cyrfc.pyx":1906 + * ) + * free(ucSysId) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return rc */ - } + } - /* "src/pyrfc/client.pyx":711 - * if 'unit_history' in attributes: - * unitAttr.unitHistory = attributes['unit_history'] - * if 'lock' in attributes: # <<<<<<<<<<<<<< - * unitAttr.lock = attributes['lock'] - * if 'no_commit_check' in attributes: + /* "pyrfc/_cyrfc.pyx":1908 + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) + * return rc # <<<<<<<<<<<<<< + * + * def add_function(self, func_name, callback): */ - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_lock, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 711, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1908, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":712 - * unitAttr.unitHistory = attributes['unit_history'] - * if 'lock' in attributes: - * unitAttr.lock = attributes['lock'] # <<<<<<<<<<<<<< - * if 'no_commit_check' in attributes: - * unitAttr.noCommitCheck = attributes['no_commit_check'] - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_lock); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(2, 712, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_unitAttr.lock = __pyx_t_10; - - /* "src/pyrfc/client.pyx":711 - * if 'unit_history' in attributes: - * unitAttr.unitHistory = attributes['unit_history'] - * if 'lock' in attributes: # <<<<<<<<<<<<<< - * unitAttr.lock = attributes['lock'] - * if 'no_commit_check' in attributes: - */ - } - - /* "src/pyrfc/client.pyx":713 - * if 'lock' in attributes: - * unitAttr.lock = attributes['lock'] - * if 'no_commit_check' in attributes: # <<<<<<<<<<<<<< - * unitAttr.noCommitCheck = attributes['no_commit_check'] - * if 'user' in attributes and attributes['user'] is not None: + /* "pyrfc/_cyrfc.pyx":1893 + * return self.install_bgrfc_handlers(sysId) + * + * def install_bgrfc_handlers(self, sysId): # <<<<<<<<<<<<<< + * ucSysId = fillString(sysId) if sysId is not None else NULL + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_no_commit_check, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 713, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":714 - * unitAttr.lock = attributes['lock'] - * if 'no_commit_check' in attributes: - * unitAttr.noCommitCheck = attributes['no_commit_check'] # <<<<<<<<<<<<<< - * if 'user' in attributes and attributes['user'] is not None: - * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_no_commit_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 714, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_1); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(2, 714, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_unitAttr.noCommitCheck = __pyx_t_10; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.install_bgrfc_handlers", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":713 - * if 'lock' in attributes: - * unitAttr.lock = attributes['lock'] - * if 'no_commit_check' in attributes: # <<<<<<<<<<<<<< - * unitAttr.noCommitCheck = attributes['no_commit_check'] - * if 'user' in attributes and attributes['user'] is not None: +/* "pyrfc/_cyrfc.pyx":1910 + * return rc + * + * def add_function(self, func_name, callback): # <<<<<<<<<<<<<< + * """ + * Installs a function in the server. */ - } - /* "src/pyrfc/client.pyx":715 - * if 'no_commit_check' in attributes: - * unitAttr.noCommitCheck = attributes['no_commit_check'] - * if 'user' in attributes and attributes['user'] is not None: # <<<<<<<<<<<<<< - * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. - * sapuc = fillString(attributes['user'][0:12]) - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_user, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 715, __pyx_L1_error) - __pyx_t_11 = (__pyx_t_2 != 0); - if (__pyx_t_11) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_7add_function(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_6add_function[] = "\n Installs a function in the server.\n\n :param func_name: ABAP remote function module name\n :type func_name: string\n\n :param callback: A callback function that implements the logic.\n The function must accept a ``request_context`` parameter and\n all IMPORT, CHANGING, and TABLE parameters of the given\n ``func_desc``.\n :raises: :exc:`TypeError` if a function with the name given is already\n installed.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_7add_function(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_func_name = 0; + PyObject *__pyx_v_callback = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_function (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_callback,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_func_name)) != 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_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_function", 1, 2, 2, 1); __PYX_ERR(0, 1910, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_function") < 0)) __PYX_ERR(0, 1910, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; } else { - __pyx_t_3 = __pyx_t_11; - goto __pyx_L16_bool_binop_done; + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_user); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = (__pyx_t_1 != Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = (__pyx_t_11 != 0); - __pyx_t_3 = __pyx_t_2; - __pyx_L16_bool_binop_done:; - if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":717 - * if 'user' in attributes and attributes['user'] is not None: - * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. - * sapuc = fillString(attributes['user'][0:12]) # <<<<<<<<<<<<<< - * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) - * free(sapuc) - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_user); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 717, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 12, NULL, NULL, &__pyx_slice__27, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 717, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 717, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_sapuc = __pyx_t_4; - - /* "src/pyrfc/client.pyx":718 - * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. - * sapuc = fillString(attributes['user'][0:12]) - * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if 'client' in attributes: - */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_user); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 12, NULL, NULL, &__pyx_slice__27, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 718, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_unitAttr.user, __pyx_v_sapuc, (__pyx_t_6 + 1)); + __pyx_v_func_name = values[0]; + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_function", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1910, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Server.add_function", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_6add_function(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), __pyx_v_func_name, __pyx_v_callback); - /* "src/pyrfc/client.pyx":719 - * sapuc = fillString(attributes['user'][0:12]) - * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if 'client' in attributes: - * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". - */ - free(__pyx_v_sapuc); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":715 - * if 'no_commit_check' in attributes: - * unitAttr.noCommitCheck = attributes['no_commit_check'] - * if 'user' in attributes and attributes['user'] is not None: # <<<<<<<<<<<<<< - * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. - * sapuc = fillString(attributes['user'][0:12]) - */ - } +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_6add_function(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_callback) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_ABAP_NAME __pyx_v_funcName; + RFC_FUNCTION_DESC_HANDLE __pyx_v_func_desc_handle; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + Py_ssize_t __pyx_t_4; + Py_UCS4 __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + SAP_UC *__pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add_function", 0); - /* "src/pyrfc/client.pyx":720 - * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) - * free(sapuc) - * if 'client' in attributes: # <<<<<<<<<<<<<< - * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". - * sapuc = fillString(attributes['client'][0:3]) + /* "pyrfc/_cyrfc.pyx":1925 + * """ + * global server_functions + * if func_name in server_functions: # <<<<<<<<<<<<<< + * raise TypeError(f"Server function '{func_name}' already installed.") + * */ - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_client, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 720, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_func_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1925, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/client.pyx":722 - * if 'client' in attributes: - * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". - * sapuc = fillString(attributes['client'][0:3]) # <<<<<<<<<<<<<< - * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":1926 + * global server_functions + * if func_name in server_functions: + * raise TypeError(f"Server function '{func_name}' already installed.") # <<<<<<<<<<<<<< + * + * if not self._client_connection: */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_client); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 722, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 3, NULL, NULL, &__pyx_slice__18, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 722, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 722, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_sapuc = __pyx_t_4; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_5 = 127; + __Pyx_INCREF(__pyx_kp_u_Server_function); + __pyx_t_4 += 17; + __Pyx_GIVEREF(__pyx_kp_u_Server_function); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Server_function); + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); + __pyx_t_6 = 0; + __Pyx_INCREF(__pyx_kp_u_already_installed); + __pyx_t_4 += 20; + __Pyx_GIVEREF(__pyx_kp_u_already_installed); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_already_installed); + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1926, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 1926, __pyx_L1_error) - /* "src/pyrfc/client.pyx":723 - * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". - * sapuc = fillString(attributes['client'][0:3]) - * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if 't_code' in attributes: + /* "pyrfc/_cyrfc.pyx":1925 + * """ + * global server_functions + * if func_name in server_functions: # <<<<<<<<<<<<<< + * raise TypeError(f"Server function '{func_name}' already installed.") + * */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_client); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 3, NULL, NULL, &__pyx_slice__18, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 723, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_unitAttr.client, __pyx_v_sapuc, (__pyx_t_6 + 1)); + } - /* "src/pyrfc/client.pyx":724 - * sapuc = fillString(attributes['client'][0:3]) - * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if 't_code' in attributes: - * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + /* "pyrfc/_cyrfc.pyx":1928 + * raise TypeError(f"Server function '{func_name}' already installed.") + * + * if not self._client_connection: # <<<<<<<<<<<<<< + * self._client_connection.open() + * cdef RFC_ERROR_INFO errorInfo */ - free(__pyx_v_sapuc); + __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_client_connection)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1928, __pyx_L1_error) + __pyx_t_2 = ((!__pyx_t_3) != 0); + if (__pyx_t_2) { - /* "src/pyrfc/client.pyx":720 - * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) - * free(sapuc) - * if 'client' in attributes: # <<<<<<<<<<<<<< - * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". - * sapuc = fillString(attributes['client'][0:3]) + /* "pyrfc/_cyrfc.pyx":1929 + * + * if not self._client_connection: + * self._client_connection.open() # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_ABAP_NAME funcName = fillString(func_name) */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_client_connection), __pyx_n_s_open); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":725 - * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) - * free(sapuc) - * if 't_code' in attributes: # <<<<<<<<<<<<<< - * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". - * sapuc = fillString(attributes['t_code'][0:20]) + /* "pyrfc/_cyrfc.pyx":1928 + * raise TypeError(f"Server function '{func_name}' already installed.") + * + * if not self._client_connection: # <<<<<<<<<<<<<< + * self._client_connection.open() + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_t_code, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 725, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + } - /* "src/pyrfc/client.pyx":727 - * if 't_code' in attributes: - * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". - * sapuc = fillString(attributes['t_code'][0:20]) # <<<<<<<<<<<<<< - * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":1931 + * self._client_connection.open() + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_ABAP_NAME funcName = fillString(func_name) # <<<<<<<<<<<<<< + * cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) + * self._client_connection.close() */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_t_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 727, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 20, NULL, NULL, &__pyx_slice__16, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 727, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 727, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_sapuc = __pyx_t_4; + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(0, 1931, __pyx_L1_error) + memcpy(&(__pyx_v_funcName[0]), __pyx_t_8, sizeof(__pyx_v_funcName[0]) * ((30 + 1) - 0)); - /* "src/pyrfc/client.pyx":728 - * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". - * sapuc = fillString(attributes['t_code'][0:20]) - * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * if 'program' in attributes and attributes['program'] is not None: + /* "pyrfc/_cyrfc.pyx":1932 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_ABAP_NAME funcName = fillString(func_name) + * cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< + * self._client_connection.close() + * */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_t_code); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 20, NULL, NULL, &__pyx_slice__16, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 728, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 728, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_unitAttr.tCode, __pyx_v_sapuc, (__pyx_t_6 + 1)); + __pyx_v_func_desc_handle = RfcGetFunctionDesc(__pyx_v_self->_client_connection->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":729 - * sapuc = fillString(attributes['t_code'][0:20]) - * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * if 'program' in attributes and attributes['program'] is not None: - * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. + /* "pyrfc/_cyrfc.pyx":1933 + * cdef RFC_ABAP_NAME funcName = fillString(func_name) + * cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) + * self._client_connection.close() # <<<<<<<<<<<<<< + * + * if errorInfo.code != RFC_OK: */ - free(__pyx_v_sapuc); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_client_connection), __pyx_n_s_close_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1933, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1933, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":725 - * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) - * free(sapuc) - * if 't_code' in attributes: # <<<<<<<<<<<<<< - * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". - * sapuc = fillString(attributes['t_code'][0:20]) + /* "pyrfc/_cyrfc.pyx":1935 + * self._client_connection.close() + * + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * */ - } + __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/client.pyx":730 - * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) - * free(sapuc) - * if 'program' in attributes and attributes['program'] is not None: # <<<<<<<<<<<<<< - * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. - * sapuc = fillString(attributes['program'][0:40]) + /* "pyrfc/_cyrfc.pyx":1936 + * + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * + * server_functions[func_name] = { */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_program, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 730, __pyx_L1_error) - __pyx_t_11 = (__pyx_t_2 != 0); - if (__pyx_t_11) { - } else { - __pyx_t_3 = __pyx_t_11; - goto __pyx_L21_bool_binop_done; - } - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_program); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 730, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1936, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = (__pyx_t_1 != Py_None); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = (__pyx_t_11 != 0); - __pyx_t_3 = __pyx_t_2; - __pyx_L21_bool_binop_done:; - if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":732 - * if 'program' in attributes and attributes['program'] is not None: - * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. - * sapuc = fillString(attributes['program'][0:40]) # <<<<<<<<<<<<<< - * strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) - * free(sapuc) - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_program); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 732, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 40, NULL, NULL, &__pyx_slice__28, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 732, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_5); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 732, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_sapuc = __pyx_t_4; + __PYX_ERR(0, 1936, __pyx_L1_error) - /* "src/pyrfc/client.pyx":733 - * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. - * sapuc = fillString(attributes['program'][0:40]) - * strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) # <<<<<<<<<<<<<< - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":1935 + * self._client_connection.close() * - */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_attributes, __pyx_n_s_program); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 40, NULL, NULL, &__pyx_slice__28, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 733, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 733, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_unitAttr.program, __pyx_v_sapuc, (__pyx_t_6 + 1)); - - /* "src/pyrfc/client.pyx":734 - * sapuc = fillString(attributes['program'][0:40]) - * strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) - * free(sapuc) # <<<<<<<<<<<<<< + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) * - * self._uHandle = RfcCreateUnit(self._handle, uid, queueNames, queueNameCount, &unitAttr, &uIdentifier, &errorInfo) */ - free(__pyx_v_sapuc); + } - /* "src/pyrfc/client.pyx":730 - * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) - * free(sapuc) - * if 'program' in attributes and attributes['program'] is not None: # <<<<<<<<<<<<<< - * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. - * sapuc = fillString(attributes['program'][0:40]) + /* "pyrfc/_cyrfc.pyx":1939 + * + * server_functions[func_name] = { + * "func_desc_handle": func_desc_handle, # <<<<<<<<<<<<<< + * "callback": callback, + * "server": self */ - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_func_desc_handle)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1939, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_func_desc_handle, __pyx_t_6) < 0) __PYX_ERR(0, 1939, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/client.pyx":704 - * # Sending time in UTC (GMT-0). Used only when the external program is server. - * # In the client case the nwrfclib fills this automatically. - * if attributes is not None: # <<<<<<<<<<<<<< - * if 'kernel_trace' in attributes: - * unitAttr.kernelTrace = attributes['kernel_trace'] + /* "pyrfc/_cyrfc.pyx":1940 + * server_functions[func_name] = { + * "func_desc_handle": func_desc_handle, + * "callback": callback, # <<<<<<<<<<<<<< + * "server": self + * } */ - } + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_callback, __pyx_v_callback) < 0) __PYX_ERR(0, 1939, __pyx_L1_error) - /* "src/pyrfc/client.pyx":736 - * free(sapuc) - * - * self._uHandle = RfcCreateUnit(self._handle, uid, queueNames, queueNameCount, &unitAttr, &uIdentifier, &errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1941 + * "func_desc_handle": func_desc_handle, + * "callback": callback, + * "server": self # <<<<<<<<<<<<<< + * } * - * # queue (deallocate) */ - __pyx_v_self->_uHandle = RfcCreateUnit(__pyx_v_self->_handle, __pyx_v_uid, ((const SAP_UC* *)__pyx_v_queueNames), __pyx_v_queueNameCount, (&__pyx_v_unitAttr), (&__pyx_v_uIdentifier), (&__pyx_v_errorInfo)); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_server, ((PyObject *)__pyx_v_self)) < 0) __PYX_ERR(0, 1939, __pyx_L1_error) - /* "src/pyrfc/client.pyx":739 + /* "pyrfc/_cyrfc.pyx":1938 + * raise wrapError(&errorInfo) * - * # queue (deallocate) - * if len(queue_names) > 0: # <<<<<<<<<<<<<< - * for i, queue_name in enumerate(queue_names): - * free(queueNames[i]) + * server_functions[func_name] = { # <<<<<<<<<<<<<< + * "func_desc_handle": func_desc_handle, + * "callback": callback, */ - __pyx_t_6 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(2, 739, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_6 > 0) != 0); - if (__pyx_t_3) { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1938, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_func_name, __pyx_t_1) < 0)) __PYX_ERR(0, 1938, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":740 - * # queue (deallocate) - * if len(queue_names) > 0: - * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< - * free(queueNames[i]) - * free(queueNames) + /* "pyrfc/_cyrfc.pyx":1944 + * } + * + * _server_log("Server function installed", func_name) # <<<<<<<<<<<<<< + * _server_log("Server function installed", server_functions[func_name]) + * */ - __Pyx_INCREF(__pyx_int_0); - __pyx_t_1 = __pyx_int_0; - if (likely(PyList_CheckExact(__pyx_v_queue_names)) || PyTuple_CheckExact(__pyx_v_queue_names)) { - __pyx_t_5 = __pyx_v_queue_names; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_queue_names); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 740, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(2, 740, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(2, 740, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - } - } else { - __pyx_t_8 = __pyx_t_7(__pyx_t_5); - if (unlikely(!__pyx_t_8)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 740, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_8); - } - __Pyx_XDECREF_SET(__pyx_v_queue_name, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); - __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 740, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_8; - __pyx_t_8 = 0; - - /* "src/pyrfc/client.pyx":741 - * if len(queue_names) > 0: - * for i, queue_name in enumerate(queue_names): - * free(queueNames[i]) # <<<<<<<<<<<<<< - * free(queueNames) - * # uid (deallocate) - */ - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 741, __pyx_L1_error) - free((__pyx_v_queueNames[__pyx_t_9])); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_9 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Server_function_installed, __pyx_v_func_name}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1944, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Server_function_installed, __pyx_v_func_name}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1944, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Server_function_installed); + __Pyx_GIVEREF(__pyx_kp_s_Server_function_installed); + PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_kp_s_Server_function_installed); + __Pyx_INCREF(__pyx_v_func_name); + __Pyx_GIVEREF(__pyx_v_func_name); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_func_name); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1944, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":740 - * # queue (deallocate) - * if len(queue_names) > 0: - * for i, queue_name in enumerate(queue_names): # <<<<<<<<<<<<<< - * free(queueNames[i]) - * free(queueNames) + /* "pyrfc/_cyrfc.pyx":1945 + * + * _server_log("Server function installed", func_name) + * _server_log("Server function installed", server_functions[func_name]) # <<<<<<<<<<<<<< + * + * def serve(self): */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1945, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1945, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_v_func_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1945, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_9 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_s_Server_function_installed, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1945, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_s_Server_function_installed, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1945, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1945, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (__pyx_t_10) { + __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; + } + __Pyx_INCREF(__pyx_kp_s_Server_function_installed); + __Pyx_GIVEREF(__pyx_kp_s_Server_function_installed); + PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_9, __pyx_kp_s_Server_function_installed); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_9, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1945, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":742 - * for i, queue_name in enumerate(queue_names): - * free(queueNames[i]) - * free(queueNames) # <<<<<<<<<<<<<< - * # uid (deallocate) - * free(uid) + /* "pyrfc/_cyrfc.pyx":1910 + * return rc + * + * def add_function(self, func_name, callback): # <<<<<<<<<<<<<< + * """ + * Installs a function in the server. */ - free(__pyx_v_queueNames); - /* "src/pyrfc/client.pyx":739 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.add_function", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1947 + * _server_log("Server function installed", server_functions[func_name]) * - * # queue (deallocate) - * if len(queue_names) > 0: # <<<<<<<<<<<<<< - * for i, queue_name in enumerate(queue_names): - * free(queueNames[i]) + * def serve(self): # <<<<<<<<<<<<<< + * """ + * Starts the RFC server, waiting for incoming requests and processes them. */ - } - /* "src/pyrfc/client.pyx":744 - * free(queueNames) - * # uid (deallocate) - * free(uid) # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_9serve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_8serve[] = "\n Starts the RFC server, waiting for incoming requests and processes them.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the server processing fails.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_9serve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("serve (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_8serve(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_8serve(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_RC __pyx_v_rc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("serve", 0); + + /* "pyrfc/_cyrfc.pyx":1956 + * cdef RFC_ERROR_INFO errorInfo * - * if self._uHandle == NULL: + * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) */ - free(__pyx_v_uid); + __pyx_v_rc = RfcInstallGenericServerFunction(__pyx_f_5pyrfc_6_cyrfc_genericHandler, __pyx_f_5pyrfc_6_cyrfc_metadataLookup, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":746 - * free(uid) + /* "pyrfc/_cyrfc.pyx":1957 + * + * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) * - * if self._uHandle == NULL: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * self.active_unit = True */ - __pyx_t_3 = ((__pyx_v_self->_uHandle == NULL) != 0); - if (__pyx_t_3) { + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/client.pyx":747 - * - * if self._uHandle == NULL: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * self.active_unit = True + /* "pyrfc/_cyrfc.pyx":1958 + * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * + * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1958, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1958, __pyx_L1_error) - /* "src/pyrfc/client.pyx":746 - * free(uid) + /* "pyrfc/_cyrfc.pyx":1957 + * + * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) * - * if self._uHandle == NULL: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * self.active_unit = True */ } - /* "src/pyrfc/client.pyx":748 - * if self._uHandle == NULL: - * self._error(&errorInfo) - * self.active_unit = True # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1960 + * raise wrapError(&errorInfo) * - * try: + * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_v_self->active_unit = 1; + __pyx_v_rc = RfcLaunchServer(__pyx_v_self->_server_connection->_handle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":750 - * self.active_unit = True + /* "pyrfc/_cyrfc.pyx":1961 * - * try: # <<<<<<<<<<<<<< - * for func_name, params in calls: - * funcName = fillString(func_name) + * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _server_log("Server", f"launched {self._server_connection.handle}") */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_14); - /*try:*/ { + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L7_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/client.pyx":751 + /* "pyrfc/_cyrfc.pyx":1962 + * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _server_log("Server", f"launched {self._server_connection.handle}") * - * try: - * for func_name, params in calls: # <<<<<<<<<<<<<< - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) */ - if (likely(PyList_CheckExact(__pyx_v_calls)) || PyTuple_CheckExact(__pyx_v_calls)) { - __pyx_t_1 = __pyx_v_calls; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_calls); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 751, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 751, __pyx_L27_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(2, 751, __pyx_L27_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 751, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(2, 751, __pyx_L27_error) - #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 751, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - #endif - } - } else { - __pyx_t_5 = __pyx_t_7(__pyx_t_1); - if (unlikely(!__pyx_t_5)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 751, __pyx_L27_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { - PyObject* sequence = __pyx_t_5; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 751, __pyx_L27_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_8 = PyList_GET_ITEM(sequence, 0); - __pyx_t_15 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_15); - #else - __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 751, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 751, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_15); - #endif - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_16 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(2, 751, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_16); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext; - index = 0; __pyx_t_8 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_8)) goto __pyx_L35_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 1; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L35_unpacking_failed; - __Pyx_GOTREF(__pyx_t_15); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 2) < 0) __PYX_ERR(2, 751, __pyx_L27_error) - __pyx_t_17 = NULL; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - goto __pyx_L36_unpacking_done; - __pyx_L35_unpacking_failed:; - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_17 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(2, 751, __pyx_L27_error) - __pyx_L36_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_15); - __pyx_t_15 = 0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1962, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 1962, __pyx_L1_error) - /* "src/pyrfc/client.pyx":752 - * try: - * for func_name, params in calls: - * funcName = fillString(func_name) # <<<<<<<<<<<<<< - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) + /* "pyrfc/_cyrfc.pyx":1961 + * + * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _server_log("Server", f"launched {self._server_connection.handle}") */ - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(2, 752, __pyx_L27_error) - __pyx_v_funcName = __pyx_t_4; + } - /* "src/pyrfc/client.pyx":753 - * for func_name, params in calls: - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< - * free(funcName) - * if not funcDesc: + /* "pyrfc/_cyrfc.pyx":1963 + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) + * _server_log("Server", f"launched {self._server_connection.handle}") # <<<<<<<<<<<<<< + * + * return rc */ - __pyx_v_funcDesc = RfcGetFunctionDesc(__pyx_v_self->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_server_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_server_connection), __pyx_n_s_handle); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_launched, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_s_Server, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_s_Server, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_INCREF(__pyx_n_s_Server); + __Pyx_GIVEREF(__pyx_n_s_Server); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_n_s_Server); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":754 - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) # <<<<<<<<<<<<<< - * if not funcDesc: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1965 + * _server_log("Server", f"launched {self._server_connection.handle}") + * + * return rc # <<<<<<<<<<<<<< + * + * def start(self): */ - free(__pyx_v_funcName); + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1965, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/client.pyx":755 - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":1947 + * _server_log("Server function installed", server_functions[func_name]) + * + * def serve(self): # <<<<<<<<<<<<<< + * """ + * Starts the RFC server, waiting for incoming requests and processes them. */ - __pyx_t_3 = ((!(__pyx_v_funcDesc != 0)) != 0); - if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":756 - * free(funcName) - * if not funcDesc: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 756, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.serve", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":755 - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - * free(funcName) - * if not funcDesc: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) +/* "pyrfc/_cyrfc.pyx":1967 + * return rc + * + * def start(self): # <<<<<<<<<<<<<< + * """ + * Start the RFC server in new thread, waiting for incoming requests and processes them. */ - } - - /* "src/pyrfc/client.pyx":757 - * if not funcDesc: - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) # <<<<<<<<<<<<<< - * if not funcCont: - * self._error(&errorInfo) - */ - __pyx_v_funcCont = RfcCreateFunction(__pyx_v_funcDesc, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":758 - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * try: - */ - __pyx_t_3 = ((!(__pyx_v_funcCont != 0)) != 0); - if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":759 - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * try: - * for name, value in params.iteritems(): - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 759, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "src/pyrfc/client.pyx":758 - * self._error(&errorInfo) - * funcCont = RfcCreateFunction(funcDesc, &errorInfo) - * if not funcCont: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * try: - */ - } - - /* "src/pyrfc/client.pyx":760 - * if not funcCont: - * self._error(&errorInfo) - * try: # <<<<<<<<<<<<<< - * for name, value in params.iteritems(): - * fillFunctionParameter(funcDesc, funcCont, name, value) - */ - /*try:*/ { - - /* "src/pyrfc/client.pyx":761 - * self._error(&errorInfo) - * try: - * for name, value in params.iteritems(): # <<<<<<<<<<<<<< - * fillFunctionParameter(funcDesc, funcCont, name, value) - * # Add RFC call to unit - */ - __pyx_t_9 = 0; - if (unlikely(__pyx_v_params == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); - __PYX_ERR(2, 761, __pyx_L42_error) - } - __pyx_t_15 = __Pyx_dict_iterator(__pyx_v_params, 0, __pyx_n_s_iteritems, (&__pyx_t_18), (&__pyx_t_19)); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 761, __pyx_L42_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_5); - __pyx_t_5 = __pyx_t_15; - __pyx_t_15 = 0; - while (1) { - __pyx_t_20 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_18, &__pyx_t_9, &__pyx_t_15, &__pyx_t_8, NULL, __pyx_t_19); - if (unlikely(__pyx_t_20 == 0)) break; - if (unlikely(__pyx_t_20 == -1)) __PYX_ERR(2, 761, __pyx_L42_error) - __Pyx_GOTREF(__pyx_t_15); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_15); - __pyx_t_15 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "src/pyrfc/client.pyx":762 - * try: - * for name, value in params.iteritems(): - * fillFunctionParameter(funcDesc, funcCont, name, value) # <<<<<<<<<<<<<< - * # Add RFC call to unit - * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) - */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcCont, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 762, __pyx_L42_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "src/pyrfc/client.pyx":764 - * fillFunctionParameter(funcDesc, funcCont, name, value) - * # Add RFC call to unit - * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_rc = RfcInvokeInUnit(__pyx_v_self->_uHandle, __pyx_v_funcCont, (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":765 - * # Add RFC call to unit - * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * finally: - */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":766 - * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * finally: - * RfcDestroyFunction(funcCont, NULL) - */ - __pyx_t_5 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 766, __pyx_L42_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_11start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_10start[] = "\n Start the RFC server in new thread, waiting for incoming requests and processes them.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_11start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("start (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_10start(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - /* "src/pyrfc/client.pyx":765 - * # Add RFC call to unit - * rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * finally: - */ - } - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":768 - * self._error(&errorInfo) - * finally: - * RfcDestroyFunction(funcCont, NULL) # <<<<<<<<<<<<<< - * # execute - * print (" Invocation finished. submitting unit.") - */ - /*finally:*/ { - /*normal exit:*/{ - (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); - goto __pyx_L43; - } - __pyx_L42_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_25, &__pyx_t_26, &__pyx_t_27); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_26); - __Pyx_XGOTREF(__pyx_t_27); - __pyx_t_19 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename; - { - (void)(RfcDestroyFunction(__pyx_v_funcCont, NULL)); - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_XGIVEREF(__pyx_t_27); - __Pyx_ExceptionReset(__pyx_t_25, __pyx_t_26, __pyx_t_27); - } - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ErrRestore(__pyx_t_22, __pyx_t_23, __pyx_t_24); - __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; __pyx_t_27 = 0; - __pyx_lineno = __pyx_t_19; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21; - goto __pyx_L27_error; - } - __pyx_L43:; - } +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_10start(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("start", 0); - /* "src/pyrfc/client.pyx":751 + /* "pyrfc/_cyrfc.pyx":1971 + * Start the RFC server in new thread, waiting for incoming requests and processes them. + * """ + * self._server_thread.start() # <<<<<<<<<<<<<< * - * try: - * for func_name, params in calls: # <<<<<<<<<<<<<< - * funcName = fillString(func_name) - * funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":770 - * RfcDestroyFunction(funcCont, NULL) - * # execute - * print (" Invocation finished. submitting unit.") # <<<<<<<<<<<<<< - * with nogil: - * rc = RfcSubmitUnit(self._uHandle, &errorInfo) - */ - if (__Pyx_PrintOne(0, __pyx_kp_s_Invocation_finished_submitting) < 0) __PYX_ERR(2, 770, __pyx_L27_error) - - /* "src/pyrfc/client.pyx":771 - * # execute - * print (" Invocation finished. submitting unit.") - * with nogil: # <<<<<<<<<<<<<< - * rc = RfcSubmitUnit(self._uHandle, &errorInfo) - * if rc != RFC_OK: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { - - /* "src/pyrfc/client.pyx":772 - * print (" Invocation finished. submitting unit.") - * with nogil: - * rc = RfcSubmitUnit(self._uHandle, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_rc = RfcSubmitUnit(__pyx_v_self->_uHandle, (&__pyx_v_errorInfo)); - } - - /* "src/pyrfc/client.pyx":771 - * # execute - * print (" Invocation finished. submitting unit.") - * with nogil: # <<<<<<<<<<<<<< - * rc = RfcSubmitUnit(self._uHandle, &errorInfo) - * if rc != RFC_OK: + * def stop(self): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L53; - } - __pyx_L53:; - } - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_server_thread, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1971, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":773 - * with nogil: - * rc = RfcSubmitUnit(self._uHandle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1967 + * return rc * + * def start(self): # <<<<<<<<<<<<<< + * """ + * Start the RFC server in new thread, waiting for incoming requests and processes them. */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_3) { - /* "src/pyrfc/client.pyx":774 - * rc = RfcSubmitUnit(self._uHandle, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * - * except RFCError as e: - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 774, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.start", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":773 - * with nogil: - * rc = RfcSubmitUnit(self._uHandle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":1973 + * self._server_thread.start() * + * def stop(self): # <<<<<<<<<<<<<< + * """ + * Stop the RFC server thread. */ - } - /* "src/pyrfc/client.pyx":750 - * self.active_unit = True - * - * try: # <<<<<<<<<<<<<< - * for func_name, params in calls: - * funcName = fillString(func_name) - */ - } - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - goto __pyx_L32_try_end; - __pyx_L27_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_13stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_12stop[] = "\n Stop the RFC server thread.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_13stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stop (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_12stop(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - /* "src/pyrfc/client.pyx":776 - * self._error(&errorInfo) - * - * except RFCError as e: # <<<<<<<<<<<<<< - * # clean up actions - * RfcDestroyUnit(self._uHandle, NULL) - */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_8); - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 776, __pyx_L29_except_error) - __Pyx_GOTREF(__pyx_t_15); - __pyx_t_20 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_15); - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_8); - __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_8 = 0; - if (__pyx_t_20) { - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 776, __pyx_L29_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __pyx_v_e = __pyx_t_5; - /*try:*/ { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":778 - * except RFCError as e: - * # clean up actions - * RfcDestroyUnit(self._uHandle, NULL) # <<<<<<<<<<<<<< - * raise - * - */ - (void)(RfcDestroyUnit(__pyx_v_self->_uHandle, NULL)); +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_12stop(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop", 0); - /* "src/pyrfc/client.pyx":779 - * # clean up actions - * RfcDestroyUnit(self._uHandle, NULL) - * raise # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":1977 + * Stop the RFC server thread. + * """ + * if self._server_thread.is_alive(): # <<<<<<<<<<<<<< + * self._server_thread.join() * - * unit_identifier = wrapUnitIdentifier(uIdentifier) */ - __Pyx_GIVEREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_ErrRestoreWithState(__pyx_t_8, __pyx_t_5, __pyx_t_1); - __pyx_t_8 = 0; __pyx_t_5 = 0; __pyx_t_1 = 0; - __PYX_ERR(2, 779, __pyx_L60_error) - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_server_thread, __pyx_n_s_is_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1977, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { - /* "src/pyrfc/client.pyx":776 - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":1978 + * """ + * if self._server_thread.is_alive(): + * self._server_thread.join() # <<<<<<<<<<<<<< * - * except RFCError as e: # <<<<<<<<<<<<<< - * # clean up actions - * RfcDestroyUnit(self._uHandle, NULL) + * def close(self): */ - /*finally:*/ { - __pyx_L60_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_27 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_23, &__pyx_t_22); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_27, &__pyx_t_26, &__pyx_t_25) < 0)) __Pyx_ErrFetch(&__pyx_t_27, &__pyx_t_26, &__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_27); - __Pyx_XGOTREF(__pyx_t_26); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_22); - __pyx_t_20 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_28 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_23, __pyx_t_22); - } - __Pyx_XGIVEREF(__pyx_t_27); - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_ErrRestore(__pyx_t_27, __pyx_t_26, __pyx_t_25); - __pyx_t_27 = 0; __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; - __pyx_lineno = __pyx_t_20; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_28; - goto __pyx_L29_except_error; - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_server_thread, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - goto __pyx_L29_except_error; - __pyx_L29_except_error:; + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":750 - * self.active_unit = True + /* "pyrfc/_cyrfc.pyx":1977 + * Stop the RFC server thread. + * """ + * if self._server_thread.is_alive(): # <<<<<<<<<<<<<< + * self._server_thread.join() * - * try: # <<<<<<<<<<<<<< - * for func_name, params in calls: - * funcName = fillString(func_name) */ - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_XGIVEREF(__pyx_t_14); - __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); - goto __pyx_L1_error; - __pyx_L32_try_end:; } - /* "src/pyrfc/client.pyx":781 - * raise - * - * unit_identifier = wrapUnitIdentifier(uIdentifier) # <<<<<<<<<<<<<< - * return unit_identifier["queued"] - * - */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier(__pyx_v_uIdentifier); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_unit_identifier = __pyx_t_1; - __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":782 - * - * unit_identifier = wrapUnitIdentifier(uIdentifier) - * return unit_identifier["queued"] # <<<<<<<<<<<<<< - * - * def _get_unit_state(self, unit): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit_identifier, __pyx_n_s_queued); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 782, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "src/pyrfc/client.pyx":646 - * return wrapString(uid, RFC_UNITID_LN) + /* "pyrfc/_cyrfc.pyx":1973 + * self._server_thread.start() * - * def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< - * # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) - * cdef RFC_RC rc + * def stop(self): # <<<<<<<<<<<<<< + * """ + * Stop the RFC server thread. */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._create_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_i); - __Pyx_XDECREF(__pyx_v_queue_name); - __Pyx_XDECREF(__pyx_v_func_name); - __Pyx_XDECREF(__pyx_v_params); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XDECREF(__pyx_v_unit_identifier); - __Pyx_XDECREF(__pyx_v_queue_names); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":784 - * return unit_identifier["queued"] +/* "pyrfc/_cyrfc.pyx":1980 + * self._server_thread.join() * - * def _get_unit_state(self, unit): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * def close(self): # <<<<<<<<<<<<<< + * """ Explicitly close the registration. + * Note that this is usually not necessary as the registration will be closed */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_53_get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_53_get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_14close[] = " Explicitly close the registration.\n Note that this is usually not necessary as the registration will be closed\n automatically upon object destruction. However, if the the object destruction\n is delayed by the garbage collection, problems may occur when too many\n servers are registered.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_unit_state (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_52_get_unit_state(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); + __Pyx_RefNannySetupContext("close (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_14close(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_52_get_unit_state(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; - RFC_UNIT_STATE __pyx_v_state; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_14close(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - RFC_UNIT_IDENTIFIER __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - Py_UCS4 __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_get_unit_state", 0); + __Pyx_RefNannySetupContext("close", 0); - /* "src/pyrfc/client.pyx":787 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) # <<<<<<<<<<<<<< - * cdef RFC_UNIT_STATE state + /* "pyrfc/_cyrfc.pyx":1987 + * servers are registered. + * """ + * self.stop() # <<<<<<<<<<<<<< + * self._close() * */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(__pyx_v_unit); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 787, __pyx_L1_error) - __pyx_v_uIdentifier = __pyx_t_1; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1987, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1987, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":790 - * cdef RFC_UNIT_STATE state + /* "pyrfc/_cyrfc.pyx":1988 + * """ + * self.stop() + * self._close() # <<<<<<<<<<<<<< * - * if not self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: + * def get_server_attributes(self): */ - __pyx_t_2 = ((!(__pyx_v_self->active_unit != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1988, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1988, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":791 + /* "pyrfc/_cyrfc.pyx":1980 + * self._server_thread.join() * - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") # <<<<<<<<<<<<<< - * if not self.alive: - * self._open() + * def close(self): # <<<<<<<<<<<<<< + * """ Explicitly close the registration. + * Note that this is usually not necessary as the registration will be closed */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_No_unit_handle_for_this_connecti) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_No_unit_handle_for_this_connecti); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 791, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 791, __pyx_L1_error) - /* "src/pyrfc/client.pyx":790 - * cdef RFC_UNIT_STATE state + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.close", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":1990 + * self._close() + * + * def get_server_attributes(self): # <<<<<<<<<<<<<< + * """Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server. * - * if not self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: */ - } - /* "src/pyrfc/client.pyx":792 - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 792, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 792, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((!__pyx_t_2) != 0); - if (__pyx_t_6) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_17get_server_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_16get_server_attributes[] = "Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server.\n\n :returns: Dictionary with server state and attributes\n :rtype: dict(str, str or int)\n\n * serverName: This server's name as given when creating the server.\n * protocolType: This RFC server's type:\n RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER\n * registrationCount: The current number of active registrations (in case of a Registered Server)\n or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server)\n * state: Used in state information in order to indicate the current state of an RFC Server.\n * currentBusyCount: The number of requests currently being processed.\n * peakBusyCount: The maximum number of requests the server has been processing in parallel since it has been created\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_17get_server_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_server_attributes (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_16get_server_attributes(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - /* "src/pyrfc/client.pyx":793 - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) - * if rc != RFC_OK: - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 793, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":792 - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) - */ - } +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_16get_server_attributes(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + RFC_RC __pyx_v_rc; + RFC_SERVER_ATTRIBUTES __pyx_v_attributes; + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_v_rfcServerState = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_server_attributes", 0); - /* "src/pyrfc/client.pyx":794 - * if not self.alive: - * self._open() - * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2009 + * cdef RFC_ERROR_INFO errorInfo + * + * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_v_rc = RfcGetUnitState(__pyx_v_self->_handle, (&__pyx_v_uIdentifier), (&__pyx_v_state), (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetServerAttributes(__pyx_v_self->_server_connection->_handle, (&__pyx_v_attributes), (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":795 - * self._open() - * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * if state not in enum_values(UnitState): + /* "pyrfc/_cyrfc.pyx":2010 + * + * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) */ - __pyx_t_6 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_6) { + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (!__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/client.pyx":796 - * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * if state not in enum_values(UnitState): - * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") + /* "pyrfc/_cyrfc.pyx":2011 + * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) + * return { */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 796, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2011, __pyx_L1_error) - /* "src/pyrfc/client.pyx":795 - * self._open() - * rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * if state not in enum_values(UnitState): + /* "pyrfc/_cyrfc.pyx":2010 + * + * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) + * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) */ } - /* "src/pyrfc/client.pyx":797 - * if rc != RFC_OK: - * self._error(&errorInfo) - * if state not in enum_values(UnitState): # <<<<<<<<<<<<<< - * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") - * return UnitState(state).name + /* "pyrfc/_cyrfc.pyx":2012 + * if rc != RFC_OK or errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) + * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) # <<<<<<<<<<<<<< + * return { + * # This server's name as given when creating the server. + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_neg_1; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(RfcGetServerStateAsString(__pyx_v_attributes.state), &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2012, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_rfcServerState = __pyx_t_3; + __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":2013 + * raise wrapError(&errorInfo) + * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) + * return { # <<<<<<<<<<<<<< + * # This server's name as given when creating the server. + * 'serverName': wrapString(attributes.serverName, -1, True) + */ + __Pyx_XDECREF(__pyx_r); + + /* "pyrfc/_cyrfc.pyx":2015 + * return { + * # This server's name as given when creating the server. + * 'serverName': wrapString(attributes.serverName, -1, True) # <<<<<<<<<<<<<< + * # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER + * , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER */ - __pyx_t_3 = __Pyx_PyInt_From_RFC_UNIT_STATE(__pyx_v_state); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 797, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2015, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_enum_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 797, __pyx_L1_error) + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_neg_1; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.serverName, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2015, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 797, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 797, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_serverName, __pyx_t_5) < 0) __PYX_ERR(0, 2015, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 797, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = (__pyx_t_6 != 0); - if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/client.pyx":798 - * self._error(&errorInfo) - * if state not in enum_values(UnitState): - * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") # <<<<<<<<<<<<<< - * return UnitState(state).name - * + /* "pyrfc/_cyrfc.pyx":2017 + * 'serverName': wrapString(attributes.serverName, -1, True) + * # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER + * , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER # <<<<<<<<<<<<<< + * else socket.gethostname() # Own host name + * # The current number of active registrations (in case of a Registered Server) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = 0; - __pyx_t_10 = 127; - __Pyx_INCREF(__pyx_kp_u_Unit); - __pyx_t_9 += 5; - __Pyx_GIVEREF(__pyx_kp_u_Unit); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Unit); - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 798, __pyx_L1_error) + if (((__pyx_v_attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER) != 0)) { + __Pyx_INCREF(__pyx_kp_s_multi_count); + __pyx_t_5 = __pyx_kp_s_multi_count; + } else { + + /* "pyrfc/_cyrfc.pyx":2018 + * # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER + * , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER + * else socket.gethostname() # Own host name # <<<<<<<<<<<<<< + * # The current number of active registrations (in case of a Registered Server) + * # or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_socket); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2018, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 798, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_gethostname); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2018, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_10; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_kp_u_has_invalid_state); - __pyx_t_9 += 20; - __Pyx_GIVEREF(__pyx_kp_u_has_invalid_state); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_has_invalid_state); - __pyx_t_8 = __Pyx_PyUnicode_From_RFC_UNIT_STATE(__pyx_v_state, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_10; - __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_9 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__6); - __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_8, function); } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 798, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 798, __pyx_L1_error) + __pyx_t_5 = __pyx_t_6; + __pyx_t_6 = 0; + } + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_protocolType, __pyx_t_5) < 0) __PYX_ERR(0, 2015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/pyrfc/client.pyx":797 - * if rc != RFC_OK: - * self._error(&errorInfo) - * if state not in enum_values(UnitState): # <<<<<<<<<<<<<< - * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") - * return UnitState(state).name + /* "pyrfc/_cyrfc.pyx":2021 + * # The current number of active registrations (in case of a Registered Server) + * # or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) + * , 'registrationCount': attributes.registrationCount # <<<<<<<<<<<<<< + * # Used in state information in order to indicate the current state of an RFC Server. + * , 'state': rfcServerState */ - } + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_attributes.registrationCount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_registrationCount, __pyx_t_5) < 0) __PYX_ERR(0, 2015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "src/pyrfc/client.pyx":799 - * if state not in enum_values(UnitState): - * raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") - * return UnitState(state).name # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2023 + * , 'registrationCount': attributes.registrationCount + * # Used in state information in order to indicate the current state of an RFC Server. + * , 'state': rfcServerState # <<<<<<<<<<<<<< + * # The number of requests currently being processed. + * , 'currentBusyCount': attributes.currentBusyCount + */ + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_state, __pyx_v_rfcServerState) < 0) __PYX_ERR(0, 2015, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2025 + * , 'state': rfcServerState + * # The number of requests currently being processed. + * , 'currentBusyCount': attributes.currentBusyCount # <<<<<<<<<<<<<< + * # The maximum number of requests the server has been processing in parallel since it has been created + * , 'peakBusyCount': attributes.peakBusyCount + */ + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_attributes.currentBusyCount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2025, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_currentBusyCount, __pyx_t_5) < 0) __PYX_ERR(0, 2015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "pyrfc/_cyrfc.pyx":2027 + * , 'currentBusyCount': attributes.currentBusyCount + * # The maximum number of requests the server has been processing in parallel since it has been created + * , 'peakBusyCount': attributes.peakBusyCount # <<<<<<<<<<<<<< + * } * - * def _destroy_unit(self): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyInt_From_RFC_UNIT_STATE(__pyx_v_state); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_attributes.peakBusyCount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2027, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_peakBusyCount, __pyx_t_5) < 0) __PYX_ERR(0, 2015, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "src/pyrfc/client.pyx":784 - * return unit_identifier["queued"] + /* "pyrfc/_cyrfc.pyx":1990 + * self._close() + * + * def get_server_attributes(self): # <<<<<<<<<<<<<< + * """Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server. * - * def _get_unit_state(self, unit): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._get_unit_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.get_server_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_rfcServerState); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":801 - * return UnitState(state).name +/* "pyrfc/_cyrfc.pyx":2030 + * } * - * def _destroy_unit(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * def _close(self): # <<<<<<<<<<<<<< + * """ Close the connection (private function) + * :raises: :exc:`~pyrfc.RFCError` or a subclass */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_55_destroy_unit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_55_destroy_unit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_19_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_6Server_18_close[] = " Close the connection (private function)\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be closed cleanly.\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_19_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_destroy_unit (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_54_destroy_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("_close (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_18_close(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_54_destroy_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_18_close(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + PyObject *__pyx_v_after_remove = NULL; + PyObject *__pyx_v_func_name = NULL; + PyObject *__pyx_v_func_data = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *(*__pyx_t_9)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_destroy_unit", 0); + __Pyx_RefNannySetupContext("_close", 0); - /* "src/pyrfc/client.pyx":804 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: + /* "pyrfc/_cyrfc.pyx":2036 + * """ + * # Shutdown server + * if self._server_connection: # <<<<<<<<<<<<<< + * self._server_connection.close() + * # Remove all installed server functions */ - __pyx_t_1 = ((!(__pyx_v_self->active_unit != 0)) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_server_connection)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2036, __pyx_L1_error) + if (__pyx_t_1) { - /* "src/pyrfc/client.pyx":805 - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") # <<<<<<<<<<<<<< - * if not self.alive: - * self._open() + /* "pyrfc/_cyrfc.pyx":2037 + * # Shutdown server + * if self._server_connection: + * self._server_connection.close() # <<<<<<<<<<<<<< + * # Remove all installed server functions + * after_remove = {} */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 805, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_server_connection), __pyx_n_s_close_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2037, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); @@ -26773,112 +26081,210 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_54_destroy_unit(struct __p __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_unit_handle_for_this_connecti) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_unit_handle_for_this_connecti); + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 805, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2037, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 805, __pyx_L1_error) - /* "src/pyrfc/client.pyx":804 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * if not self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: + /* "pyrfc/_cyrfc.pyx":2036 + * """ + * # Shutdown server + * if self._server_connection: # <<<<<<<<<<<<<< + * self._server_connection.close() + * # Remove all installed server functions */ } - /* "src/pyrfc/client.pyx":806 - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":2039 + * self._server_connection.close() + * # Remove all installed server functions + * after_remove = {} # <<<<<<<<<<<<<< + * global server_functions + * for func_name, func_data in server_functions.items(): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 806, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2039, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 806, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((!__pyx_t_1) != 0); - if (__pyx_t_5) { + __pyx_v_after_remove = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "src/pyrfc/client.pyx":807 - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 807, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/client.pyx":806 - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":2041 + * after_remove = {} + * global server_functions + * for func_name, func_data in server_functions.items(): # <<<<<<<<<<<<<< + * if func_data["server"] != self: + * after_remove[func_name] = func_data */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2041, __pyx_L1_error) } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2041, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2041, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 2041, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { + PyObject* sequence = __pyx_t_2; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 2041, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_3 = PyList_GET_ITEM(sequence, 0); + __pyx_t_7 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 2041, __pyx_L1_error) + __pyx_t_9 = NULL; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L7_unpacking_done; + __pyx_L6_unpacking_failed:; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 2041, __pyx_L1_error) + __pyx_L7_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_func_data, __pyx_t_7); + __pyx_t_7 = 0; - /* "src/pyrfc/client.pyx":808 - * if not self.alive: - * self._open() - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) # <<<<<<<<<<<<<< - * self.active_unit = False - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2042 + * global server_functions + * for func_name, func_data in server_functions.items(): + * if func_data["server"] != self: # <<<<<<<<<<<<<< + * after_remove[func_name] = func_data + * server_functions = after_remove */ - __pyx_v_rc = RfcDestroyUnit(__pyx_v_self->_uHandle, (&__pyx_v_errorInfo)); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_data, __pyx_n_s_server); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2042, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_v_self), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2042, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2042, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { - /* "src/pyrfc/client.pyx":809 - * self._open() - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2043 + * for func_name, func_data in server_functions.items(): + * if func_data["server"] != self: + * after_remove[func_name] = func_data # <<<<<<<<<<<<<< + * server_functions = after_remove + * */ - __pyx_v_self->active_unit = 0; + if (unlikely(PyDict_SetItem(__pyx_v_after_remove, __pyx_v_func_name, __pyx_v_func_data) < 0)) __PYX_ERR(0, 2043, __pyx_L1_error) - /* "src/pyrfc/client.pyx":810 - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2042 + * global server_functions + * for func_name, func_data in server_functions.items(): + * if func_data["server"] != self: # <<<<<<<<<<<<<< + * after_remove[func_name] = func_data + * server_functions = after_remove */ - __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_5) { + } - /* "src/pyrfc/client.pyx":811 - * self.active_unit = False - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * - * def _confirm_unit(self, unit): + /* "pyrfc/_cyrfc.pyx":2041 + * after_remove = {} + * global server_functions + * for func_name, func_data in server_functions.items(): # <<<<<<<<<<<<<< + * if func_data["server"] != self: + * after_remove[func_name] = func_data */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 811, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/client.pyx":810 - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2044 + * if func_data["server"] != self: + * after_remove[func_name] = func_data + * server_functions = after_remove # <<<<<<<<<<<<<< * + * cdef _error(self, RFC_ERROR_INFO* errorInfo): */ - } + if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_functions, __pyx_v_after_remove) < 0) __PYX_ERR(0, 2044, __pyx_L1_error) - /* "src/pyrfc/client.pyx":801 - * return UnitState(state).name + /* "pyrfc/_cyrfc.pyx":2030 + * } * - * def _destroy_unit(self): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * def _close(self): # <<<<<<<<<<<<<< + * """ Close the connection (private function) + * :raises: :exc:`~pyrfc.RFCError` or a subclass */ /* function exit code */ @@ -26888,246 +26294,107 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_54_destroy_unit(struct __p __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._destroy_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pyrfc._cyrfc.Server._close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_after_remove); + __Pyx_XDECREF(__pyx_v_func_name); + __Pyx_XDECREF(__pyx_v_func_data); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":813 - * self._error(&errorInfo) +/* "pyrfc/_cyrfc.pyx":2046 + * server_functions = after_remove * - * def _confirm_unit(self, unit): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * """ + * Error treatment of a connection. */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_57_confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_57_confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_confirm_unit (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_56_confirm_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_56_confirm_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_6Server__error(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, RFC_ERROR_INFO *__pyx_v_errorInfo) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - RFC_UNIT_IDENTIFIER __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_confirm_unit", 0); + __Pyx_RefNannySetupContext("_error", 0); - /* "src/pyrfc/client.pyx":816 - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2061 + * # self.alive = False * - * if not self.active_unit: - */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(__pyx_v_unit); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 816, __pyx_L1_error) - __pyx_v_uIdentifier = __pyx_t_1; - - /* "src/pyrfc/client.pyx":818 - * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) + * raise wrapError(errorInfo) # <<<<<<<<<<<<<< * - * if not self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: - */ - __pyx_t_2 = ((!(__pyx_v_self->active_unit != 0)) != 0); - if (unlikely(__pyx_t_2)) { - - /* "src/pyrfc/client.pyx":819 * - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") # <<<<<<<<<<<<<< - * if not self.alive: - * self._open() */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 819, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_No_unit_handle_for_this_connecti) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_No_unit_handle_for_this_connecti); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 819, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 819, __pyx_L1_error) + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError(__pyx_v_errorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2061, __pyx_L1_error) - /* "src/pyrfc/client.pyx":818 - * cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) + /* "pyrfc/_cyrfc.pyx":2046 + * server_functions = after_remove * - * if not self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: - */ - } - - /* "src/pyrfc/client.pyx":820 - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 820, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 820, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = ((!__pyx_t_2) != 0); - if (__pyx_t_6) { - - /* "src/pyrfc/client.pyx":821 - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: - * self._open() # <<<<<<<<<<<<<< - * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) - * if rc != RFC_OK: - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 821, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":820 - * if not self.active_unit: - * raise RFCError("No unit handle for this connection available.") - * if not self.alive: # <<<<<<<<<<<<<< - * self._open() - * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) - */ - } - - /* "src/pyrfc/client.pyx":822 - * if not self.alive: - * self._open() - * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_rc = RfcConfirmUnit(__pyx_v_self->_handle, (&__pyx_v_uIdentifier), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/client.pyx":823 - * self._open() - * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - */ - __pyx_t_6 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_6) { - - /* "src/pyrfc/client.pyx":824 - * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 824, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":823 - * self._open() - * rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - */ - } - - /* "src/pyrfc/client.pyx":825 - * if rc != RFC_OK: - * self._error(&errorInfo) - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) # <<<<<<<<<<<<<< - * self.active_unit = False - * if rc != RFC_OK: + * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * """ + * Error treatment of a connection. */ - __pyx_v_rc = RfcDestroyUnit(__pyx_v_self->_uHandle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":826 - * self._error(&errorInfo) - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * self._error(&errorInfo) - */ - __pyx_v_self->active_unit = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Server._error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":827 - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * +/* "pyrfc/_cyrfc.pyx":1755 + * thereof if the connection attempt fails. + * """ + * cdef public bint debug # <<<<<<<<<<<<<< + * cdef public bint rstrip + * cdef Connection _client_connection */ - __pyx_t_6 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_6) { - /* "src/pyrfc/client.pyx":828 - * self.active_unit = False - * if rc != RFC_OK: - * self._error(&errorInfo) # <<<<<<<<<<<<<< - * - * ########################################################################## - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Connection *)__pyx_v_self->__pyx_vtab)->_error(__pyx_v_self, (&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 828, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_5debug___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - /* "src/pyrfc/client.pyx":827 - * rc = RfcDestroyUnit(self._uHandle, &errorInfo) - * self.active_unit = False - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * self._error(&errorInfo) - * - */ - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":813 - * self._error(&errorInfo) - * - * def _confirm_unit(self, unit): # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo - */ +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_5debug___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1755, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection._confirm_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.debug.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -27135,2162 +26402,1448 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_56_confirm_unit(struct __p return __pyx_r; } -/* "src/pyrfc/client.pyx":838 - * # * queued - boolean, set on fill_and_submit_unit() call - * - * def initialize_unit(self, background=True): # <<<<<<<<<<<<<< - * """ Initializes a logical unit of work (LUW), shorthand: unit - * - */ - /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_59initialize_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_58initialize_unit[] = " Initializes a logical unit of work (LUW), shorthand: unit\n\n .. warning::\n\n The background protocol (bgRFC) is not working in the current version.\n Please use only tRFC/qRFC protocols.\n\n :param background: The bgRFC protocol will be used. If set to False,\n the t/qRFC protocol will be used. Note that the bgRFC protocol\n has extended functionality. Default: True\n :type background: boolean\n\n :returns: A dictionary describing the unit.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_59initialize_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_background = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; +static int __pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("initialize_unit (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_background,0}; - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_True); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_background); - if (value) { values[0] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "initialize_unit") < 0)) __PYX_ERR(2, 838, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_background = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("initialize_unit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 838, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.initialize_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_58initialize_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_background); + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_5debug_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_58initialize_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_background) { - PyObject *__pyx_v_id = NULL; - PyObject *__pyx_r = NULL; +static int __pyx_pf_5pyrfc_6_cyrfc_6Server_5debug_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("initialize_unit", 0); - - /* "src/pyrfc/client.pyx":853 - * :returns: A dictionary describing the unit. - * """ - * if background is True: # use bgRFC # <<<<<<<<<<<<<< - * id = self._get_unit_id() - * elif background is False: # classic t/qRFC - */ - __pyx_t_1 = (__pyx_v_background == Py_True); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1755, __pyx_L1_error) + __pyx_v_self->debug = __pyx_t_1; - /* "src/pyrfc/client.pyx":854 - * """ - * if background is True: # use bgRFC - * id = self._get_unit_id() # <<<<<<<<<<<<<< - * elif background is False: # classic t/qRFC - * id = self._get_transaction_id() - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_unit_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 854, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_id = __pyx_t_3; - __pyx_t_3 = 0; - - /* "src/pyrfc/client.pyx":853 - * :returns: A dictionary describing the unit. - * """ - * if background is True: # use bgRFC # <<<<<<<<<<<<<< - * id = self._get_unit_id() - * elif background is False: # classic t/qRFC - */ - goto __pyx_L3; - } - - /* "src/pyrfc/client.pyx":855 - * if background is True: # use bgRFC - * id = self._get_unit_id() - * elif background is False: # classic t/qRFC # <<<<<<<<<<<<<< - * id = self._get_transaction_id() - * else: - */ - __pyx_t_2 = (__pyx_v_background == Py_False); - __pyx_t_1 = (__pyx_t_2 != 0); - if (likely(__pyx_t_1)) { + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Server.debug.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":856 - * id = self._get_unit_id() - * elif background is False: # classic t/qRFC - * id = self._get_transaction_id() # <<<<<<<<<<<<<< - * else: - * raise RFCError("Argument 'background' must be a boolean value.") +/* "pyrfc/_cyrfc.pyx":1756 + * """ + * cdef public bint debug + * cdef public bint rstrip # <<<<<<<<<<<<<< + * cdef Connection _client_connection + * cdef ServerConnection _server_connection */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_transaction_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_id = __pyx_t_3; - __pyx_t_3 = 0; - /* "src/pyrfc/client.pyx":855 - * if background is True: # use bgRFC - * id = self._get_unit_id() - * elif background is False: # classic t/qRFC # <<<<<<<<<<<<<< - * id = self._get_transaction_id() - * else: - */ - goto __pyx_L3; - } +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - /* "src/pyrfc/client.pyx":858 - * id = self._get_transaction_id() - * else: - * raise RFCError("Argument 'background' must be a boolean value.") # <<<<<<<<<<<<<< - * return {'background': background, 'id': id, "queued": False} - * - */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_background_must_be_a_bo) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_background_must_be_a_bo); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 858, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 858, __pyx_L1_error) - } - __pyx_L3:; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/client.pyx":859 - * else: - * raise RFCError("Argument 'background' must be a boolean value.") - * return {'background': background, 'id': id, "queued": False} # <<<<<<<<<<<<<< - * - * def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): - */ +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 859, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_background, __pyx_v_background) < 0) __PYX_ERR(2, 859, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_id, __pyx_v_id) < 0) __PYX_ERR(2, 859, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_queued, Py_False) < 0) __PYX_ERR(2, 859, __pyx_L1_error) - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1756, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "src/pyrfc/client.pyx":838 - * # * queued - boolean, set on fill_and_submit_unit() call - * - * def initialize_unit(self, background=True): # <<<<<<<<<<<<<< - * """ Initializes a logical unit of work (LUW), shorthand: unit - * - */ - /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.initialize_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.rstrip.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_id); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":861 - * return {'background': background, 'id': id, "queued": False} - * - * def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< - * """ Fills a unit with one or more RFC and submits it to the backend. - * +/* Python wrapper */ +static int __pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__set__", 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1756, __pyx_L1_error) + __pyx_v_self->rstrip = __pyx_t_1; + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Server.rstrip.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_61fill_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_60fill_and_submit_unit[] = " Fills a unit with one or more RFC and submits it to the backend.\n\n Fills a unit for this connection, prepare the invocation\n of multiple RFC function modules in it, and submits the unit\n to the backend.\n\n Afterwards, the unit is still attached to the connection object,\n until confirm_unit() or destroy_unit() is called. Until one of these\n methods are called, no other unit could be filled and submitted.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :param calls: a list of call descriptions. Each call description is a\n tuple that contains the function name as the first element and\n the function arguments in form of a dictionary as the second element.\n :param queue_names:\n If the unit uses the background protocol, various queue names can\n be given (leading to a asynchronous unit, type 'Q'). If parameter\n is an empty list or None, a synchronous unit (type 'T') is created.\n\n If the unit does not use the background protocol, the queue name\n may be a list with exactly one element, leading to a qRFC, or\n an empty list or None, leading to a tRFC.\n :type queue_names: list of strings or None (default)\n :param attributes: optional argument for attributes of the unit -- only valid if the background protocol\n is used. The attributes dict may contain the following keywords:\n\n =============== ============================= ======================= ==========================================================================================\n keyword default type description\n =============== ============================= ======================= =======================================================================""===================\n kernel_trace 0 int If != 0, the backend will write kernel traces, while executing this unit.\n sat_trace 0 int If != 0, the backend will write statistic records, while executing this unit.\n unit_history 0 int If != 0, the backend will keep a \"history\" for this unit.\n lock 0 int Used only for type Q: If != 0, the unit will be written to the queue, but not processed.\n The unit can then be started manually in the ABAP debugger.\n no_commit_check 0 int Per default the backend will check during execution of a unit, whether one of the\n unit's function modules triggers an explicit or implicit COMMITWORK.\n In this case the unit is aborted with an error, because the transactional integrity of\n this unit cannot be guaranteed. By setting \"no_commit_check\" to true (!=0), this behavior\n can be suppressed, meaning the unit will be executed anyway, even if one of it's\n function modules \"misbehaves\" and triggers a COMMIT WORK.\n user current operating system user String, len |nbsp| 12 Sender User (optional).\n client \"000\" String, len |nbsp| 3 Sender Client (""\"Mandant\") (optional).\n t_code \"\" String, len |nbsp| 20 Sender Transaction Code (optional).\n program current executable name String, len |nbsp| 40 Sender Program (optional).\n =============== ============================= ======================= ==========================================================================================\n\n :type attributes: dict or None (default)\n :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if an error\n occurred. In this case, the unit is destroyed.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_61fill_and_submit_unit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_unit = 0; - PyObject *__pyx_v_calls = 0; - PyObject *__pyx_v_queue_names = 0; - PyObject *__pyx_v_attributes = 0; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_20__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fill_and_submit_unit (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_unit,&__pyx_n_s_calls,&__pyx_n_s_queue_names,&__pyx_n_s_attributes,0}; - PyObject* values[4] = {0,0,0,0}; - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 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_unit)) != 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_calls)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("fill_and_submit_unit", 0, 2, 4, 1); __PYX_ERR(2, 861, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_queue_names); - if (value) { values[2] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attributes); - if (value) { values[3] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fill_and_submit_unit") < 0)) __PYX_ERR(2, 861, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_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); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_unit = values[0]; - __pyx_v_calls = values[1]; - __pyx_v_queue_names = values[2]; - __pyx_v_attributes = values[3]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fill_and_submit_unit", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 861, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.fill_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_60fill_and_submit_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), __pyx_v_unit, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes); + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_22__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_60fill_and_submit_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit, PyObject *__pyx_v_calls, PyObject *__pyx_v_queue_names, PyObject *__pyx_v_attributes) { - PyObject *__pyx_v_func_name = NULL; - PyObject *__pyx_v_params = NULL; - PyObject *__pyx_v_bg = NULL; - PyObject *__pyx_v_unit_id = NULL; - PyObject *__pyx_v_queue_name = NULL; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *(*__pyx_t_11)(PyObject *); - Py_UCS4 __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_t_14; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fill_and_submit_unit", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "src/pyrfc/client.pyx":914 - * """ - * - * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") - * if not isinstance(calls, Iterable): + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_unit)) != ((PyObject *)(&PyDict_Type))); - __pyx_t_3 = (__pyx_t_2 != 0); - if (!__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_id, __pyx_v_unit, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 914, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_3 != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_background, __pyx_v_unit, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 914, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_2 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/pyrfc/client.pyx":915 - * - * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: - * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") # <<<<<<<<<<<<<< - * if not isinstance(calls, Iterable): - * raise TypeError("Parameter 'calls' must be iterable.") + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 915, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 915, __pyx_L1_error) - /* "src/pyrfc/client.pyx":914 - * """ + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Server.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2064 * - * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") - * if not isinstance(calls, Iterable): + * + * cdef RFC_TYPE_DESC_HANDLE fillTypeDescription(type_desc): # <<<<<<<<<<<<<< + * """ + * :param type_desc: object of class TypeDescription */ - } - /* "src/pyrfc/client.pyx":916 - * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: - * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") - * if not isinstance(calls, Iterable): # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'calls' must be iterable.") - * if len(calls)==0: +static RFC_TYPE_DESC_HANDLE __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(PyObject *__pyx_v_type_desc) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc; + RFC_FIELD_DESC __pyx_v_fieldDesc; + SAP_UC *__pyx_v_sapuc; + PyObject *__pyx_v_field_desc = NULL; + RFC_TYPE_DESC_HANDLE __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + SAP_UC *__pyx_t_2; + int __pyx_t_3; + unsigned int __pyx_t_4; + unsigned int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + RFCTYPE __pyx_t_12; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillTypeDescription", 0); + + /* "pyrfc/_cyrfc.pyx":2069 + * :return: Handle of RFC_TYPE_DESC_HANDLE + * """ + * cdef RFC_RC rc = RFC_OK # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_TYPE_DESC_HANDLE typeDesc */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 916, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_IsInstance(__pyx_v_calls, __pyx_t_4); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 916, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((!(__pyx_t_1 != 0)) != 0); - if (unlikely(__pyx_t_3)) { + __pyx_v_rc = RFC_OK; - /* "src/pyrfc/client.pyx":917 - * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") - * if not isinstance(calls, Iterable): - * raise TypeError("Parameter 'calls' must be iterable.") # <<<<<<<<<<<<<< - * if len(calls)==0: - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + /* "pyrfc/_cyrfc.pyx":2076 + * + * # Set name, nuc_length, and uc_length + * sapuc = fillString(type_desc.name) # <<<<<<<<<<<<<< + * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) + * free(sapuc) */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 917, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2076, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2076, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_sapuc = __pyx_t_2; - /* "src/pyrfc/client.pyx":916 - * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: - * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") - * if not isinstance(calls, Iterable): # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'calls' must be iterable.") - * if len(calls)==0: + /* "pyrfc/_cyrfc.pyx":2077 + * # Set name, nuc_length, and uc_length + * sapuc = fillString(type_desc.name) + * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) # <<<<<<<<<<<<<< + * free(sapuc) + * if typeDesc == NULL: */ - } + __pyx_v_typeDesc = RfcCreateTypeDesc(__pyx_v_sapuc, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":918 - * if not isinstance(calls, Iterable): - * raise TypeError("Parameter 'calls' must be iterable.") - * if len(calls)==0: # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") - * for func_name, params in calls: + /* "pyrfc/_cyrfc.pyx":2078 + * sapuc = fillString(type_desc.name) + * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) + * free(sapuc) # <<<<<<<<<<<<<< + * if typeDesc == NULL: + * raise wrapError(&errorInfo) */ - __pyx_t_5 = PyObject_Length(__pyx_v_calls); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 918, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_5 == 0) != 0); - if (unlikely(__pyx_t_3)) { + free(__pyx_v_sapuc); - /* "src/pyrfc/client.pyx":919 - * raise TypeError("Parameter 'calls' must be iterable.") - * if len(calls)==0: - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") # <<<<<<<<<<<<<< - * for func_name, params in calls: - * if type(func_name) is not str or type(params) is not dict: + /* "pyrfc/_cyrfc.pyx":2079 + * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) + * free(sapuc) + * if typeDesc == NULL: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 919, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 919, __pyx_L1_error) + __pyx_t_3 = ((__pyx_v_typeDesc == NULL) != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/client.pyx":918 - * if not isinstance(calls, Iterable): - * raise TypeError("Parameter 'calls' must be iterable.") - * if len(calls)==0: # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") - * for func_name, params in calls: + /* "pyrfc/_cyrfc.pyx":2080 + * free(sapuc) + * if typeDesc == NULL: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) + * if rc != RFC_OK: + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2080, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2080, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2079 + * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) + * free(sapuc) + * if typeDesc == NULL: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) */ } - /* "src/pyrfc/client.pyx":920 - * if len(calls)==0: - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") - * for func_name, params in calls: # <<<<<<<<<<<<<< - * if type(func_name) is not str or type(params) is not dict: - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + /* "pyrfc/_cyrfc.pyx":2081 + * if typeDesc == NULL: + * raise wrapError(&errorInfo) + * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * RfcDestroyTypeDesc(typeDesc, NULL) */ - if (likely(PyList_CheckExact(__pyx_v_calls)) || PyTuple_CheckExact(__pyx_v_calls)) { - __pyx_t_4 = __pyx_v_calls; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2081, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2081, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2081, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2081, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rc = RfcSetTypeLength(__pyx_v_typeDesc, __pyx_t_4, __pyx_t_5, (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2082 + * raise wrapError(&errorInfo) + * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * RfcDestroyTypeDesc(typeDesc, NULL) + * raise wrapError(&errorInfo) + */ + __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_3)) { + + /* "pyrfc/_cyrfc.pyx":2083 + * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) + * if rc != RFC_OK: + * RfcDestroyTypeDesc(typeDesc, NULL) # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * + */ + (void)(RfcDestroyTypeDesc(__pyx_v_typeDesc, NULL)); + + /* "pyrfc/_cyrfc.pyx":2084 + * if rc != RFC_OK: + * RfcDestroyTypeDesc(typeDesc, NULL) + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * + * for field_desc in type_desc.fields: + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2084, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2084, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2082 + * raise wrapError(&errorInfo) + * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * RfcDestroyTypeDesc(typeDesc, NULL) + * raise wrapError(&errorInfo) + */ + } + + /* "pyrfc/_cyrfc.pyx":2086 + * raise wrapError(&errorInfo) + * + * for field_desc in type_desc.fields: # <<<<<<<<<<<<<< + * # Set name + * sapuc = fillString(field_desc['name']) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_calls); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 920, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2086, __pyx_L1_error) } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 920, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 2086, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 920, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 2086, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_7)) { + __pyx_t_1 = __pyx_t_8(__pyx_t_6); + if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 920, __pyx_L1_error) + else __PYX_ERR(0, 2086, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_7); - } - if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) { - PyObject* sequence = __pyx_t_7; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 920, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_8 = PyList_GET_ITEM(sequence, 0); - __pyx_t_9 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - #else - __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - #endif - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 920, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; - index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(2, 920, __pyx_L1_error) - __pyx_t_11 = NULL; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L12_unpacking_done; - __pyx_L11_unpacking_failed:; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(2, 920, __pyx_L1_error) - __pyx_L12_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_9); - __pyx_t_9 = 0; - - /* "src/pyrfc/client.pyx":921 - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") - * for func_name, params in calls: - * if type(func_name) is not str or type(params) is not dict: # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") - * if self.active_unit: - */ - __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_func_name)) != ((PyObject *)(&PyString_Type))); - __pyx_t_2 = (__pyx_t_1 != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_3 = __pyx_t_2; - goto __pyx_L14_bool_binop_done; + __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_params)) != ((PyObject *)(&PyDict_Type))); - __pyx_t_1 = (__pyx_t_2 != 0); - __pyx_t_3 = __pyx_t_1; - __pyx_L14_bool_binop_done:; - if (unlikely(__pyx_t_3)) { + __Pyx_XDECREF_SET(__pyx_v_field_desc, __pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":922 - * for func_name, params in calls: - * if type(func_name) is not str or type(params) is not dict: - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") # <<<<<<<<<<<<<< - * if self.active_unit: - * raise RFCError("There is an active unit for this connection. " + /* "pyrfc/_cyrfc.pyx":2088 + * for field_desc in type_desc.fields: + * # Set name + * sapuc = fillString(field_desc['name']) # <<<<<<<<<<<<<< + * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) + * free(sapuc) */ - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(2, 922, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2088, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2088, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_sapuc = __pyx_t_2; - /* "src/pyrfc/client.pyx":921 - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") - * for func_name, params in calls: - * if type(func_name) is not str or type(params) is not dict: # <<<<<<<<<<<<<< - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") - * if self.active_unit: + /* "pyrfc/_cyrfc.pyx":2089 + * # Set name + * sapuc = fillString(field_desc['name']) + * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * fieldDesc.type = RfcFieldType[field_desc['field_type']].value */ - } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2089, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2089, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_fieldDesc.name, __pyx_v_sapuc, (__pyx_t_9 + 1)); - /* "src/pyrfc/client.pyx":920 - * if len(calls)==0: - * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") - * for func_name, params in calls: # <<<<<<<<<<<<<< - * if type(func_name) is not str or type(params) is not dict: - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + /* "pyrfc/_cyrfc.pyx":2090 + * sapuc = fillString(field_desc['name']) + * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * fieldDesc.type = RfcFieldType[field_desc['field_type']].value + * fieldDesc.nucLength = field_desc['nuc_length'] */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + free(__pyx_v_sapuc); - /* "src/pyrfc/client.pyx":923 - * if type(func_name) is not str or type(params) is not dict: - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") - * if self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("There is an active unit for this connection. " - * "Use destroy_unit() " + + /* "pyrfc/_cyrfc.pyx":2091 + * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) + * free(sapuc) + * fieldDesc.type = RfcFieldType[field_desc['field_type']].value # <<<<<<<<<<<<<< + * fieldDesc.nucLength = field_desc['nuc_length'] + * fieldDesc.nucOffset = field_desc['nuc_offset'] */ - __pyx_t_3 = (__pyx_v_self->active_unit != 0); - if (unlikely(__pyx_t_3)) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2091, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_field_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2091, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2091, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2091, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_12 = ((RFCTYPE)__Pyx_PyInt_As_RFCTYPE(__pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2091, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_fieldDesc.type = __pyx_t_12; - /* "src/pyrfc/client.pyx":924 - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") - * if self.active_unit: - * raise RFCError("There is an active unit for this connection. " # <<<<<<<<<<<<<< - * "Use destroy_unit() " + - * "or confirm_unit().") + /* "pyrfc/_cyrfc.pyx":2092 + * free(sapuc) + * fieldDesc.type = RfcFieldType[field_desc['field_type']].value + * fieldDesc.nucLength = field_desc['nuc_length'] # <<<<<<<<<<<<<< + * fieldDesc.nucOffset = field_desc['nuc_offset'] + * fieldDesc.ucLength = field_desc['uc_length'] */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 924, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2092, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2092, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_fieldDesc.nucLength = __pyx_t_5; - /* "src/pyrfc/client.pyx":925 - * if self.active_unit: - * raise RFCError("There is an active unit for this connection. " - * "Use destroy_unit() " + # <<<<<<<<<<<<<< - * "or confirm_unit().") - * bg = unit['background'] + /* "pyrfc/_cyrfc.pyx":2093 + * fieldDesc.type = RfcFieldType[field_desc['field_type']].value + * fieldDesc.nucLength = field_desc['nuc_length'] + * fieldDesc.nucOffset = field_desc['nuc_offset'] # <<<<<<<<<<<<<< + * fieldDesc.ucLength = field_desc['uc_length'] + * fieldDesc.ucOffset = field_desc['uc_offset'] */ - __pyx_t_9 = PyNumber_Add(__pyx_kp_s_There_is_an_active_unit_for_this, __pyx_kp_s_or_confirm_unit); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 925, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 924, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 924, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_nuc_offset); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2093, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2093, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_fieldDesc.nucOffset = __pyx_t_5; - /* "src/pyrfc/client.pyx":923 - * if type(func_name) is not str or type(params) is not dict: - * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") - * if self.active_unit: # <<<<<<<<<<<<<< - * raise RFCError("There is an active unit for this connection. " - * "Use destroy_unit() " + + /* "pyrfc/_cyrfc.pyx":2094 + * fieldDesc.nucLength = field_desc['nuc_length'] + * fieldDesc.nucOffset = field_desc['nuc_offset'] + * fieldDesc.ucLength = field_desc['uc_length'] # <<<<<<<<<<<<<< + * fieldDesc.ucOffset = field_desc['uc_offset'] + * fieldDesc.decimals = field_desc['decimals'] */ - } + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2094, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2094, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_fieldDesc.ucLength = __pyx_t_5; - /* "src/pyrfc/client.pyx":927 - * "Use destroy_unit() " + - * "or confirm_unit().") - * bg = unit['background'] # <<<<<<<<<<<<<< - * unit_id = unit['id'] - * + /* "pyrfc/_cyrfc.pyx":2095 + * fieldDesc.nucOffset = field_desc['nuc_offset'] + * fieldDesc.ucLength = field_desc['uc_length'] + * fieldDesc.ucOffset = field_desc['uc_offset'] # <<<<<<<<<<<<<< + * fieldDesc.decimals = field_desc['decimals'] + * if field_desc['type_description'] is not None: */ - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 927, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_bg = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_uc_offset); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2095, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2095, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_fieldDesc.ucOffset = __pyx_t_5; - /* "src/pyrfc/client.pyx":928 - * "or confirm_unit().") - * bg = unit['background'] - * unit_id = unit['id'] # <<<<<<<<<<<<<< - * - * if bg is True: + /* "pyrfc/_cyrfc.pyx":2096 + * fieldDesc.ucLength = field_desc['uc_length'] + * fieldDesc.ucOffset = field_desc['uc_offset'] + * fieldDesc.decimals = field_desc['decimals'] # <<<<<<<<<<<<<< + * if field_desc['type_description'] is not None: + * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) */ - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_unit_id = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_decimals); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2096, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2096, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_fieldDesc.decimals = __pyx_t_5; - /* "src/pyrfc/client.pyx":930 - * unit_id = unit['id'] - * - * if bg is True: # <<<<<<<<<<<<<< - * if len(unit_id) != RFC_UNITID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + /* "pyrfc/_cyrfc.pyx":2097 + * fieldDesc.ucOffset = field_desc['uc_offset'] + * fieldDesc.decimals = field_desc['decimals'] + * if field_desc['type_description'] is not None: # <<<<<<<<<<<<<< + * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) + * else: */ - __pyx_t_3 = (__pyx_v_bg == Py_True); - __pyx_t_1 = (__pyx_t_3 != 0); - if (__pyx_t_1) { + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2097, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = (__pyx_t_10 != Py_None); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_13 = (__pyx_t_3 != 0); + if (__pyx_t_13) { - /* "src/pyrfc/client.pyx":931 - * - * if bg is True: - * if len(unit_id) != RFC_UNITID_LN: # <<<<<<<<<<<<<< - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + /* "pyrfc/_cyrfc.pyx":2098 + * fieldDesc.decimals = field_desc['decimals'] + * if field_desc['type_description'] is not None: + * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) # <<<<<<<<<<<<<< + * else: + * fieldDesc.typeDescHandle = NULL */ - __pyx_t_5 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 931, __pyx_L1_error) - __pyx_t_1 = ((__pyx_t_5 != RFC_UNITID_LN) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2098, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_v_fieldDesc.typeDescHandle = __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "src/pyrfc/client.pyx":932 - * if bg is True: - * if len(unit_id) != RFC_UNITID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") # <<<<<<<<<<<<<< - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) - * elif bg is False: + /* "pyrfc/_cyrfc.pyx":2097 + * fieldDesc.ucOffset = field_desc['uc_offset'] + * fieldDesc.decimals = field_desc['decimals'] + * if field_desc['type_description'] is not None: # <<<<<<<<<<<<<< + * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) + * else: */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_12 = 127; - __Pyx_INCREF(__pyx_kp_u_Length_of_parameter_unit_id_must); - __pyx_t_5 += 41; - __Pyx_GIVEREF(__pyx_kp_u_Length_of_parameter_unit_id_must); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Length_of_parameter_unit_id_must); - __pyx_t_7 = __Pyx_PyUnicode_From_int(RFC_UNITID_LN, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u_chars_found); - __pyx_t_5 += 14; - __Pyx_GIVEREF(__pyx_kp_u_chars_found); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_chars_found); - __pyx_t_13 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(2, 932, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_13, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__8); - __pyx_t_5 += 1; - __Pyx_GIVEREF(__pyx_kp_u__8); - PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__8); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_5, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 932, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 932, __pyx_L1_error) + goto __pyx_L7; + } - /* "src/pyrfc/client.pyx":931 - * - * if bg is True: - * if len(unit_id) != RFC_UNITID_LN: # <<<<<<<<<<<<<< - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + /* "pyrfc/_cyrfc.pyx":2100 + * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) + * else: + * fieldDesc.typeDescHandle = NULL # <<<<<<<<<<<<<< + * fieldDesc.extendedDescription = NULL + * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) */ + /*else*/ { + __pyx_v_fieldDesc.typeDescHandle = NULL; } + __pyx_L7:; - /* "src/pyrfc/client.pyx":933 - * if len(unit_id) != RFC_UNITID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) # <<<<<<<<<<<<<< - * elif bg is False: - * if len(unit_id) != RFC_TID_LN: + /* "pyrfc/_cyrfc.pyx":2101 + * else: + * fieldDesc.typeDescHandle = NULL + * fieldDesc.extendedDescription = NULL # <<<<<<<<<<<<<< + * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_and_submit_unit); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_names, __pyx_v_attributes}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 4+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_8 = PyTuple_New(4+__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_INCREF(__pyx_v_unit_id); - __Pyx_GIVEREF(__pyx_v_unit_id); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_14, __pyx_v_unit_id); - __Pyx_INCREF(__pyx_v_calls); - __Pyx_GIVEREF(__pyx_v_calls); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_14, __pyx_v_calls); - __Pyx_INCREF(__pyx_v_queue_names); - __Pyx_GIVEREF(__pyx_v_queue_names); - PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_14, __pyx_v_queue_names); - __Pyx_INCREF(__pyx_v_attributes); - __Pyx_GIVEREF(__pyx_v_attributes); - PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_14, __pyx_v_attributes); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_unit, __pyx_n_s_queued, __pyx_t_4) < 0)) __PYX_ERR(2, 933, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_fieldDesc.extendedDescription = NULL; - /* "src/pyrfc/client.pyx":930 - * unit_id = unit['id'] - * - * if bg is True: # <<<<<<<<<<<<<< - * if len(unit_id) != RFC_UNITID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + /* "pyrfc/_cyrfc.pyx":2102 + * fieldDesc.typeDescHandle = NULL + * fieldDesc.extendedDescription = NULL + * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * RfcDestroyTypeDesc(typeDesc, NULL) */ - goto __pyx_L17; - } + __pyx_v_rc = RfcAddTypeField(__pyx_v_typeDesc, (&__pyx_v_fieldDesc), (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":934 - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) - * elif bg is False: # <<<<<<<<<<<<<< - * if len(unit_id) != RFC_TID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") + /* "pyrfc/_cyrfc.pyx":2103 + * fieldDesc.extendedDescription = NULL + * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * RfcDestroyTypeDesc(typeDesc, NULL) + * raise wrapError(&errorInfo) */ - __pyx_t_1 = (__pyx_v_bg == Py_False); - __pyx_t_3 = (__pyx_t_1 != 0); - if (likely(__pyx_t_3)) { + __pyx_t_13 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_13)) { - /* "src/pyrfc/client.pyx":935 - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) - * elif bg is False: - * if len(unit_id) != RFC_TID_LN: # <<<<<<<<<<<<<< - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") - * if attributes is not None: + /* "pyrfc/_cyrfc.pyx":2104 + * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) + * if rc != RFC_OK: + * RfcDestroyTypeDesc(typeDesc, NULL) # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * */ - __pyx_t_5 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 935, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_5 != RFC_TID_LN) != 0); - if (unlikely(__pyx_t_3)) { + (void)(RfcDestroyTypeDesc(__pyx_v_typeDesc, NULL)); - /* "src/pyrfc/client.pyx":936 - * elif bg is False: - * if len(unit_id) != RFC_TID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") # <<<<<<<<<<<<<< - * if attributes is not None: - * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") - */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_12 = 127; - __Pyx_INCREF(__pyx_kp_u_Length_of_parameter_unit_id_must); - __pyx_t_5 += 41; - __Pyx_GIVEREF(__pyx_kp_u_Length_of_parameter_unit_id_must); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Length_of_parameter_unit_id_must); - __pyx_t_7 = __Pyx_PyUnicode_From_int(RFC_TID_LN, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u_chars_found); - __pyx_t_5 += 14; - __Pyx_GIVEREF(__pyx_kp_u_chars_found); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_chars_found); - __pyx_t_13 = PyObject_Length(__pyx_v_unit_id); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(2, 936, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_13, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__8); - __pyx_t_5 += 1; - __Pyx_GIVEREF(__pyx_kp_u__8); - PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__8); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_5, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 936, __pyx_L1_error) - - /* "src/pyrfc/client.pyx":935 - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) - * elif bg is False: - * if len(unit_id) != RFC_TID_LN: # <<<<<<<<<<<<<< - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") - * if attributes is not None: - */ - } - - /* "src/pyrfc/client.pyx":937 - * if len(unit_id) != RFC_TID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") - * if attributes is not None: # <<<<<<<<<<<<<< - * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") - * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: - */ - __pyx_t_3 = (__pyx_v_attributes != Py_None); - __pyx_t_1 = (__pyx_t_3 != 0); - if (unlikely(__pyx_t_1)) { - - /* "src/pyrfc/client.pyx":938 - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") - * if attributes is not None: - * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") # <<<<<<<<<<<<<< - * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: - * self._create_and_submit_transaction(unit_id, calls) - */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 938, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_Argument_attributes_not_valid_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Argument_attributes_not_valid_t); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 938, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 938, __pyx_L1_error) - - /* "src/pyrfc/client.pyx":937 - * if len(unit_id) != RFC_TID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") - * if attributes is not None: # <<<<<<<<<<<<<< - * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") - * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: - */ - } - - /* "src/pyrfc/client.pyx":939 - * if attributes is not None: - * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") - * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: # <<<<<<<<<<<<<< - * self._create_and_submit_transaction(unit_id, calls) - * unit['queued'] = False - */ - __pyx_t_3 = (__pyx_v_queue_names == Py_None); - __pyx_t_2 = (__pyx_t_3 != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_queue_names)) == ((PyObject *)(&PyList_Type))); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - } else { - __pyx_t_1 = __pyx_t_3; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_5 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 939, __pyx_L1_error) - __pyx_t_3 = ((__pyx_t_5 == 0) != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L22_bool_binop_done:; - if (__pyx_t_1) { - - /* "src/pyrfc/client.pyx":940 - * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") - * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: - * self._create_and_submit_transaction(unit_id, calls) # <<<<<<<<<<<<<< - * unit['queued'] = False - * elif len(queue_names) == 1: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_and_submit_transaction); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 940, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_unit_id, __pyx_v_calls}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 940, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_unit_id, __pyx_v_calls}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 940, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 940, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_INCREF(__pyx_v_unit_id); - __Pyx_GIVEREF(__pyx_v_unit_id); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_14, __pyx_v_unit_id); - __Pyx_INCREF(__pyx_v_calls); - __Pyx_GIVEREF(__pyx_v_calls); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_14, __pyx_v_calls); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 940, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "src/pyrfc/client.pyx":941 - * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: - * self._create_and_submit_transaction(unit_id, calls) - * unit['queued'] = False # <<<<<<<<<<<<<< - * elif len(queue_names) == 1: - * queue_name = queue_names[0] - */ - if (unlikely(PyObject_SetItem(__pyx_v_unit, __pyx_n_s_queued, Py_False) < 0)) __PYX_ERR(2, 941, __pyx_L1_error) - - /* "src/pyrfc/client.pyx":939 - * if attributes is not None: - * raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") - * if queue_names is None or type(queue_names) is list and len(queue_names) == 0: # <<<<<<<<<<<<<< - * self._create_and_submit_transaction(unit_id, calls) - * unit['queued'] = False - */ - goto __pyx_L21; - } - - /* "src/pyrfc/client.pyx":942 - * self._create_and_submit_transaction(unit_id, calls) - * unit['queued'] = False - * elif len(queue_names) == 1: # <<<<<<<<<<<<<< - * queue_name = queue_names[0] - * self._create_and_submit_transaction(unit_id, calls, queue_name) - */ - __pyx_t_5 = PyObject_Length(__pyx_v_queue_names); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 942, __pyx_L1_error) - __pyx_t_1 = ((__pyx_t_5 == 1) != 0); - if (likely(__pyx_t_1)) { - - /* "src/pyrfc/client.pyx":943 - * unit['queued'] = False - * elif len(queue_names) == 1: - * queue_name = queue_names[0] # <<<<<<<<<<<<<< - * self._create_and_submit_transaction(unit_id, calls, queue_name) - * unit['queued'] = True - */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_queue_names, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 943, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_v_queue_name = __pyx_t_4; - __pyx_t_4 = 0; - - /* "src/pyrfc/client.pyx":944 - * elif len(queue_names) == 1: - * queue_name = queue_names[0] - * self._create_and_submit_transaction(unit_id, calls, queue_name) # <<<<<<<<<<<<<< - * unit['queued'] = True - * else: - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_create_and_submit_transaction); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - __pyx_t_14 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_14 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_name}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 944, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_v_unit_id, __pyx_v_calls, __pyx_v_queue_name}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_14, 3+__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 944, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_8 = PyTuple_New(3+__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_INCREF(__pyx_v_unit_id); - __Pyx_GIVEREF(__pyx_v_unit_id); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_14, __pyx_v_unit_id); - __Pyx_INCREF(__pyx_v_calls); - __Pyx_GIVEREF(__pyx_v_calls); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_14, __pyx_v_calls); - __Pyx_INCREF(__pyx_v_queue_name); - __Pyx_GIVEREF(__pyx_v_queue_name); - PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_14, __pyx_v_queue_name); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 944, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "src/pyrfc/client.pyx":945 - * queue_name = queue_names[0] - * self._create_and_submit_transaction(unit_id, calls, queue_name) - * unit['queued'] = True # <<<<<<<<<<<<<< - * else: - * raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") - */ - if (unlikely(PyObject_SetItem(__pyx_v_unit, __pyx_n_s_queued, Py_True) < 0)) __PYX_ERR(2, 945, __pyx_L1_error) - - /* "src/pyrfc/client.pyx":942 - * self._create_and_submit_transaction(unit_id, calls) - * unit['queued'] = False - * elif len(queue_names) == 1: # <<<<<<<<<<<<<< - * queue_name = queue_names[0] - * self._create_and_submit_transaction(unit_id, calls, queue_name) + /* "pyrfc/_cyrfc.pyx":2105 + * if rc != RFC_OK: + * RfcDestroyTypeDesc(typeDesc, NULL) + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * + * return typeDesc */ - goto __pyx_L21; - } + __pyx_t_10 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2105, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_Raise(__pyx_t_10, 0, 0, 0); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __PYX_ERR(0, 2105, __pyx_L1_error) - /* "src/pyrfc/client.pyx":947 - * unit['queued'] = True - * else: - * raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") # <<<<<<<<<<<<<< - * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + /* "pyrfc/_cyrfc.pyx":2103 + * fieldDesc.extendedDescription = NULL + * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * RfcDestroyTypeDesc(typeDesc, NULL) + * raise wrapError(&errorInfo) */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 947, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_Argument_queue_names_not_valid_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Argument_queue_names_not_valid_t); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 947, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 947, __pyx_L1_error) } - __pyx_L21:; - - /* "src/pyrfc/client.pyx":934 - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") - * unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) - * elif bg is False: # <<<<<<<<<<<<<< - * if len(unit_id) != RFC_TID_LN: - * raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") - */ - goto __pyx_L17; - } - /* "src/pyrfc/client.pyx":949 - * raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") - * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< - * return unit + /* "pyrfc/_cyrfc.pyx":2086 + * raise wrapError(&errorInfo) * + * for field_desc in type_desc.fields: # <<<<<<<<<<<<<< + * # Set name + * sapuc = fillString(field_desc['name']) */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 949, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Argument_unit_not_valid_Is_unit); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 949, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 949, __pyx_L1_error) } - __pyx_L17:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/client.pyx":950 - * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - * return unit # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2107 + * raise wrapError(&errorInfo) * - * def get_unit_state(self, unit): + * return typeDesc # <<<<<<<<<<<<<< + * + * cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_unit); - __pyx_r = __pyx_v_unit; + __pyx_r = __pyx_v_typeDesc; goto __pyx_L0; - /* "src/pyrfc/client.pyx":861 - * return {'background': background, 'id': id, "queued": False} + /* "pyrfc/_cyrfc.pyx":2064 * - * def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): # <<<<<<<<<<<<<< - * """ Fills a unit with one or more RFC and submits it to the backend. * + * cdef RFC_TYPE_DESC_HANDLE fillTypeDescription(type_desc): # <<<<<<<<<<<<<< + * """ + * :param type_desc: object of class TypeDescription */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.fill_and_submit_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_11); + __Pyx_WriteUnraisable("pyrfc._cyrfc.fillTypeDescription", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_func_name); - __Pyx_XDECREF(__pyx_v_params); - __Pyx_XDECREF(__pyx_v_bg); - __Pyx_XDECREF(__pyx_v_unit_id); - __Pyx_XDECREF(__pyx_v_queue_name); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_field_desc); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":952 - * return unit - * - * def get_unit_state(self, unit): # <<<<<<<<<<<<<< - * """Retrieves the processing status of the given background unit. +/* "pyrfc/_cyrfc.pyx":2109 + * return typeDesc * + * cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): # <<<<<<<<<<<<<< + * """ + * :param func_desc: object of class FunctionDescription */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_63get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_62get_unit_state[] = "Retrieves the processing status of the given background unit.\n\n .. note::\n Only available for background units.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :return: The state of the current bgRFC unit. Possible values are:\n RFC_UNIT_NOT_FOUND\n RFC_UNIT_IN_PROCESS\n RFC_UNIT_COMMITTED\n RFC_UNIT_ROLLED_BACK\n RFC_UNIT_CONFIRMED\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_63get_unit_state(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_unit_state (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_62get_unit_state(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_62get_unit_state(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { - PyObject *__pyx_v_bg = NULL; - PyObject *__pyx_r = NULL; +static RFC_FUNCTION_DESC_HANDLE __pyx_f_5pyrfc_6_cyrfc_fillFunctionDescription(PyObject *__pyx_v_func_desc) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; + RFC_PARAMETER_DESC __pyx_v_paramDesc; + SAP_UC *__pyx_v_sapuc; + PyObject *__pyx_v_param_desc = NULL; + RFC_RC __pyx_v_rc; + RFC_FUNCTION_DESC_HANDLE __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + SAP_UC *__pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + Py_ssize_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + RFCTYPE __pyx_t_10; + RFC_DIRECTION __pyx_t_11; + unsigned int __pyx_t_12; + int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_unit_state", 0); + __Pyx_RefNannySetupContext("fillFunctionDescription", 0); - /* "src/pyrfc/client.pyx":967 - * RFC_UNIT_CONFIRMED - * """ - * bg = unit['background'] # <<<<<<<<<<<<<< - * if bg is True: - * return self._get_unit_state(unit) + /* "pyrfc/_cyrfc.pyx":2120 + * + * # Set name + * sapuc = fillString(func_desc.name) # <<<<<<<<<<<<<< + * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) + * free(sapuc) */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 967, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bg = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_sapuc = __pyx_t_2; - /* "src/pyrfc/client.pyx":968 - * """ - * bg = unit['background'] - * if bg is True: # <<<<<<<<<<<<<< - * return self._get_unit_state(unit) - * elif bg is False: + /* "pyrfc/_cyrfc.pyx":2121 + * # Set name + * sapuc = fillString(func_desc.name) + * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) # <<<<<<<<<<<<<< + * free(sapuc) + * if funcDesc == NULL: */ - __pyx_t_2 = (__pyx_v_bg == Py_True); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_v_funcDesc = RfcCreateFunctionDesc(__pyx_v_sapuc, (&__pyx_v_errorInfo)); - /* "src/pyrfc/client.pyx":969 - * bg = unit['background'] - * if bg is True: - * return self._get_unit_state(unit) # <<<<<<<<<<<<<< - * elif bg is False: - * raise RFCError("No state check possible of non-bgRFC units.") + /* "pyrfc/_cyrfc.pyx":2122 + * sapuc = fillString(func_desc.name) + * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) + * free(sapuc) # <<<<<<<<<<<<<< + * if funcDesc == NULL: + * raise wrapError(&errorInfo) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_unit_state); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 969, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_unit); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 969, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + free(__pyx_v_sapuc); - /* "src/pyrfc/client.pyx":968 - * """ - * bg = unit['background'] - * if bg is True: # <<<<<<<<<<<<<< - * return self._get_unit_state(unit) - * elif bg is False: + /* "pyrfc/_cyrfc.pyx":2123 + * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) + * free(sapuc) + * if funcDesc == NULL: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * */ - } + __pyx_t_3 = ((__pyx_v_funcDesc == NULL) != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/client.pyx":970 - * if bg is True: - * return self._get_unit_state(unit) - * elif bg is False: # <<<<<<<<<<<<<< - * raise RFCError("No state check possible of non-bgRFC units.") - * else: + /* "pyrfc/_cyrfc.pyx":2124 + * free(sapuc) + * if funcDesc == NULL: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * + * for param_desc in func_desc.parameters: */ - __pyx_t_3 = (__pyx_v_bg == Py_False); - __pyx_t_2 = (__pyx_t_3 != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2124, __pyx_L1_error) - /* "src/pyrfc/client.pyx":971 - * return self._get_unit_state(unit) - * elif bg is False: - * raise RFCError("No state check possible of non-bgRFC units.") # <<<<<<<<<<<<<< - * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 971, __pyx_L1_error) + /* "pyrfc/_cyrfc.pyx":2123 + * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) + * free(sapuc) + * if funcDesc == NULL: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * + */ + } + + /* "pyrfc/_cyrfc.pyx":2126 + * raise wrapError(&errorInfo) + * + * for param_desc in func_desc.parameters: # <<<<<<<<<<<<<< + * sapuc = fillString(param_desc['name']) + * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_desc, __pyx_n_s_parameters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2126, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2126, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2126, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_6(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 2126, __pyx_L1_error) + } + break; } + __Pyx_GOTREF(__pyx_t_1); } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_No_state_check_possible_of_non_b) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_No_state_check_possible_of_non_b); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 971, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_param_desc, __pyx_t_1); + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2127 + * + * for param_desc in func_desc.parameters: + * sapuc = fillString(param_desc['name']) # <<<<<<<<<<<<<< + * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2127, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 971, __pyx_L1_error) + __pyx_v_sapuc = __pyx_t_2; - /* "src/pyrfc/client.pyx":970 - * if bg is True: - * return self._get_unit_state(unit) - * elif bg is False: # <<<<<<<<<<<<<< - * raise RFCError("No state check possible of non-bgRFC units.") - * else: + /* "pyrfc/_cyrfc.pyx":2128 + * for param_desc in func_desc.parameters: + * sapuc = fillString(param_desc['name']) + * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value */ - } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_paramDesc.name, __pyx_v_sapuc, (__pyx_t_7 + 1)); - /* "src/pyrfc/client.pyx":973 - * raise RFCError("No state check possible of non-bgRFC units.") - * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< - * - * def destroy_unit(self, unit): + /* "pyrfc/_cyrfc.pyx":2129 + * sapuc = fillString(param_desc['name']) + * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value + * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 973, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_unit_not_valid_Is_unit); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 973, __pyx_L1_error) + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2130 + * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + * free(sapuc) + * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value # <<<<<<<<<<<<<< + * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value + * paramDesc.nucLength = param_desc['nuc_length'] + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_parameter_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 973, __pyx_L1_error) - } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = ((RFCTYPE)__Pyx_PyInt_As_RFCTYPE(__pyx_t_8)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_paramDesc.type = __pyx_t_10; - /* "src/pyrfc/client.pyx":952 - * return unit - * - * def get_unit_state(self, unit): # <<<<<<<<<<<<<< - * """Retrieves the processing status of the given background unit. - * + /* "pyrfc/_cyrfc.pyx":2131 + * free(sapuc) + * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value + * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value # <<<<<<<<<<<<<< + * paramDesc.nucLength = param_desc['nuc_length'] + * paramDesc.ucLength = param_desc['uc_length'] */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_direction); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = ((RFC_DIRECTION)__Pyx_PyInt_As_RFC_DIRECTION(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_paramDesc.direction = __pyx_t_11; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.get_unit_state", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_bg); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2132 + * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value + * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value + * paramDesc.nucLength = param_desc['nuc_length'] # <<<<<<<<<<<<<< + * paramDesc.ucLength = param_desc['uc_length'] + * paramDesc.decimals = param_desc['decimals'] + */ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_9); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2132, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_paramDesc.nucLength = __pyx_t_12; -/* "src/pyrfc/client.pyx":975 - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - * - * def destroy_unit(self, unit): # <<<<<<<<<<<<<< - * """ Destroy the current unit. - * + /* "pyrfc/_cyrfc.pyx":2133 + * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value + * paramDesc.nucLength = param_desc['nuc_length'] + * paramDesc.ucLength = param_desc['uc_length'] # <<<<<<<<<<<<<< + * paramDesc.decimals = param_desc['decimals'] + * # defaultValue */ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_9); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2133, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_paramDesc.ucLength = __pyx_t_12; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_65destroy_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_64destroy_unit[] = " Destroy the current unit.\n\n E.g. if the completed unit could not be recorded in the frontend.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection attempt fails.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_65destroy_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("destroy_unit (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_64destroy_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); + /* "pyrfc/_cyrfc.pyx":2134 + * paramDesc.nucLength = param_desc['nuc_length'] + * paramDesc.ucLength = param_desc['uc_length'] + * paramDesc.decimals = param_desc['decimals'] # <<<<<<<<<<<<<< + * # defaultValue + * sapuc = fillString(param_desc['default_value']) + */ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_decimals); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_9); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_paramDesc.decimals = __pyx_t_12; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2136 + * paramDesc.decimals = param_desc['decimals'] + * # defaultValue + * sapuc = fillString(param_desc['default_value']) # <<<<<<<<<<<<<< + * strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) + * free(sapuc) + */ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_default_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_9); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2136, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_sapuc = __pyx_t_2; -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_64destroy_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { - PyObject *__pyx_v_bg = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("destroy_unit", 0); + /* "pyrfc/_cyrfc.pyx":2137 + * # defaultValue + * sapuc = fillString(param_desc['default_value']) + * strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * # parameterText + */ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_default_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + strncpyU(__pyx_v_paramDesc.defaultValue, __pyx_v_sapuc, (__pyx_t_7 + 1)); - /* "src/pyrfc/client.pyx":985 - * thereof if the connection attempt fails. - * """ - * bg = unit['background'] # <<<<<<<<<<<<<< - * if bg is True: - * self._destroy_unit() + /* "pyrfc/_cyrfc.pyx":2138 + * sapuc = fillString(param_desc['default_value']) + * strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * # parameterText + * sapuc = fillString(param_desc['parameter_text']) */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 985, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bg = __pyx_t_1; - __pyx_t_1 = 0; + free(__pyx_v_sapuc); - /* "src/pyrfc/client.pyx":986 - * """ - * bg = unit['background'] - * if bg is True: # <<<<<<<<<<<<<< - * self._destroy_unit() - * elif bg is False: + /* "pyrfc/_cyrfc.pyx":2140 + * free(sapuc) + * # parameterText + * sapuc = fillString(param_desc['parameter_text']) # <<<<<<<<<<<<<< + * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) + * free(sapuc) */ - __pyx_t_2 = (__pyx_v_bg == Py_True); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_parameter_text); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_9); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2140, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_sapuc = __pyx_t_2; - /* "src/pyrfc/client.pyx":987 - * bg = unit['background'] - * if bg is True: - * self._destroy_unit() # <<<<<<<<<<<<<< - * elif bg is False: - * self._destroy_transaction() + /* "pyrfc/_cyrfc.pyx":2141 + * # parameterText + * sapuc = fillString(param_desc['parameter_text']) + * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * paramDesc.optional = param_desc['optional'] */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy_unit); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 987, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 987, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_parameter_text); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + strncpyU(__pyx_v_paramDesc.parameterText, __pyx_v_sapuc, (__pyx_t_7 + 1)); - /* "src/pyrfc/client.pyx":986 - * """ - * bg = unit['background'] - * if bg is True: # <<<<<<<<<<<<<< - * self._destroy_unit() - * elif bg is False: + /* "pyrfc/_cyrfc.pyx":2142 + * sapuc = fillString(param_desc['parameter_text']) + * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * paramDesc.optional = param_desc['optional'] + * if param_desc['type_description'] is not None: */ - goto __pyx_L3; - } + free(__pyx_v_sapuc); - /* "src/pyrfc/client.pyx":988 - * if bg is True: - * self._destroy_unit() - * elif bg is False: # <<<<<<<<<<<<<< - * self._destroy_transaction() + /* "pyrfc/_cyrfc.pyx":2143 + * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) + * free(sapuc) + * paramDesc.optional = param_desc['optional'] # <<<<<<<<<<<<<< + * if param_desc['type_description'] is not None: + * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) + */ + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_optional); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2143, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_paramDesc.optional = __pyx_t_3; + + /* "pyrfc/_cyrfc.pyx":2144 + * free(sapuc) + * paramDesc.optional = param_desc['optional'] + * if param_desc['type_description'] is not None: # <<<<<<<<<<<<<< + * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) * else: */ - __pyx_t_3 = (__pyx_v_bg == Py_False); - __pyx_t_2 = (__pyx_t_3 != 0); - if (likely(__pyx_t_2)) { + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = (__pyx_t_9 != Py_None); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_13 = (__pyx_t_3 != 0); + if (__pyx_t_13) { - /* "src/pyrfc/client.pyx":989 - * self._destroy_unit() - * elif bg is False: - * self._destroy_transaction() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2145 + * paramDesc.optional = param_desc['optional'] + * if param_desc['type_description'] is not None: + * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) # <<<<<<<<<<<<<< * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + * paramDesc.typeDescHandle = NULL */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy_transaction); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 989, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_v_paramDesc.typeDescHandle = __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "pyrfc/_cyrfc.pyx":2144 + * free(sapuc) + * paramDesc.optional = param_desc['optional'] + * if param_desc['type_description'] is not None: # <<<<<<<<<<<<<< + * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) + * else: + */ + goto __pyx_L6; } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 989, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/client.pyx":988 - * if bg is True: - * self._destroy_unit() - * elif bg is False: # <<<<<<<<<<<<<< - * self._destroy_transaction() + /* "pyrfc/_cyrfc.pyx":2147 + * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) * else: + * paramDesc.typeDescHandle = NULL # <<<<<<<<<<<<<< + * paramDesc.extendedDescription = NULL + * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) */ - goto __pyx_L3; - } + /*else*/ { + __pyx_v_paramDesc.typeDescHandle = NULL; + } + __pyx_L6:; - /* "src/pyrfc/client.pyx":991 - * self._destroy_transaction() + /* "pyrfc/_cyrfc.pyx":2148 * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< + * paramDesc.typeDescHandle = NULL + * paramDesc.extendedDescription = NULL # <<<<<<<<<<<<<< + * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) + * if rc != RFC_OK: + */ + __pyx_v_paramDesc.extendedDescription = NULL; + + /* "pyrfc/_cyrfc.pyx":2149 + * paramDesc.typeDescHandle = NULL + * paramDesc.extendedDescription = NULL + * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * RfcDestroyFunctionDesc(funcDesc, NULL) + */ + __pyx_v_rc = RfcAddParameter(__pyx_v_funcDesc, (&__pyx_v_paramDesc), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2150 + * paramDesc.extendedDescription = NULL + * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * RfcDestroyFunctionDesc(funcDesc, NULL) + * raise wrapError(&errorInfo) + */ + __pyx_t_13 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_13)) { + + /* "pyrfc/_cyrfc.pyx":2151 + * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) + * if rc != RFC_OK: + * RfcDestroyFunctionDesc(funcDesc, NULL) # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) * - * def confirm_unit(self, unit): */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } + (void)(RfcDestroyFunctionDesc(__pyx_v_funcDesc, NULL)); + + /* "pyrfc/_cyrfc.pyx":2152 + * if rc != RFC_OK: + * RfcDestroyFunctionDesc(funcDesc, NULL) + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * + * return funcDesc + */ + __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(0, 2152, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2150 + * paramDesc.extendedDescription = NULL + * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * RfcDestroyFunctionDesc(funcDesc, NULL) + * raise wrapError(&errorInfo) + */ } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_unit_not_valid_Is_unit); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 991, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 991, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2126 + * raise wrapError(&errorInfo) + * + * for param_desc in func_desc.parameters: # <<<<<<<<<<<<<< + * sapuc = fillString(param_desc['name']) + * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + */ } - __pyx_L3:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/client.pyx":975 - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + /* "pyrfc/_cyrfc.pyx":2154 + * raise wrapError(&errorInfo) * - * def destroy_unit(self, unit): # <<<<<<<<<<<<<< - * """ Destroy the current unit. + * return funcDesc # <<<<<<<<<<<<<< + * + * cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: + */ + __pyx_r = __pyx_v_funcDesc; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":2109 + * return typeDesc * + * cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): # <<<<<<<<<<<<<< + * """ + * :param func_desc: object of class FunctionDescription */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.destroy_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_WriteUnraisable("pyrfc._cyrfc.fillFunctionDescription", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_bg); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_param_desc); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/client.pyx":993 - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - * - * def confirm_unit(self, unit): # <<<<<<<<<<<<<< - * """ Confirm the current unit in the backend. +/* "pyrfc/_cyrfc.pyx":2156 + * return funcDesc * + * cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: # <<<<<<<<<<<<<< + * cdef RFC_UNIT_IDENTIFIER uIdentifier + * cdef SAP_UC* sapuc */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_67confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Connection_66confirm_unit[] = " Confirm the current unit in the backend.\n\n This also destroys the unit.\n\n :param unit: a unit descriptor as returned by\n :meth:`~pyrfc.Connection.initialize_unit`.\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection attempt fails.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_67confirm_unit(PyObject *__pyx_v_self, PyObject *__pyx_v_unit) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("confirm_unit (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_66confirm_unit(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_unit)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_66confirm_unit(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_unit) { - PyObject *__pyx_v_bg = NULL; - PyObject *__pyx_r = NULL; +static RFC_UNIT_IDENTIFIER __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(PyObject *__pyx_v_unit) { + RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; + SAP_UC *__pyx_v_sapuc; + RFC_UNIT_IDENTIFIER __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; + SAP_UC *__pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_UCS4 __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("confirm_unit", 0); - - /* "src/pyrfc/client.pyx":1003 - * thereof if the connection attempt fails. - * """ - * bg = unit['background'] # <<<<<<<<<<<<<< - * if bg is True: - * self._confirm_unit(unit) - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_background); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1003, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_bg = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("fillUnitIdentifier", 0); - /* "src/pyrfc/client.pyx":1004 - * """ - * bg = unit['background'] - * if bg is True: # <<<<<<<<<<<<<< - * self._confirm_unit(unit) - * elif bg is False: + /* "pyrfc/_cyrfc.pyx":2159 + * cdef RFC_UNIT_IDENTIFIER uIdentifier + * cdef SAP_UC* sapuc + * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] # <<<<<<<<<<<<<< + * if len(unit['id']) != RFC_UNITID_LN: + * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") */ - __pyx_t_2 = (__pyx_v_bg == Py_True); - __pyx_t_3 = (__pyx_t_2 != 0); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_queued); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - - /* "src/pyrfc/client.pyx":1005 - * bg = unit['background'] - * if bg is True: - * self._confirm_unit(unit) # <<<<<<<<<<<<<< - * elif bg is False: - * self._confirm_transaction() - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_confirm_unit); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_unit); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1005, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":1004 - * """ - * bg = unit['background'] - * if bg is True: # <<<<<<<<<<<<<< - * self._confirm_unit(unit) - * elif bg is False: - */ - goto __pyx_L3; + __Pyx_INCREF(__pyx_n_s_Q); + __pyx_t_1 = __pyx_n_s_Q; + } else { + __Pyx_INCREF(__pyx_n_s_T); + __pyx_t_1 = __pyx_n_s_T; } + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_uIdentifier.unitType = (__pyx_t_4[0]); - /* "src/pyrfc/client.pyx":1006 - * if bg is True: - * self._confirm_unit(unit) - * elif bg is False: # <<<<<<<<<<<<<< - * self._confirm_transaction() - * else: - */ - __pyx_t_3 = (__pyx_v_bg == Py_False); - __pyx_t_2 = (__pyx_t_3 != 0); - if (likely(__pyx_t_2)) { - - /* "src/pyrfc/client.pyx":1007 - * self._confirm_unit(unit) - * elif bg is False: - * self._confirm_transaction() # <<<<<<<<<<<<<< - * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_confirm_transaction); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1007, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":1006 - * if bg is True: - * self._confirm_unit(unit) - * elif bg is False: # <<<<<<<<<<<<<< - * self._confirm_transaction() - * else: + /* "pyrfc/_cyrfc.pyx":2160 + * cdef SAP_UC* sapuc + * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] + * if len(unit['id']) != RFC_UNITID_LN: # <<<<<<<<<<<<<< + * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") + * sapuc = fillString(unit['id']) */ - goto __pyx_L3; - } + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2160, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = ((__pyx_t_5 != RFC_UNITID_LN) != 0); + if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/client.pyx":1009 - * self._confirm_transaction() - * else: - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2161 + * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] + * if len(unit['id']) != RFC_UNITID_LN: + * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") # <<<<<<<<<<<<<< + * sapuc = fillString(unit['id']) + * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1009, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_7 = 127; + __Pyx_INCREF(__pyx_kp_u_Invalid_length_of_unit_id_should); + __pyx_t_5 += 40; + __Pyx_GIVEREF(__pyx_kp_u_Invalid_length_of_unit_id_should); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_Invalid_length_of_unit_id_should); + __pyx_t_8 = __Pyx_PyUnicode_From_int(RFC_UNITID_LN, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_kp_u_but_found); + __pyx_t_5 += 12; + __Pyx_GIVEREF(__pyx_kp_u_but_found); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_but_found); + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_9, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_kp_u__28); + __pyx_t_5 += 2; + __Pyx_GIVEREF(__pyx_kp_u__28); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_kp_u__28); + __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_Argument_unit_not_valid_Is_unit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Argument_unit_not_valid_Is_unit); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1009, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1009, __pyx_L1_error) - } - __pyx_L3:; - - /* "src/pyrfc/client.pyx":993 - * raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - * - * def confirm_unit(self, unit): # <<<<<<<<<<<<<< - * """ Confirm the current unit in the backend. - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.confirm_unit", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_bg); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/client.pyx":72 - * """ - * cdef unsigned __bconfig - * cdef public dict __config # <<<<<<<<<<<<<< - * cdef bint active_transaction - * cdef bint active_unit - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__config); - __pyx_r = __pyx_v_self->__config; - goto __pyx_L0; - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(2, 72, __pyx_L1_error) - __pyx_t_1 = __pyx_v_value; - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__config); - __Pyx_DECREF(__pyx_v_self->__config); - __pyx_v_self->__config = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__config.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_5__del__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_10Connection_8__config_5__del__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_4__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_10Connection_8__config_4__del__(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__", 0); - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->__config); - __Pyx_DECREF(__pyx_v_self->__config); - __pyx_v_self->__config = ((PyObject*)Py_None); + __PYX_ERR(0, 2161, __pyx_L1_error) - /* function exit code */ - __pyx_r = 0; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): + /* "pyrfc/_cyrfc.pyx":2160 + * cdef SAP_UC* sapuc + * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] + * if len(unit['id']) != RFC_UNITID_LN: # <<<<<<<<<<<<<< + * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") + * sapuc = fillString(unit['id']) */ + } -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_69__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_69__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_68__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_68__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + /* "pyrfc/_cyrfc.pyx":2162 + * if len(unit['id']) != RFC_UNITID_LN: + * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") + * sapuc = fillString(unit['id']) # <<<<<<<<<<<<<< + * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) + * free(sapuc) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2162, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 2, __pyx_L1_error) + __pyx_v_sapuc = __pyx_t_4; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): + /* "pyrfc/_cyrfc.pyx":2163 + * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") + * sapuc = fillString(unit['id']) + * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * return uIdentifier */ + strncpyU(__pyx_v_uIdentifier.unitID, __pyx_v_sapuc, (RFC_UNITID_LN + 1)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + /* "pyrfc/_cyrfc.pyx":2164 + * sapuc = fillString(unit['id']) + * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * return uIdentifier + * */ + free(__pyx_v_sapuc); -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_71__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Connection_71__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Connection_70__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Connection_70__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2165 + * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) + * free(sapuc) + * return uIdentifier # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 4, __pyx_L1_error) + __pyx_r = __pyx_v_uIdentifier; + goto __pyx_L0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") + /* "pyrfc/_cyrfc.pyx":2156 + * return funcDesc + * + * cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: # <<<<<<<<<<<<<< + * cdef RFC_UNIT_IDENTIFIER uIdentifier + * cdef SAP_UC* sapuc */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Connection.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pyrfc._cyrfc.fillUnitIdentifier", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":21 - * +/* "pyrfc/_cyrfc.pyx":2178 + * cdef _connections * - * def default_auth_check(func_name=False, request_context = None): # <<<<<<<<<<<<<< - * request_context = request_context or {} - * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) + * def __init__(self, connections = None): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * self._throughput_handle = NULL */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_25default_auth_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_25default_auth_check = {"default_auth_check", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_25default_auth_check, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_25default_auth_check(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_func_name = 0; - PyObject *__pyx_v_request_context = 0; +static int __pyx_pw_5pyrfc_6_cyrfc_10Throughput_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_5pyrfc_6_cyrfc_10Throughput_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_connections = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - PyObject *__pyx_r = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("default_auth_check (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_request_context,0}; - PyObject* values[2] = {0,0}; - values[0] = ((PyObject *)Py_False); - values[1] = ((PyObject *)Py_None); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_connections,0}; + PyObject* values[1] = {0}; + values[0] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 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; @@ -29300,699 +27853,584 @@ static PyObject *__pyx_pw_5pyrfc_6_cyrfc_25default_auth_check(PyObject *__pyx_se switch (pos_args) { case 0: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_func_name); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connections); if (value) { values[0] = value; kw_args--; } } - CYTHON_FALLTHROUGH; - case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_request_context); - if (value) { values[1] = value; kw_args--; } - } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_auth_check") < 0)) __PYX_ERR(5, 21, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 2178, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_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; } } - __pyx_v_func_name = values[0]; - __pyx_v_request_context = values[1]; + __pyx_v_connections = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("default_auth_check", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 21, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2178, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.default_auth_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return NULL; + return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_24default_auth_check(__pyx_self, __pyx_v_func_name, __pyx_v_request_context); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput___init__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), __pyx_v_connections); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_24default_auth_check(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_request_context) { - PyObject *__pyx_r = NULL; +static int __pyx_pf_5pyrfc_6_cyrfc_10Throughput___init__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, PyObject *__pyx_v_connections) { + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_v_conn = NULL; + int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - Py_UCS4 __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("default_auth_check", 0); - __Pyx_INCREF(__pyx_v_request_context); + __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_INCREF(__pyx_v_connections); - /* "src/pyrfc/server.pyx":22 - * - * def default_auth_check(func_name=False, request_context = None): - * request_context = request_context or {} # <<<<<<<<<<<<<< - * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) - * return RFC_OK - */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_request_context); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 22, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __Pyx_INCREF(__pyx_v_request_context); - __pyx_t_1 = __pyx_v_request_context; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_L3_bool_binop_done:; - __Pyx_DECREF_SET(__pyx_v_request_context, __pyx_t_1); + /* "pyrfc/_cyrfc.pyx":2180 + * def __init__(self, connections = None): + * cdef RFC_ERROR_INFO errorInfo + * self._throughput_handle = NULL # <<<<<<<<<<<<<< + * self._connections = set() + * self._throughput_handle = RfcCreateThroughput(&errorInfo) + */ + __pyx_v_self->_throughput_handle = NULL; + + /* "pyrfc/_cyrfc.pyx":2181 + * cdef RFC_ERROR_INFO errorInfo + * self._throughput_handle = NULL + * self._connections = set() # <<<<<<<<<<<<<< + * self._throughput_handle = RfcCreateThroughput(&errorInfo) + * if errorInfo.code != RFC_OK: + */ + __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->_connections); + __Pyx_DECREF(__pyx_v_self->_connections); + __pyx_v_self->_connections = __pyx_t_1; __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":23 - * def default_auth_check(func_name=False, request_context = None): - * request_context = request_context or {} - * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) # <<<<<<<<<<<<<< - * return RFC_OK - * + /* "pyrfc/_cyrfc.pyx":2182 + * self._throughput_handle = NULL + * self._connections = set() + * self._throughput_handle = RfcCreateThroughput(&errorInfo) # <<<<<<<<<<<<<< + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 23, __pyx_L1_error) + __pyx_v_self->_throughput_handle = RfcCreateThroughput((&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2183 + * self._connections = set() + * self._throughput_handle = RfcCreateThroughput(&errorInfo) + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * Throughput._registry.append(self) + */ + __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":2184 + * self._throughput_handle = RfcCreateThroughput(&errorInfo) + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * Throughput._registry.append(self) + * connections = connections or [] + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2184, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2183 + * self._connections = set() + * self._throughput_handle = RfcCreateThroughput(&errorInfo) + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * Throughput._registry.append(self) + */ + } + + /* "pyrfc/_cyrfc.pyx":2185 + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) + * Throughput._registry.append(self) # <<<<<<<<<<<<<< + * connections = connections or [] + * if type(connections) is not list: + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput), __pyx_n_s_registry); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, ((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2185, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2186 + * raise wrapError(&errorInfo) + * Throughput._registry.append(self) + * connections = connections or [] # <<<<<<<<<<<<<< + * if type(connections) is not list: + * connections = [connections] + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_connections); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2186, __pyx_L1_error) + if (!__pyx_t_2) { + } else { + __Pyx_INCREF(__pyx_v_connections); + __pyx_t_1 = __pyx_v_connections; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = 0; - __pyx_t_6 = 127; - __Pyx_INCREF(__pyx_kp_u_authorization_check_for); - __pyx_t_5 += 25; - __Pyx_GIVEREF(__pyx_kp_u_authorization_check_for); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_authorization_check_for); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_5 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__6); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_request_context, __pyx_n_s_server_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_L4_bool_binop_done:; + __Pyx_DECREF_SET(__pyx_v_connections, __pyx_t_1); + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2187 + * Throughput._registry.append(self) + * connections = connections or [] + * if type(connections) is not list: # <<<<<<<<<<<<<< + * connections = [connections] + * for conn in connections: + */ + __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_connections)) != ((PyObject *)(&PyList_Type))); + __pyx_t_5 = (__pyx_t_2 != 0); + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2188 + * connections = connections or [] + * if type(connections) is not list: + * connections = [connections] # <<<<<<<<<<<<<< + * for conn in connections: + * if not isinstance(conn, Connection): + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_7, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_INCREF(__pyx_v_connections); + __Pyx_GIVEREF(__pyx_v_connections); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_connections); + __Pyx_DECREF_SET(__pyx_v_connections, __pyx_t_1); + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2187 + * Throughput._registry.append(self) + * connections = connections or [] + * if type(connections) is not list: # <<<<<<<<<<<<<< + * connections = [connections] + * for conn in connections: + */ + } + + /* "pyrfc/_cyrfc.pyx":2189 + * if type(connections) is not list: + * connections = [connections] + * for conn in connections: # <<<<<<<<<<<<<< + * if not isinstance(conn, Connection): + * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + */ + if (likely(PyList_CheckExact(__pyx_v_connections)) || PyTuple_CheckExact(__pyx_v_connections)) { + __pyx_t_1 = __pyx_v_connections; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_connections); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; + __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2189, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2189, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2189, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_7(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 2189, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); } - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_4); - __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_conn, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":24 - * request_context = request_context or {} - * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) - * return RFC_OK # <<<<<<<<<<<<<< - * + /* "pyrfc/_cyrfc.pyx":2190 + * connections = [connections] + * for conn in connections: + * if not isinstance(conn, Connection): # <<<<<<<<<<<<<< + * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + * self.setOnConnection(conn) + */ + __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_conn, __pyx_ptype_5pyrfc_6_cyrfc_Connection); + __pyx_t_2 = ((!(__pyx_t_5 != 0)) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":2191 + * for conn in connections: + * if not isinstance(conn, Connection): + * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) # <<<<<<<<<<<<<< + * self.setOnConnection(conn) * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_RFC_RC(RFC_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_kp_s_Connection_object_required_recei); + __Pyx_GIVEREF(__pyx_kp_s_Connection_object_required_recei); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Connection_object_required_recei); + __Pyx_INCREF(__pyx_v_conn); + __Pyx_GIVEREF(__pyx_v_conn); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_conn); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_conn))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_conn))); + PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)Py_TYPE(__pyx_v_conn))); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(0, 2191, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2190 + * connections = [connections] + * for conn in connections: + * if not isinstance(conn, Connection): # <<<<<<<<<<<<<< + * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + * self.setOnConnection(conn) + */ + } - /* "src/pyrfc/server.pyx":21 + /* "pyrfc/_cyrfc.pyx":2192 + * if not isinstance(conn, Connection): + * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + * self.setOnConnection(conn) # <<<<<<<<<<<<<< * + * @property + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setOnConnection); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_v_conn) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_conn); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "pyrfc/_cyrfc.pyx":2189 + * if type(connections) is not list: + * connections = [connections] + * for conn in connections: # <<<<<<<<<<<<<< + * if not isinstance(conn, Connection): + * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2178 + * cdef _connections * - * def default_auth_check(func_name=False, request_context = None): # <<<<<<<<<<<<<< - * request_context = request_context or {} - * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) + * def __init__(self, connections = None): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * self._throughput_handle = NULL */ /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("pyrfc._cyrfc.default_auth_check", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_request_context); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_conn); + __Pyx_XDECREF(__pyx_v_connections); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":27 +/* "pyrfc/_cyrfc.pyx":2195 * + * @property + * def connections(self): # <<<<<<<<<<<<<< + * """Get connections attached to throughput monitoring * - * def _server_log(origin, log_message): # <<<<<<<<<<<<<< - * if server_context["server_log"]: - * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_27_server_log(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_27_server_log = {"_server_log", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_27_server_log, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_27_server_log(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_origin = 0; - PyObject *__pyx_v_log_message = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11connections_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11connections_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_server_log (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_origin,&__pyx_n_s_log_message,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_origin)) != 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_log_message)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_server_log", 1, 2, 2, 1); __PYX_ERR(5, 27, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_server_log") < 0)) __PYX_ERR(5, 27, __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_origin = values[0]; - __pyx_v_log_message = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_server_log", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 27, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc._server_log", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_26_server_log(__pyx_self, __pyx_v_origin, __pyx_v_log_message); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_11connections___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_26_server_log(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_origin, PyObject *__pyx_v_log_message) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_11connections___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_UCS4 __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_server_log", 0); - - /* "src/pyrfc/server.pyx":28 - * - * def _server_log(origin, log_message): - * if server_context["server_log"]: # <<<<<<<<<<<<<< - * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_server_log_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 28, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - - /* "src/pyrfc/server.pyx":29 - * def _server_log(origin, log_message): - * if server_context["server_log"]: - * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u__35); - __pyx_t_4 += 1; - __Pyx_GIVEREF(__pyx_kp_u__35); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__35); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_utcnow); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u_UTC); - __pyx_t_4 += 6; - __Pyx_GIVEREF(__pyx_kp_u_UTC); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_UTC); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_origin, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__36); - __pyx_t_4 += 2; - __Pyx_GIVEREF(__pyx_kp_u__36); - PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__36); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_v_log_message, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_4 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_kp_u__6); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 7, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PrintOne(0, __pyx_t_7) < 0) __PYX_ERR(5, 29, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/pyrfc/server.pyx":28 - * - * def _server_log(origin, log_message): - * if server_context["server_log"]: # <<<<<<<<<<<<<< - * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") + /* "pyrfc/_cyrfc.pyx":2201 + * :type: set of Connection + * """ + * return self._connections # <<<<<<<<<<<<<< * + * @property */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->_connections); + __pyx_r = __pyx_v_self->_connections; + goto __pyx_L0; - /* "src/pyrfc/server.pyx":27 + /* "pyrfc/_cyrfc.pyx":2195 * + * @property + * def connections(self): # <<<<<<<<<<<<<< + * """Get connections attached to throughput monitoring * - * def _server_log(origin, log_message): # <<<<<<<<<<<<<< - * if server_context["server_log"]: - * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pyrfc._cyrfc._server_log", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":38 - * cdef public bint rstrip +/* "pyrfc/_cyrfc.pyx":2204 + * + * @property + * def _handle(self): # <<<<<<<<<<<<<< + * """Get throughput object handle * - * def __init__(self, **params): # <<<<<<<<<<<<<< - * self._connection = ConnectionParameters(**params) - * self._handle = NULL */ /* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_params = 0; - int __pyx_r; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7_handle_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7_handle_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 1))) return -1; - __pyx_v_params = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_params)) return -1; - __Pyx_GOTREF(__pyx_v_params); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection___init__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), __pyx_v_params); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_7_handle___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); /* function exit code */ - __Pyx_XDECREF(__pyx_v_params); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection___init__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, PyObject *__pyx_v_params) { - int __pyx_r; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_7_handle___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/pyrfc/server.pyx":39 + /* "pyrfc/_cyrfc.pyx":2210 + * :type: uintptr_t + * """ + * return self._throughput_handle # <<<<<<<<<<<<<< * - * def __init__(self, **params): - * self._connection = ConnectionParameters(**params) # <<<<<<<<<<<<<< - * self._handle = NULL - * self._open() + * def setOnConnection(self, Connection connection): */ - __pyx_t_1 = PyDict_Copy(__pyx_v_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 39, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_throughput_handle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_ConnectionParameters), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->_connection); - __Pyx_DECREF(((PyObject *)__pyx_v_self->_connection)); - __pyx_v_self->_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_ConnectionParameters *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":40 - * def __init__(self, **params): - * self._connection = ConnectionParameters(**params) - * self._handle = NULL # <<<<<<<<<<<<<< - * self._open() - * - */ - __pyx_v_self->_handle = NULL; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/server.pyx":41 - * self._connection = ConnectionParameters(**params) - * self._handle = NULL - * self._open() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2204 * - * cdef _open(self): - */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":38 - * cdef public bint rstrip + * @property + * def _handle(self): # <<<<<<<<<<<<<< + * """Get throughput object handle * - * def __init__(self, **params): # <<<<<<<<<<<<<< - * self._connection = ConnectionParameters(**params) - * self._handle = NULL */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput._handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":43 - * self._open() +/* "pyrfc/_cyrfc.pyx":2212 + * return self._throughput_handle * - * cdef _open(self): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * with nogil: + * def setOnConnection(self, Connection connection): # <<<<<<<<<<<<<< + * """Attaches a throughput object to a connection to be monitored by the throughput object. + * Once attached to a connection, the throughput object collects the data statistics of */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_16ServerConnection__open(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_3setOnConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_2setOnConnection[] = "Attaches a throughput object to a connection to be monitored by the throughput object.\n Once attached to a connection, the throughput object collects the data statistics of\n function calls invoked via this connection.\n\n For more info search for the ``RfcSetThroughputOnConnection`` method in\n `SAP NetWeaver RFC SDK Doxygen Documentation `_\n\n :param connection: Connection instance to be attached to throughput monitoring\n :type connection: Connection\n\n :return: nothing, raises an error\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_3setOnConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("setOnConnection (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_connection), __pyx_ptype_5pyrfc_6_cyrfc_Connection, 1, "connection", 0))) __PYX_ERR(0, 2212, __pyx_L1_error) + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_2setOnConnection(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_connection)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_2setOnConnection(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection) { RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_RC __pyx_v_rc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_open", 0); - - /* "src/pyrfc/server.pyx":45 - * cdef _open(self): - * cdef RFC_ERROR_INFO errorInfo - * with nogil: # <<<<<<<<<<<<<< - * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) - * if errorInfo.code != RFC_OK: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __Pyx_RefNannySetupContext("setOnConnection", 0); - /* "src/pyrfc/server.pyx":46 + /* "pyrfc/_cyrfc.pyx":2226 + * """ * cdef RFC_ERROR_INFO errorInfo - * with nogil: - * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) # <<<<<<<<<<<<<< - * if errorInfo.code != RFC_OK: - * self._handle = NULL + * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_v_self->_handle = RfcCreateServer(__pyx_v_self->_connection->_params, __pyx_v_self->_connection->_params_count, (&__pyx_v_errorInfo)); - } + __pyx_v_rc = RfcSetThroughputOnConnection(__pyx_v_connection->_handle, __pyx_v_self->_throughput_handle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":45 - * cdef _open(self): + /* "pyrfc/_cyrfc.pyx":2227 * cdef RFC_ERROR_INFO errorInfo - * with nogil: # <<<<<<<<<<<<<< - * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) - * if errorInfo.code != RFC_OK: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "src/pyrfc/server.pyx":47 - * with nogil: - * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * self._handle = NULL + * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) + * self._connections.add(connection) */ - __pyx_t_1 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":48 - * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) - * if errorInfo.code != RFC_OK: - * self._handle = NULL # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _server_log("Server connection", f"{self._handle}") - */ - __pyx_v_self->_handle = NULL; - - /* "src/pyrfc/server.pyx":49 - * if errorInfo.code != RFC_OK: - * self._handle = NULL + /* "pyrfc/_cyrfc.pyx":2228 + * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) + * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _server_log("Server connection", f"{self._handle}") + * self._connections.add(connection) * */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 49, __pyx_L1_error) + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(5, 49, __pyx_L1_error) + __PYX_ERR(0, 2228, __pyx_L1_error) - /* "src/pyrfc/server.pyx":47 - * with nogil: - * self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * self._handle = NULL + /* "pyrfc/_cyrfc.pyx":2227 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) + * self._connections.add(connection) */ } - /* "src/pyrfc/server.pyx":50 - * self._handle = NULL + /* "pyrfc/_cyrfc.pyx":2229 + * if rc != RFC_OK: * raise wrapError(&errorInfo) - * _server_log("Server connection", f"{self._handle}") # <<<<<<<<<<<<<< + * self._connections.add(connection) # <<<<<<<<<<<<<< * - * cdef _close(self): + * @staticmethod */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 50, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_connections, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Server_connection, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 50, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_Server_connection, __pyx_t_5}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 50, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; } - __Pyx_INCREF(__pyx_kp_s_Server_connection); - __Pyx_GIVEREF(__pyx_kp_s_Server_connection); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Server_connection); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_connection)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_connection)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":43 - * self._open() + /* "pyrfc/_cyrfc.pyx":2212 + * return self._throughput_handle * - * cdef _open(self): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * with nogil: + * def setOnConnection(self, Connection connection): # <<<<<<<<<<<<<< + * """Attaches a throughput object to a connection to be monitored by the throughput object. + * Once attached to a connection, the throughput object collects the data statistics of */ /* function exit code */ @@ -30002,260 +28440,404 @@ static PyObject *__pyx_f_5pyrfc_6_cyrfc_16ServerConnection__open(struct __pyx_ob __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection._open", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.setOnConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":52 - * _server_log("Server connection", f"{self._handle}") +/* "pyrfc/_cyrfc.pyx":2232 + * + * @staticmethod + * def getFromConnection(Connection connection): # <<<<<<<<<<<<<< + * """Returns the currently attached throughput object from a connection, if any. * - * cdef _close(self): # <<<<<<<<<<<<<< - * if self._handle != NULL: - * _server_log("Server close", self._handle) */ -static PyObject *__pyx_f_5pyrfc_6_cyrfc_16ServerConnection__close(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_4getFromConnection[] = "Returns the currently attached throughput object from a connection, if any.\n\n For more info search for the ``RfcGetThroughputFromConnection`` method in\n `SAP NetWeaver RFC SDK Doxygen Documentation `_\n\n :param connection: Connection instance\n :type connection: Connection\n\n :returns: Throughput object the connection is attached to, if any\n :rtype: Throughput\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error\n "; +static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_10Throughput_5getFromConnection = {"getFromConnection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_4getFromConnection}; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getFromConnection (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_connection,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFromConnection") < 0)) __PYX_ERR(0, 2232, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("getFromConnection", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2232, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.getFromConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_connection), __pyx_ptype_5pyrfc_6_cyrfc_Connection, 1, "connection", 0))) __PYX_ERR(0, 2232, __pyx_L1_error) + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_4getFromConnection(__pyx_v_connection); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_4getFromConnection(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_THROUGHPUT_HANDLE __pyx_v_throughput; + PyObject *__pyx_v_t = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_close", 0); + __Pyx_RefNannySetupContext("getFromConnection", 0); - /* "src/pyrfc/server.pyx":53 - * - * cdef _close(self): - * if self._handle != NULL: # <<<<<<<<<<<<<< - * _server_log("Server close", self._handle) - * with nogil: + /* "pyrfc/_cyrfc.pyx":2247 + * """ + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) # <<<<<<<<<<<<<< + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_1 = ((__pyx_v_self->_handle != NULL) != 0); - if (__pyx_t_1) { + __pyx_v_throughput = RfcGetThroughputFromConnection(__pyx_v_connection->_handle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":54 - * cdef _close(self): - * if self._handle != NULL: - * _server_log("Server close", self._handle) # <<<<<<<<<<<<<< - * with nogil: - * RfcShutdownServer(self._handle, 60, NULL) + /* "pyrfc/_cyrfc.pyx":2248 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for t in Throughput._registry: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pyrfc/_cyrfc.pyx":2249 + * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * for t in Throughput._registry: + * if t._handle == throughput: + */ + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2249, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2248 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) + * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for t in Throughput._registry: + */ + } + + /* "pyrfc/_cyrfc.pyx":2250 + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) + * for t in Throughput._registry: # <<<<<<<<<<<<<< + * if t._handle == throughput: + * return t + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput), __pyx_n_s_registry); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_6 = 1; + } else { + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2250, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2250, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2250, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Server_close, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 54, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_Server_close, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 54, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 2250, __pyx_L1_error) + } + break; } - __Pyx_INCREF(__pyx_kp_s_Server_close); - __Pyx_GIVEREF(__pyx_kp_s_Server_close); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_Server_close); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_2); + __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2251 + * raise wrapError(&errorInfo) + * for t in Throughput._registry: + * if t._handle == throughput: # <<<<<<<<<<<<<< + * return t + * return None + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_handle_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_throughput)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2251, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2251, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_1) { - /* "src/pyrfc/server.pyx":55 - * if self._handle != NULL: - * _server_log("Server close", self._handle) - * with nogil: # <<<<<<<<<<<<<< - * RfcShutdownServer(self._handle, 60, NULL) - * RfcDestroyServer(self._handle, NULL) + /* "pyrfc/_cyrfc.pyx":2252 + * for t in Throughput._registry: + * if t._handle == throughput: + * return t # <<<<<<<<<<<<<< + * return None + * */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_t); + __pyx_r = __pyx_v_t; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/server.pyx":56 - * _server_log("Server close", self._handle) - * with nogil: - * RfcShutdownServer(self._handle, 60, NULL) # <<<<<<<<<<<<<< - * RfcDestroyServer(self._handle, NULL) - * self._handle = NULL + /* "pyrfc/_cyrfc.pyx":2251 + * raise wrapError(&errorInfo) + * for t in Throughput._registry: + * if t._handle == throughput: # <<<<<<<<<<<<<< + * return t + * return None */ - (void)(RfcShutdownServer(__pyx_v_self->_handle, 60, NULL)); + } - /* "src/pyrfc/server.pyx":57 - * with nogil: - * RfcShutdownServer(self._handle, 60, NULL) - * RfcDestroyServer(self._handle, NULL) # <<<<<<<<<<<<<< - * self._handle = NULL + /* "pyrfc/_cyrfc.pyx":2250 + * if errorInfo.code != RFC_OK: + * raise wrapError(&errorInfo) + * for t in Throughput._registry: # <<<<<<<<<<<<<< + * if t._handle == throughput: + * return t + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":2253 + * if t._handle == throughput: + * return t + * return None # <<<<<<<<<<<<<< * + * def removeFromConnection(self, Connection connection): */ - (void)(RfcDestroyServer(__pyx_v_self->_handle, NULL)); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/pyrfc/server.pyx":58 - * RfcShutdownServer(self._handle, 60, NULL) - * RfcDestroyServer(self._handle, NULL) - * self._handle = NULL # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2232 + * + * @staticmethod + * def getFromConnection(Connection connection): # <<<<<<<<<<<<<< + * """Returns the currently attached throughput object from a connection, if any. * - * def open(self): - */ - __pyx_v_self->_handle = NULL; - } - - /* "src/pyrfc/server.pyx":55 - * if self._handle != NULL: - * _server_log("Server close", self._handle) - * with nogil: # <<<<<<<<<<<<<< - * RfcShutdownServer(self._handle, 60, NULL) - * RfcDestroyServer(self._handle, NULL) - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L6; - } - __pyx_L6:; - } - } - - /* "src/pyrfc/server.pyx":53 - * - * cdef _close(self): - * if self._handle != NULL: # <<<<<<<<<<<<<< - * _server_log("Server close", self._handle) - * with nogil: - */ - } - - /* "src/pyrfc/server.pyx":52 - * _server_log("Server connection", f"{self._handle}") - * - * cdef _close(self): # <<<<<<<<<<<<<< - * if self._handle != NULL: - * _server_log("Server close", self._handle) */ /* 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_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection._close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.getFromConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_t); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":60 - * self._handle = NULL - * - * def open(self): # <<<<<<<<<<<<<< - * self._open() +/* "pyrfc/_cyrfc.pyx":2255 + * return None * + * def removeFromConnection(self, Connection connection): # <<<<<<<<<<<<<< + * """Removes the throughput object from a connection. + * The connection will no longer be monitored. */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_3open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_3open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7removeFromConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection[] = "Removes the throughput object from a connection.\n The connection will no longer be monitored.\n\n :param connection: Connection instance\n :type connection: Connection\n :returns: Nothing\n :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7removeFromConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("open (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_2open(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("removeFromConnection (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_connection), __pyx_ptype_5pyrfc_6_cyrfc_Connection, 1, "connection", 0))) __PYX_ERR(0, 2255, __pyx_L1_error) + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_connection)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_2open(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_RC __pyx_v_rc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("open", 0); + __Pyx_RefNannySetupContext("removeFromConnection", 0); - /* "src/pyrfc/server.pyx":61 - * - * def open(self): - * self._open() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2265 + * """ + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_v_rc = RfcRemoveThroughputFromConnection(__pyx_v_connection->_handle, (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2266 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * self._connections.remove(connection) + */ + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pyrfc/_cyrfc.pyx":2267 + * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * self._connections.remove(connection) * - * def close(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2267, __pyx_L1_error) - /* "src/pyrfc/server.pyx":60 - * self._handle = NULL + /* "pyrfc/_cyrfc.pyx":2266 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * self._connections.remove(connection) + */ + } + + /* "pyrfc/_cyrfc.pyx":2268 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * self._connections.remove(connection) # <<<<<<<<<<<<<< * - * def open(self): # <<<<<<<<<<<<<< - * self._open() + * def reset(self): + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_connections, __pyx_n_s_remove); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_connection)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_connection)); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2255 + * return None * + * def removeFromConnection(self, Connection connection): # <<<<<<<<<<<<<< + * """Removes the throughput object from a connection. + * The connection will no longer be monitored. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.removeFromConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30263,279 +28845,259 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_2open(struct __pyx_o return __pyx_r; } -/* "src/pyrfc/server.pyx":63 - * self._open() +/* "pyrfc/_cyrfc.pyx":2270 + * self._connections.remove(connection) * - * def close(self): # <<<<<<<<<<<<<< - * self._close() + * def reset(self): # <<<<<<<<<<<<<< + * """Resets the data so far collected and aggregated by the throughput object. * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_9reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_8reset[] = "Resets the data so far collected and aggregated by the throughput object.\n\n :returns: Nothing\n :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error\n "; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_9reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_4close(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_8reset(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_4close(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_8reset(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_RC __pyx_v_rc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("close", 0); + __Pyx_RefNannySetupContext("reset", 0); - /* "src/pyrfc/server.pyx":64 - * - * def close(self): - * self._close() # <<<<<<<<<<<<<< - * - * def __bool__(self): + /* "pyrfc/_cyrfc.pyx":2277 + * """ + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_rc = RfcResetThroughput(__pyx_v_self->_throughput_handle, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":63 - * self._open() - * - * def close(self): # <<<<<<<<<<<<<< - * self._close() + /* "pyrfc/_cyrfc.pyx":2278 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) * */ + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":66 - * self._close() - * - * def __bool__(self): # <<<<<<<<<<<<<< - * return self.alive + /* "pyrfc/_cyrfc.pyx":2279 + * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< * + * cdef _destroy(self): */ + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2279, __pyx_L1_error) -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_7__bool__(PyObject *__pyx_v_self); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_7__bool__(PyObject *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6__bool__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6__bool__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__bool__", 0); - - /* "src/pyrfc/server.pyx":67 - * - * def __bool__(self): - * return self.alive # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2278 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) * - * @property */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_alive); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 67, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - goto __pyx_L0; + } - /* "src/pyrfc/server.pyx":66 - * self._close() + /* "pyrfc/_cyrfc.pyx":2270 + * self._connections.remove(connection) * - * def __bool__(self): # <<<<<<<<<<<<<< - * return self.alive + * def reset(self): # <<<<<<<<<<<<<< + * """Resets the data so far collected and aggregated by the throughput object. * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":70 - * - * @property - * def handle(self): # <<<<<<<<<<<<<< - * """Server connection handle +/* "pyrfc/_cyrfc.pyx":2281 + * raise wrapError(&errorInfo) * + * cdef _destroy(self): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6handle_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6handle_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6handle___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6handle___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Throughput__destroy(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_RC __pyx_v_rc; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("_destroy", 0); - /* "src/pyrfc/server.pyx":76 - * :type: uitptr_t - * """ - * return self._handle # <<<<<<<<<<<<<< - * - * @property + /* "pyrfc/_cyrfc.pyx":2284 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc + * self._registry.clear() # <<<<<<<<<<<<<< + * self._connections = None + * if self._throughput_handle != NULL: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_handle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 76, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_registry); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":70 - * - * @property - * def handle(self): # <<<<<<<<<<<<<< - * """Server connection handle - * + /* "pyrfc/_cyrfc.pyx":2285 + * cdef RFC_RC rc + * self._registry.clear() + * self._connections = None # <<<<<<<<<<<<<< + * if self._throughput_handle != NULL: + * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->_connections); + __Pyx_DECREF(__pyx_v_self->_connections); + __pyx_v_self->_connections = Py_None; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":79 - * - * @property - * def alive(self): # <<<<<<<<<<<<<< - * """Conection alive property - * + /* "pyrfc/_cyrfc.pyx":2286 + * self._registry.clear() + * self._connections = None + * if self._throughput_handle != NULL: # <<<<<<<<<<<<<< + * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) + * self._throughput_handle = NULL */ + __pyx_t_4 = ((__pyx_v_self->_throughput_handle != NULL) != 0); + if (__pyx_t_4) { -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5alive_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5alive_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5alive___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + /* "pyrfc/_cyrfc.pyx":2287 + * self._connections = None + * if self._throughput_handle != NULL: + * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) # <<<<<<<<<<<<<< + * self._throughput_handle = NULL + * if rc != RFC_OK: + */ + __pyx_v_rc = RfcDestroyThroughput(__pyx_v_self->_throughput_handle, (&__pyx_v_errorInfo)); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2288 + * if self._throughput_handle != NULL: + * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) + * self._throughput_handle = NULL # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * # is ok + */ + __pyx_v_self->_throughput_handle = NULL; -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5alive___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "pyrfc/_cyrfc.pyx":2289 + * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) + * self._throughput_handle = NULL + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * # is ok + * pass + */ + __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); + if (__pyx_t_4) { + } - /* "src/pyrfc/server.pyx":85 - * :type: boolean - * """ - * return self._handle != NULL # <<<<<<<<<<<<<< - * - * def __del__(self): + /* "pyrfc/_cyrfc.pyx":2286 + * self._registry.clear() + * self._connections = None + * if self._throughput_handle != NULL: # <<<<<<<<<<<<<< + * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) + * self._throughput_handle = NULL */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->_handle != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + } - /* "src/pyrfc/server.pyx":79 - * - * @property - * def alive(self): # <<<<<<<<<<<<<< - * """Conection alive property + /* "pyrfc/_cyrfc.pyx":2281 + * raise wrapError(&errorInfo) * + * cdef _destroy(self): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_RC rc */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.alive.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput._destroy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":87 - * return self._handle != NULL +/* "pyrfc/_cyrfc.pyx":2293 + * pass * * def __del__(self): # <<<<<<<<<<<<<< - * self._close() - * self._connection._free() + * self.destroy() + * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_9__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_9__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_10__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_10__del__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -30546,25 +29108,14 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__del__", 0); - /* "src/pyrfc/server.pyx":88 - * - * def __del__(self): - * self._close() # <<<<<<<<<<<<<< - * self._connection._free() + /* "pyrfc/_cyrfc.pyx":2294 * - */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/server.pyx":89 * def __del__(self): - * self._close() - * self._connection._free() # <<<<<<<<<<<<<< + * self.destroy() # <<<<<<<<<<<<<< * - * cdef RFC_RC metadataLookup( + * def __exit__(self, type, value, traceback): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_connection), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 89, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -30578,17 +29129,17 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(struct __py } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 89, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":87 - * return self._handle != NULL + /* "pyrfc/_cyrfc.pyx":2293 + * pass * * def __del__(self): # <<<<<<<<<<<<<< - * self._close() - * self._connection._free() + * self.destroy() + * */ /* function exit code */ @@ -30598,7 +29149,7 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(struct __py __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30606,128 +29157,123 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_8__del__(struct __py return __pyx_r; } -/* "src/pyrfc/server.pyx":35 - * cdef ConnectionParameters _connection - * cdef RFC_SERVER_HANDLE _handle - * cdef public bint debug # <<<<<<<<<<<<<< - * cdef public bint rstrip +/* "pyrfc/_cyrfc.pyx":2296 + * self.destroy() + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self._destroy() * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_13__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_13__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v_type = 0; + CYTHON_UNUSED PyObject *__pyx_v_value = 0; + CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.debug.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; + PyObject* values[3] = {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 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_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_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 2296, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 2296, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 2296, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + 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); + } + __pyx_v_type = values[0]; + __pyx_v_value = values[1]; + __pyx_v_traceback = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2296, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_12__exit__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_5debug_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_12__exit__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 35, __pyx_L1_error) - __pyx_v_self->debug = __pyx_t_1; - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.debug.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __Pyx_RefNannySetupContext("__exit__", 0); -/* "src/pyrfc/server.pyx":36 - * cdef RFC_SERVER_HANDLE _handle - * cdef public bint debug - * cdef public bint rstrip # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2297 * - * def __init__(self, **params): + * def __exit__(self, type, value, traceback): + * self._destroy() # <<<<<<<<<<<<<< + * + * def __enter__(self): */ + __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self->__pyx_vtab)->_destroy(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2297, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + /* "pyrfc/_cyrfc.pyx":2296 + * self.destroy() + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * self._destroy() + * + */ /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip___get__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - - /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.rstrip.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -30735,11190 +29281,10886 @@ static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip___get__(stru return __pyx_r; } -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_6rstrip_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 36, __pyx_L1_error) - __pyx_v_self->rstrip = __pyx_t_1; - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.rstrip.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("self._handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): +/* "pyrfc/_cyrfc.pyx":2299 + * self._destroy() + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_11__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_10__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self)); + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_14__enter__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_14__enter__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("__enter__", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("self._handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("self._handle cannot be converted to a Python object for pickling") + /* "pyrfc/_cyrfc.pyx":2300 + * + * def __enter__(self): + * return self # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 2, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("self._handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): + /* "pyrfc/_cyrfc.pyx":2299 + * self._destroy() + * + * def __enter__(self): # <<<<<<<<<<<<<< + * return self + * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("self._handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("self._handle cannot be converted to a Python object for pickling") +/* "pyrfc/_cyrfc.pyx":2303 + * + * @property + * def stats(self): # <<<<<<<<<<<<<< + * """Get throughput monitor statistics + * */ /* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_16ServerConnection_13__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5stats_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5stats_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_12__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_5stats___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_16ServerConnection_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_5stats___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_RC __pyx_v_rc; + SAP_ULLONG __pyx_v_numberOfCalls; + SAP_ULLONG __pyx_v_sentBytes; + SAP_ULLONG __pyx_v_receivedBytes; + SAP_ULLONG __pyx_v_applicationTime; + SAP_ULLONG __pyx_v_totalTime; + SAP_ULLONG __pyx_v_serializationTime; + SAP_ULLONG __pyx_v_deserializationTime; + PyObject *__pyx_v__stats = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("self._handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("self._handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("self._handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("self._handle cannot be converted to a Python object for pickling") - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.ServerConnection.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":91 - * self._connection._free() - * - * cdef RFC_RC metadataLookup( # <<<<<<<<<<<<<< - * const SAP_UC* functionName, - * RFC_ATTRIBUTES rfcAttributes, - */ - -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_metadataLookup(SAP_UC const *__pyx_v_functionName, CYTHON_UNUSED RFC_ATTRIBUTES __pyx_v_rfcAttributes, RFC_FUNCTION_DESC_HANDLE *__pyx_v_funcDescHandle) { - PyObject *__pyx_v_function_name = NULL; - PyObject *__pyx_v_func_metadata = NULL; - RFC_RC __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - Py_UCS4 __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - uintptr_t __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("metadataLookup", 0); + __Pyx_RefNannySetupContext("__get__", 0); - /* "src/pyrfc/server.pyx":97 - * ) with gil: - * global server_functions - * function_name = wrapString(functionName) # <<<<<<<<<<<<<< - * if function_name not in server_functions: - * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") + /* "pyrfc/_cyrfc.pyx":2327 + * cdef SAP_ULLONG deserializationTime + * + * _stats = {} # <<<<<<<<<<<<<< + * + * if self._throughput_handle == NULL: */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_functionName, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 97, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2327, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_function_name = __pyx_t_1; + __pyx_v__stats = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":98 - * global server_functions - * function_name = wrapString(functionName) - * if function_name not in server_functions: # <<<<<<<<<<<<<< - * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") - * return RFC_NOT_FOUND + /* "pyrfc/_cyrfc.pyx":2329 + * _stats = {} + * + * if self._throughput_handle == NULL: # <<<<<<<<<<<<<< + * raise RFCError('No connections assigned') + * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_function_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 98, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_2 = ((__pyx_v_self->_throughput_handle == NULL) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/server.pyx":99 - * function_name = wrapString(functionName) - * if function_name not in server_functions: - * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") # <<<<<<<<<<<<<< - * return RFC_NOT_FOUND - * func_metadata = server_functions[function_name] + /* "pyrfc/_cyrfc.pyx":2330 + * + * if self._throughput_handle == NULL: + * raise RFCError('No connections assigned') # <<<<<<<<<<<<<< + * + * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_server_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = 0; - __pyx_t_7 = 127; - __Pyx_INCREF(__pyx_kp_u_No_metadata_found_for_function); - __pyx_t_6 += 32; - __Pyx_GIVEREF(__pyx_kp_u_No_metadata_found_for_function); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_No_metadata_found_for_function); - __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_function_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7; - __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_kp_u__39); - __pyx_t_6 += 2; - __Pyx_GIVEREF(__pyx_kp_u__39); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__39); - __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_metadataLookup, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_metadataLookup, __pyx_t_8}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_DECREF_SET(__pyx_t_3, function); } - __Pyx_INCREF(__pyx_n_s_metadataLookup); - __Pyx_GIVEREF(__pyx_n_s_metadataLookup); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_n_s_metadataLookup); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_connections_assigned) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_connections_assigned); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2330, __pyx_L1_error) - /* "src/pyrfc/server.pyx":100 - * if function_name not in server_functions: - * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") - * return RFC_NOT_FOUND # <<<<<<<<<<<<<< - * func_metadata = server_functions[function_name] - * # callback = func_metadata['callback'] + /* "pyrfc/_cyrfc.pyx":2329 + * _stats = {} + * + * if self._throughput_handle == NULL: # <<<<<<<<<<<<<< + * raise RFCError('No connections assigned') + * */ - __pyx_r = RFC_NOT_FOUND; - goto __pyx_L0; + } - /* "src/pyrfc/server.pyx":98 - * global server_functions - * function_name = wrapString(functionName) - * if function_name not in server_functions: # <<<<<<<<<<<<<< - * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") - * return RFC_NOT_FOUND + /* "pyrfc/_cyrfc.pyx":2332 + * raise RFCError('No connections assigned') + * + * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_v_rc = RfcGetNumberOfCalls(__pyx_v_self->_throughput_handle, (&__pyx_v_numberOfCalls), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2333 + * + * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['numberOfCalls'] = numberOfCalls + */ + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":2334 + * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _stats['numberOfCalls'] = numberOfCalls + * + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2334, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2333 + * + * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['numberOfCalls'] = numberOfCalls */ } - /* "src/pyrfc/server.pyx":101 - * _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") - * return RFC_NOT_FOUND - * func_metadata = server_functions[function_name] # <<<<<<<<<<<<<< - * # callback = func_metadata['callback'] - * funcDescHandle[0] = func_metadata['func_desc_handle'] + /* "pyrfc/_cyrfc.pyx":2335 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * _stats['numberOfCalls'] = numberOfCalls # <<<<<<<<<<<<<< + * + * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 101, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_numberOfCalls); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2335, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_function_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_numberOfCalls, __pyx_t_1) < 0)) __PYX_ERR(0, 2335, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_func_metadata = __pyx_t_4; - __pyx_t_4 = 0; - /* "src/pyrfc/server.pyx":103 - * func_metadata = server_functions[function_name] - * # callback = func_metadata['callback'] - * funcDescHandle[0] = func_metadata['func_desc_handle'] # <<<<<<<<<<<<<< - * _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") - * return RFC_OK + /* "pyrfc/_cyrfc.pyx":2337 + * _stats['numberOfCalls'] = numberOfCalls + * + * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_metadata, __pyx_n_s_func_desc_handle); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_11 == ((uintptr_t)-1)) && PyErr_Occurred())) __PYX_ERR(5, 103, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - (__pyx_v_funcDescHandle[0]) = ((RFC_FUNCTION_DESC_HANDLE)((uintptr_t)__pyx_t_11)); + __pyx_v_rc = RfcGetSentBytes(__pyx_v_self->_throughput_handle, (&__pyx_v_sentBytes), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":104 - * # callback = func_metadata['callback'] - * funcDescHandle[0] = func_metadata['func_desc_handle'] - * _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") # <<<<<<<<<<<<<< - * return RFC_OK + /* "pyrfc/_cyrfc.pyx":2338 * + * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['sentBytes'] = sentBytes + */ + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":2339 + * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _stats['sentBytes'] = sentBytes + * + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2339, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2338 + * + * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['sentBytes'] = sentBytes */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_6 = 0; - __pyx_t_7 = 127; - __Pyx_INCREF(__pyx_kp_u_Function); - __pyx_t_6 += 10; - __Pyx_GIVEREF(__pyx_kp_u_Function); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_u_Function); - __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_function_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_7; - __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_kp_u_handle_2); - __pyx_t_6 += 9; - __Pyx_GIVEREF(__pyx_kp_u_handle_2); - PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_kp_u_handle_2); - __pyx_t_8 = __Pyx_PyInt_FromSize_t(((uintptr_t)(__pyx_v_funcDescHandle[0]))); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_7; - __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_INCREF(__pyx_kp_u__8); - __pyx_t_6 += 1; - __Pyx_GIVEREF(__pyx_kp_u__8); - PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_kp_u__8); - __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_10, 5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_n_s_metadataLookup, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_n_s_metadataLookup, __pyx_t_5}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_INCREF(__pyx_n_s_metadataLookup); - __Pyx_GIVEREF(__pyx_n_s_metadataLookup); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_n_s_metadataLookup); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } + + /* "pyrfc/_cyrfc.pyx":2340 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * _stats['sentBytes'] = sentBytes # <<<<<<<<<<<<<< + * + * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) + */ + __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_sentBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_sentBytes, __pyx_t_1) < 0)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/server.pyx":105 - * funcDescHandle[0] = func_metadata['func_desc_handle'] - * _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") - * return RFC_OK # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2342 + * _stats['sentBytes'] = sentBytes * - * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): + * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_r = RFC_OK; - goto __pyx_L0; + __pyx_v_rc = RfcGetReceivedBytes(__pyx_v_self->_throughput_handle, (&__pyx_v_receivedBytes), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":91 - * self._connection._free() + /* "pyrfc/_cyrfc.pyx":2343 * - * cdef RFC_RC metadataLookup( # <<<<<<<<<<<<<< - * const SAP_UC* functionName, - * RFC_ATTRIBUTES rfcAttributes, + * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['receivedBytes'] = receivedBytes */ + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_WriteUnraisable("pyrfc._cyrfc.metadataLookup", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (RFC_RC) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_function_name); - __Pyx_XDECREF(__pyx_v_func_metadata); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2344 + * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _stats['receivedBytes'] = receivedBytes + * + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2344, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2344, __pyx_L1_error) -/* "src/pyrfc/server.pyx":107 - * return RFC_OK + /* "pyrfc/_cyrfc.pyx":2343 * - * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): # <<<<<<<<<<<<<< - * cdef RFC_SERVER_CONTEXT context - * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) + * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['receivedBytes'] = receivedBytes */ + } -static PyObject *__pyx_f_5pyrfc_6_cyrfc_get_server_context(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_ERROR_INFO *__pyx_v_serverErrorInfo) { - RFC_SERVER_CONTEXT __pyx_v_context; - RFC_RC __pyx_v_rc; - PyObject *__pyx_v_server_context = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_server_context", 0); + /* "pyrfc/_cyrfc.pyx":2345 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * _stats['receivedBytes'] = receivedBytes # <<<<<<<<<<<<<< + * + * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) + */ + __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_receivedBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_receivedBytes, __pyx_t_1) < 0)) __PYX_ERR(0, 2345, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":109 - * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): - * cdef RFC_SERVER_CONTEXT context - * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: - * return None + /* "pyrfc/_cyrfc.pyx":2347 + * _stats['receivedBytes'] = receivedBytes + * + * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_v_rc = RfcGetServerContext(__pyx_v_rfcHandle, (&__pyx_v_context), __pyx_v_serverErrorInfo); + __pyx_v_rc = RfcGetApplicationTime(__pyx_v_self->_throughput_handle, (&__pyx_v_applicationTime), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":110 - * cdef RFC_SERVER_CONTEXT context - * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) - * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * return None + /* "pyrfc/_cyrfc.pyx":2348 * + * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['applicationTime'] = applicationTime */ __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_serverErrorInfo->code != RFC_OK) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (__pyx_t_1) { + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/server.pyx":111 - * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) - * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: - * return None # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2349 + * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _stats['applicationTime'] = applicationTime * - * server_context = { */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2349, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2349, __pyx_L1_error) - /* "src/pyrfc/server.pyx":110 - * cdef RFC_SERVER_CONTEXT context - * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) - * if rc != RFC_OK or serverErrorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * return None + /* "pyrfc/_cyrfc.pyx":2348 * + * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['applicationTime'] = applicationTime */ } - /* "src/pyrfc/server.pyx":114 + /* "pyrfc/_cyrfc.pyx":2350 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * _stats['applicationTime'] = applicationTime # <<<<<<<<<<<<<< * - * server_context = { - * "call_type": UnitCallType(context.type), # <<<<<<<<<<<<<< - * "is_stateful": context.isStateful != 0 - * } + * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) + */ + __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_applicationTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2350, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_applicationTime, __pyx_t_1) < 0)) __PYX_ERR(0, 2350, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2352 + * _stats['applicationTime'] = applicationTime + * + * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_v_rc = RfcGetTotalTime(__pyx_v_self->_throughput_handle, (&__pyx_v_totalTime), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2353 + * + * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['totalTime'] = totalTime + */ + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":2354 + * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _stats['totalTime'] = totalTime + * + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2354, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2354, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2353 + * + * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['totalTime'] = totalTime */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_UnitCallType); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_RFC_CALL_TYPE(__pyx_v_context.type); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_call_type, __pyx_t_4) < 0) __PYX_ERR(5, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/server.pyx":115 - * server_context = { - * "call_type": UnitCallType(context.type), - * "is_stateful": context.isStateful != 0 # <<<<<<<<<<<<<< - * } - * if context.type != RFC_SYNCHRONOUS: + /* "pyrfc/_cyrfc.pyx":2355 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * _stats['totalTime'] = totalTime # <<<<<<<<<<<<<< + * + * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) */ - __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_context.isStateful != 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_is_stateful, __pyx_t_4) < 0) __PYX_ERR(5, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_server_context = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_totalTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2355, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_totalTime, __pyx_t_1) < 0)) __PYX_ERR(0, 2355, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":117 - * "is_stateful": context.isStateful != 0 - * } - * if context.type != RFC_SYNCHRONOUS: # <<<<<<<<<<<<<< - * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) - * if context.type == RFC_BACKGROUND_UNIT: + /* "pyrfc/_cyrfc.pyx":2357 + * _stats['totalTime'] = totalTime + * + * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_1 = ((__pyx_v_context.type != RFC_SYNCHRONOUS) != 0); - if (__pyx_t_1) { + __pyx_v_rc = RfcGetSerializationTime(__pyx_v_self->_throughput_handle, (&__pyx_v_serializationTime), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":118 - * } - * if context.type != RFC_SYNCHRONOUS: - * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) # <<<<<<<<<<<<<< - * if context.type == RFC_BACKGROUND_UNIT: - * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + /* "pyrfc/_cyrfc.pyx":2358 + * + * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['serializationTime'] = serializationTime */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_context.unitIdentifier[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyDict_SetItem(__pyx_v_server_context, __pyx_n_s_unit_identifier, __pyx_t_3) < 0)) __PYX_ERR(5, 118, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/server.pyx":117 - * "is_stateful": context.isStateful != 0 - * } - * if context.type != RFC_SYNCHRONOUS: # <<<<<<<<<<<<<< - * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) - * if context.type == RFC_BACKGROUND_UNIT: + /* "pyrfc/_cyrfc.pyx":2359 + * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _stats['serializationTime'] = serializationTime + * + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2359, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2359, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2358 + * + * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['serializationTime'] = serializationTime */ } - /* "src/pyrfc/server.pyx":119 - * if context.type != RFC_SYNCHRONOUS: - * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) - * if context.type == RFC_BACKGROUND_UNIT: # <<<<<<<<<<<<<< - * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + /* "pyrfc/_cyrfc.pyx":2360 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * _stats['serializationTime'] = serializationTime # <<<<<<<<<<<<<< * + * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) */ - __pyx_t_1 = ((__pyx_v_context.type == RFC_BACKGROUND_UNIT) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_serializationTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_serializationTime, __pyx_t_1) < 0)) __PYX_ERR(0, 2360, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":120 - * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) - * if context.type == RFC_BACKGROUND_UNIT: - * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2362 + * _stats['serializationTime'] = serializationTime * - * return server_context + * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitAttributes(__pyx_v_context.unitAttributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyDict_SetItem(__pyx_v_server_context, __pyx_n_s_unit_attributes, __pyx_t_3) < 0)) __PYX_ERR(5, 120, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_rc = RfcGetDeserializationTime(__pyx_v_self->_throughput_handle, (&__pyx_v_deserializationTime), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":119 - * if context.type != RFC_SYNCHRONOUS: - * server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) - * if context.type == RFC_BACKGROUND_UNIT: # <<<<<<<<<<<<<< - * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + /* "pyrfc/_cyrfc.pyx":2363 + * + * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['deserializationTime'] = deserializationTime + */ + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { + + /* "pyrfc/_cyrfc.pyx":2364 + * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * _stats['deserializationTime'] = deserializationTime + * + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2364, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2363 * + * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * _stats['deserializationTime'] = deserializationTime */ } - /* "src/pyrfc/server.pyx":122 - * server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + /* "pyrfc/_cyrfc.pyx":2365 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * _stats['deserializationTime'] = deserializationTime # <<<<<<<<<<<<<< + * + * return _stats + */ + __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_deserializationTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2365, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_deserializationTime, __pyx_t_1) < 0)) __PYX_ERR(0, 2365, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2367 + * _stats['deserializationTime'] = deserializationTime + * + * return _stats # <<<<<<<<<<<<<< * - * return server_context # <<<<<<<<<<<<<< * - * cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_server_context); - __pyx_r = __pyx_v_server_context; + __Pyx_INCREF(__pyx_v__stats); + __pyx_r = __pyx_v__stats; goto __pyx_L0; - /* "src/pyrfc/server.pyx":107 - * return RFC_OK + /* "pyrfc/_cyrfc.pyx":2303 + * + * @property + * def stats(self): # <<<<<<<<<<<<<< + * """Get throughput monitor statistics * - * cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): # <<<<<<<<<<<<<< - * cdef RFC_SERVER_CONTEXT context - * cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pyrfc._cyrfc.get_server_context", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.stats.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_server_context); + __Pyx_XDECREF(__pyx_v__stats); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":124 - * return server_context - * - * cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): */ -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_genericHandler(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_FUNCTION_HANDLE __pyx_v_funcHandle, RFC_ERROR_INFO *__pyx_v_serverErrorInfo) { - RFC_RC __pyx_v_rc; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_ATTRIBUTES __pyx_v_attributes; - RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; - RFC_ABAP_NAME __pyx_v_funcName; - PyObject *__pyx_v_context = NULL; - PyObject *__pyx_v_err_msg = NULL; - PyObject *__pyx_v_new_error = NULL; - PyObject *__pyx_v_func_name = NULL; - PyObject *__pyx_v_func_data = NULL; - PyObject *__pyx_v_callback = NULL; - PyObject *__pyx_v_server = NULL; - PyObject *__pyx_v_conn_attr = NULL; - PyObject *__pyx_v_request_context = NULL; - PyObject *__pyx_v_auth_function = NULL; - PyObject *__pyx_v_func_handle_variables = NULL; - PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_e = NULL; - CYTHON_UNUSED PyObject *__pyx_v_ex = NULL; - PyObject *__pyx_v_exctype = NULL; - RFC_RC __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_16__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_UCS4 __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - RFC_RC __pyx_t_14; - Py_ssize_t __pyx_t_15; - int __pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - char const *__pyx_t_20; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - PyObject *__pyx_t_25 = NULL; - PyObject *__pyx_t_26 = NULL; - char const *__pyx_t_27; - char const *__pyx_t_28; - PyObject *(*__pyx_t_29)(PyObject *); - char const *__pyx_t_30; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("genericHandler", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "src/pyrfc/server.pyx":134 - * - * # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 - * context = get_server_context(rfcHandle, serverErrorInfo) # <<<<<<<<<<<<<< - * if context is None: - * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_get_server_context(__pyx_v_rfcHandle, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 134, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_context = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) - /* "src/pyrfc/server.pyx":135 - * # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 - * context = get_server_context(rfcHandle, serverErrorInfo) - * if context is None: # <<<<<<<<<<<<<< - * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" - * new_error = ExternalRuntimeError( + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): */ - __pyx_t_2 = (__pyx_v_context == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - /* "src/pyrfc/server.pyx":136 - * context = get_server_context(rfcHandle, serverErrorInfo) - * if context is None: - * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" # <<<<<<<<<<<<<< - * new_error = ExternalRuntimeError( - * message=err_msg, + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") */ - __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Error_code); - __pyx_t_4 += 11; - __Pyx_GIVEREF(__pyx_kp_u_Error_code); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Error_code); - __pyx_t_6 = __Pyx_PyUnicode_From_RFC_RC(__pyx_v_serverErrorInfo->code, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u_when_getting_server_context_for); - __pyx_t_4 += 45; - __Pyx_GIVEREF(__pyx_kp_u_when_getting_server_context_for); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_when_getting_server_context_for); - __pyx_t_6 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_4 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__6); - __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_err_msg = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":137 - * if context is None: - * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" - * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< - * message=err_msg, - * code=RFC_EXTERNAL_FAILURE +/* Python wrapper */ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_18__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) - /* "src/pyrfc/server.pyx":138 - * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" - * new_error = ExternalRuntimeError( - * message=err_msg, # <<<<<<<<<<<<<< - * code=RFC_EXTERNAL_FAILURE - * ) + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_message, __pyx_v_err_msg) < 0) __PYX_ERR(5, 138, __pyx_L1_error) - /* "src/pyrfc/server.pyx":139 - * new_error = ExternalRuntimeError( - * message=err_msg, - * code=RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< - * ) - * fillError(new_error, serverErrorInfo) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2374 + * ################################################################################ + * + * cdef fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_FUNCTION_HANDLE container, name, value): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_6 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_code, __pyx_t_6) < 0) __PYX_ERR(5, 138, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/server.pyx":137 - * if context is None: - * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" - * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< - * message=err_msg, - * code=RFC_EXTERNAL_FAILURE +static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc, RFC_FUNCTION_HANDLE __pyx_v_container, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_PARAMETER_DESC __pyx_v_paramDesc; + SAP_UC *__pyx_v_cName; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + SAP_UC *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillFunctionParameter", 0); + + /* "pyrfc/_cyrfc.pyx":2378 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_PARAMETER_DESC paramDesc + * cName = fillString(name) # <<<<<<<<<<<<<< + * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) + * free(cName) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_new_error = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2378, __pyx_L1_error) + __pyx_v_cName = __pyx_t_1; - /* "src/pyrfc/server.pyx":141 - * code=RFC_EXTERNAL_FAILURE - * ) - * fillError(new_error, serverErrorInfo) # <<<<<<<<<<<<<< - * return RFC_EXTERNAL_FAILURE - * + /* "pyrfc/_cyrfc.pyx":2379 + * cdef RFC_PARAMETER_DESC paramDesc + * cName = fillString(name) + * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) # <<<<<<<<<<<<<< + * free(cName) + * if rc != RFC_OK: */ - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_new_error, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_rc = RfcGetParameterDescByName(__pyx_v_funcDesc, __pyx_v_cName, (&__pyx_v_paramDesc), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":142 - * ) - * fillError(new_error, serverErrorInfo) - * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< - * - * funcDesc = RfcDescribeFunction(funcHandle, NULL) + /* "pyrfc/_cyrfc.pyx":2380 + * cName = fillString(name) + * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) + * free(cName) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_r = RFC_EXTERNAL_FAILURE; - goto __pyx_L0; + free(__pyx_v_cName); - /* "src/pyrfc/server.pyx":135 - * # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 - * context = get_server_context(rfcHandle, serverErrorInfo) - * if context is None: # <<<<<<<<<<<<<< - * err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" - * new_error = ExternalRuntimeError( + /* "pyrfc/_cyrfc.pyx":2381 + * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) + * free(cName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) */ - } + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/server.pyx":144 - * return RFC_EXTERNAL_FAILURE - * - * funcDesc = RfcDescribeFunction(funcHandle, NULL) # <<<<<<<<<<<<<< - * RfcGetFunctionName(funcDesc, funcName, NULL) + /* "pyrfc/_cyrfc.pyx":2382 + * free(cName) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) * */ - __pyx_v_funcDesc = RfcDescribeFunction(__pyx_v_funcHandle, NULL); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2382, __pyx_L1_error) - /* "src/pyrfc/server.pyx":145 - * - * funcDesc = RfcDescribeFunction(funcHandle, NULL) - * RfcGetFunctionName(funcDesc, funcName, NULL) # <<<<<<<<<<<<<< - * - * func_name = wrapString(funcName) + /* "pyrfc/_cyrfc.pyx":2381 + * rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) + * free(cName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) */ - (void)(RfcGetFunctionName(__pyx_v_funcDesc, __pyx_v_funcName, NULL)); + } - /* "src/pyrfc/server.pyx":147 - * RfcGetFunctionName(funcDesc, funcName, NULL) + /* "pyrfc/_cyrfc.pyx":2383 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) # <<<<<<<<<<<<<< * - * func_name = wrapString(funcName) # <<<<<<<<<<<<<< - * if func_name not in server_functions: - * _server_log("genericHandler", f"No metadata found for function '{function_name}'") + * cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): */ - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_funcName, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_func_name = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillVariable(__pyx_v_paramDesc.type, __pyx_v_container, __pyx_v_paramDesc.name, __pyx_v_value, __pyx_v_paramDesc.typeDescHandle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":148 + /* "pyrfc/_cyrfc.pyx":2374 + * ################################################################################ * - * func_name = wrapString(funcName) - * if func_name not in server_functions: # <<<<<<<<<<<<<< - * _server_log("genericHandler", f"No metadata found for function '{function_name}'") - * return RFC_NOT_FOUND + * cdef fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_FUNCTION_HANDLE container, name, value): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_func_name, __pyx_t_6, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - /* "src/pyrfc/server.pyx":149 - * func_name = wrapString(funcName) - * if func_name not in server_functions: - * _server_log("genericHandler", f"No metadata found for function '{function_name}'") # <<<<<<<<<<<<<< - * return RFC_NOT_FOUND + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.fillFunctionParameter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2385 + * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) * + * cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_No_metadata_found_for_function); - __pyx_t_4 += 32; - __Pyx_GIVEREF(__pyx_kp_u_No_metadata_found_for_function); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_No_metadata_found_for_function); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_function_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_t_8, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_4 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__6); - __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_genericHandler, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_s_genericHandler, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_n_s_genericHandler); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/server.pyx":150 - * if func_name not in server_functions: - * _server_log("genericHandler", f"No metadata found for function '{function_name}'") - * return RFC_NOT_FOUND # <<<<<<<<<<<<<< - * - * func_data = server_functions[func_name] +static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillStructureField(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_STRUCTURE_HANDLE __pyx_v_container, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_FIELD_DESC __pyx_v_fieldDesc; + SAP_UC *__pyx_v_cName; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + SAP_UC *__pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillStructureField", 0); + + /* "pyrfc/_cyrfc.pyx":2389 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_FIELD_DESC fieldDesc + * cdef SAP_UC* cName = fillString(name) # <<<<<<<<<<<<<< + * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) + * free(cName) */ - __pyx_r = RFC_NOT_FOUND; - goto __pyx_L0; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_name); if (unlikely(__pyx_t_1 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2389, __pyx_L1_error) + __pyx_v_cName = __pyx_t_1; - /* "src/pyrfc/server.pyx":148 - * - * func_name = wrapString(funcName) - * if func_name not in server_functions: # <<<<<<<<<<<<<< - * _server_log("genericHandler", f"No metadata found for function '{function_name}'") - * return RFC_NOT_FOUND + /* "pyrfc/_cyrfc.pyx":2390 + * cdef RFC_FIELD_DESC fieldDesc + * cdef SAP_UC* cName = fillString(name) + * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) # <<<<<<<<<<<<<< + * free(cName) + * if rc != RFC_OK: */ - } + __pyx_v_rc = RfcGetFieldDescByName(__pyx_v_typeDesc, __pyx_v_cName, (&__pyx_v_fieldDesc), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":152 - * return RFC_NOT_FOUND - * - * func_data = server_functions[func_name] # <<<<<<<<<<<<<< - * callback = func_data['callback'] - * server = func_data['server'] + /* "pyrfc/_cyrfc.pyx":2391 + * cdef SAP_UC* cName = fillString(name) + * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) + * free(cName) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_func_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_func_data = __pyx_t_1; - __pyx_t_1 = 0; + free(__pyx_v_cName); - /* "src/pyrfc/server.pyx":153 - * - * func_data = server_functions[func_name] - * callback = func_data['callback'] # <<<<<<<<<<<<<< - * server = func_data['server'] - * # func_desc = func_data['func_desc_handle'] + /* "pyrfc/_cyrfc.pyx":2392 + * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) + * free(cName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_data, __pyx_n_s_callback); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_callback = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/server.pyx":154 - * func_data = server_functions[func_name] - * callback = func_data['callback'] - * server = func_data['server'] # <<<<<<<<<<<<<< - * # func_desc = func_data['func_desc_handle'] + /* "pyrfc/_cyrfc.pyx":2393 + * free(cName) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) * */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_data, __pyx_n_s_server); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_server = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2393, __pyx_L1_error) - /* "src/pyrfc/server.pyx":157 - * # func_desc = func_data['func_desc_handle'] - * - * try: # <<<<<<<<<<<<<< - * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2392 + * rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) + * free(cName) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - __Pyx_XGOTREF(__pyx_t_13); - /*try:*/ { + } - /* "src/pyrfc/server.pyx":158 + /* "pyrfc/_cyrfc.pyx":2394 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) # <<<<<<<<<<<<<< * - * try: - * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + * cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): */ - __pyx_v_rc = RfcGetConnectionAttributes(__pyx_v_rfcHandle, (&__pyx_v_attributes), (&__pyx_v_errorInfo)); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillVariable(__pyx_v_fieldDesc.type, __pyx_v_container, __pyx_v_fieldDesc.name, __pyx_v_value, __pyx_v_fieldDesc.typeDescHandle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2394, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":159 - * try: - * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") - * if not server.debug: + /* "pyrfc/_cyrfc.pyx":2385 + * fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) + * + * cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_2) { - /* "src/pyrfc/server.pyx":160 - * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) - * if rc != RFC_OK: - * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") # <<<<<<<<<<<<<< - * if not server.debug: - * raise ExternalRuntimeError(message="Invalid connection handle.") + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.fillStructureField", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2396 + * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) + * + * cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_STRUCTURE_HANDLE lineHandle */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Request_for); - __pyx_t_4 += 13; - __Pyx_GIVEREF(__pyx_kp_u_Request_for); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Request_for); - __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_kp_u_Error_while_retrieving_connecti); - __pyx_t_4 += 52; - __Pyx_GIVEREF(__pyx_kp_u_Error_while_retrieving_connecti); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u_Error_while_retrieving_connecti); - __pyx_t_9 = __Pyx_PyUnicode_From_RFC_RC(__pyx_v_rc, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_kp_u__40); - __pyx_t_4 += 2; - __Pyx_GIVEREF(__pyx_kp_u__40); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u__40); - __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_9}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_9}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_INCREF(__pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_n_s_genericHandler); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_10, __pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_10, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 160, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/server.pyx":161 - * if rc != RFC_OK: - * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") - * if not server.debug: # <<<<<<<<<<<<<< - * raise ExternalRuntimeError(message="Invalid connection handle.") - * conn_attr = {} - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_server, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 161, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 161, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_2) != 0); - if (unlikely(__pyx_t_3)) { - /* "src/pyrfc/server.pyx":162 - * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") - * if not server.debug: - * raise ExternalRuntimeError(message="Invalid connection handle.") # <<<<<<<<<<<<<< - * conn_attr = {} - * else: - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 162, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 162, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_message, __pyx_kp_s_Invalid_connection_handle) < 0) __PYX_ERR(5, 162, __pyx_L5_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 162, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(5, 162, __pyx_L5_error) +static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillTable(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_TABLE_HANDLE __pyx_v_container, PyObject *__pyx_v_lines) { + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_STRUCTURE_HANDLE __pyx_v_lineHandle; + unsigned int __pyx_v_rowCount; + unsigned int __pyx_v_i; + PyObject *__pyx_v_line = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillTable", 0); - /* "src/pyrfc/server.pyx":161 - * if rc != RFC_OK: - * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") - * if not server.debug: # <<<<<<<<<<<<<< - * raise ExternalRuntimeError(message="Invalid connection handle.") - * conn_attr = {} + /* "pyrfc/_cyrfc.pyx":2399 + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_STRUCTURE_HANDLE lineHandle + * cdef unsigned int rowCount = int(len(lines)) # <<<<<<<<<<<<<< + * cdef unsigned int i = 0 + * while i < rowCount: */ - } + __pyx_t_1 = PyObject_Length(__pyx_v_lines); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2399, __pyx_L1_error) + __pyx_v_rowCount = ((unsigned int)__pyx_t_1); - /* "src/pyrfc/server.pyx":163 - * if not server.debug: - * raise ExternalRuntimeError(message="Invalid connection handle.") - * conn_attr = {} # <<<<<<<<<<<<<< - * else: - * conn_attr = wrapConnectionAttributes(attributes) + /* "pyrfc/_cyrfc.pyx":2400 + * cdef RFC_STRUCTURE_HANDLE lineHandle + * cdef unsigned int rowCount = int(len(lines)) + * cdef unsigned int i = 0 # <<<<<<<<<<<<<< + * while i < rowCount: + * lineHandle = RfcAppendNewRow(container, &errorInfo) */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 163, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_v_conn_attr = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_i = 0; - /* "src/pyrfc/server.pyx":159 - * try: - * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") - * if not server.debug: + /* "pyrfc/_cyrfc.pyx":2401 + * cdef unsigned int rowCount = int(len(lines)) + * cdef unsigned int i = 0 + * while i < rowCount: # <<<<<<<<<<<<<< + * lineHandle = RfcAppendNewRow(container, &errorInfo) + * if not lineHandle: */ - goto __pyx_L11; - } + while (1) { + __pyx_t_2 = ((__pyx_v_i < __pyx_v_rowCount) != 0); + if (!__pyx_t_2) break; - /* "src/pyrfc/server.pyx":165 - * conn_attr = {} - * else: - * conn_attr = wrapConnectionAttributes(attributes) # <<<<<<<<<<<<<< - * _server_log( - * "genericHandler", + /* "pyrfc/_cyrfc.pyx":2402 + * cdef unsigned int i = 0 + * while i < rowCount: + * lineHandle = RfcAppendNewRow(container, &errorInfo) # <<<<<<<<<<<<<< + * if not lineHandle: + * raise wrapError(&errorInfo) */ - /*else*/ { - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapConnectionAttributes(__pyx_v_attributes); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 165, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_v_conn_attr = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_lineHandle = RfcAppendNewRow(__pyx_v_container, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":166 - * else: - * conn_attr = wrapConnectionAttributes(attributes) - * _server_log( # <<<<<<<<<<<<<< - * "genericHandler", - * "User '{user}' from system '{sysId}' client '{client}' host '{partnerHost}' invokes '{func_name}'" + /* "pyrfc/_cyrfc.pyx":2403 + * while i < rowCount: + * lineHandle = RfcAppendNewRow(container, &errorInfo) + * if not lineHandle: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * line = lines[i] */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 166, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = ((!(__pyx_v_lineHandle != 0)) != 0); + if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/server.pyx":169 - * "genericHandler", - * "User '{user}' from system '{sysId}' client '{client}' host '{partnerHost}' invokes '{func_name}'" - * .format(func_name=func_name, **conn_attr) # <<<<<<<<<<<<<< - * ) - * + /* "pyrfc/_cyrfc.pyx":2404 + * lineHandle = RfcAppendNewRow(container, &errorInfo) + * if not lineHandle: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * line = lines[i] + * if type(line) is dict: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_User_user_from_system_sysId_clie, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 169, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 169, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_func_name, __pyx_v_func_name) < 0) __PYX_ERR(5, 169, __pyx_L5_error) - __pyx_t_9 = __pyx_t_8; - __pyx_t_8 = 0; - if (unlikely(__pyx_v_conn_attr == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(5, 169, __pyx_L5_error) - } - if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_conn_attr) < 0) __PYX_ERR(5, 169, __pyx_L5_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 169, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_s_genericHandler, __pyx_t_8}; - __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 166, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_s_genericHandler, __pyx_t_8}; - __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 166, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_1 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 166, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_INCREF(__pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_n_s_genericHandler); - PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_10, __pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_10, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 166, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __pyx_L11:; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2404, __pyx_L1_error) - /* "src/pyrfc/server.pyx":174 - * # Context of the request. Might later be extended by activeParameter information. - * request_context = { - * 'connection_attributes': conn_attr, # <<<<<<<<<<<<<< - * 'server_context': context - * } + /* "pyrfc/_cyrfc.pyx":2403 + * while i < rowCount: + * lineHandle = RfcAppendNewRow(container, &errorInfo) + * if not lineHandle: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * line = lines[i] */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 174, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_connection_attributes, __pyx_v_conn_attr) < 0) __PYX_ERR(5, 174, __pyx_L5_error) + } - /* "src/pyrfc/server.pyx":175 - * request_context = { - * 'connection_attributes': conn_attr, - * 'server_context': context # <<<<<<<<<<<<<< - * } - * + /* "pyrfc/_cyrfc.pyx":2405 + * if not lineHandle: + * raise wrapError(&errorInfo) + * line = lines[i] # <<<<<<<<<<<<<< + * if type(line) is dict: + * for name, value in line.iteritems(): */ - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_server_context, __pyx_v_context) < 0) __PYX_ERR(5, 174, __pyx_L5_error) - __pyx_v_request_context = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_lines, __pyx_v_i, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_3); + __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":179 - * - * # Authorization check - * auth_function = server_context["auth_check"] # <<<<<<<<<<<<<< - * rc = auth_function(func_name, request_context) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2406 + * raise wrapError(&errorInfo) + * line = lines[i] + * if type(line) is dict: # <<<<<<<<<<<<<< + * for name, value in line.iteritems(): + * fillStructureField(typeDesc, lineHandle, name, value) */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_server_context); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 179, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_7, __pyx_n_s_auth_check); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 179, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_auth_function = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_line)) == ((PyObject *)(&PyDict_Type))); + __pyx_t_4 = (__pyx_t_2 != 0); + if (__pyx_t_4) { - /* "src/pyrfc/server.pyx":180 - * # Authorization check - * auth_function = server_context["auth_check"] - * rc = auth_function(func_name, request_context) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * new_error = ExternalRuntimeError( + /* "pyrfc/_cyrfc.pyx":2407 + * line = lines[i] + * if type(line) is dict: + * for name, value in line.iteritems(): # <<<<<<<<<<<<<< + * fillStructureField(typeDesc, lineHandle, name, value) + * else: */ - __Pyx_INCREF(__pyx_v_auth_function); - __pyx_t_7 = __pyx_v_auth_function; __pyx_t_1 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_10 = 1; - } + __pyx_t_1 = 0; + if (unlikely(__pyx_v_line == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(0, 2407, __pyx_L1_error) } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_func_name, __pyx_v_request_context}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 180, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_func_name, __pyx_v_request_context}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 180, __pyx_L5_error) - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 180, __pyx_L5_error) + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_line, 0, __pyx_n_s_iteritems, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_7; + __pyx_t_7 = 0; + while (1) { + __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_1, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); + if (unlikely(__pyx_t_9 == 0)) break; + if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 2407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_1) { - __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __pyx_t_1 = NULL; - } - __Pyx_INCREF(__pyx_v_func_name); - __Pyx_GIVEREF(__pyx_v_func_name); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_func_name); - __Pyx_INCREF(__pyx_v_request_context); - __Pyx_GIVEREF(__pyx_v_request_context); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_request_context); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 180, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_14 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_6)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 180, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_rc = __pyx_t_14; - - /* "src/pyrfc/server.pyx":181 - * auth_function = server_context["auth_check"] - * rc = auth_function(func_name, request_context) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * new_error = ExternalRuntimeError( - * message=f"Authentication exception raised by callback function: '{func_name}'", - */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_3) { - - /* "src/pyrfc/server.pyx":182 - * rc = auth_function(func_name, request_context) - * if rc != RFC_OK: - * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< - * message=f"Authentication exception raised by callback function: '{func_name}'", - * code=RFC_EXTERNAL_FAILURE - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 182, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7); + __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; - /* "src/pyrfc/server.pyx":183 - * if rc != RFC_OK: - * new_error = ExternalRuntimeError( - * message=f"Authentication exception raised by callback function: '{func_name}'", # <<<<<<<<<<<<<< - * code=RFC_EXTERNAL_FAILURE - * ) + /* "pyrfc/_cyrfc.pyx":2408 + * if type(line) is dict: + * for name, value in line.iteritems(): + * fillStructureField(typeDesc, lineHandle, name, value) # <<<<<<<<<<<<<< + * else: + * fillStructureField(typeDesc, lineHandle, '', line) */ - __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 183, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 183, __pyx_L5_error) + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillStructureField(__pyx_v_typeDesc, __pyx_v_lineHandle, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Authentication_exception_raised); - __pyx_t_4 += 55; - __Pyx_GIVEREF(__pyx_kp_u_Authentication_exception_raised); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Authentication_exception_raised); - __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 183, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1); - __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_4 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__6); - __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 183, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_message, __pyx_t_1) < 0) __PYX_ERR(5, 183, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":184 - * new_error = ExternalRuntimeError( - * message=f"Authentication exception raised by callback function: '{func_name}'", - * code=RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< - * ) - * fillError(new_error, serverErrorInfo) + /* "pyrfc/_cyrfc.pyx":2406 + * raise wrapError(&errorInfo) + * line = lines[i] + * if type(line) is dict: # <<<<<<<<<<<<<< + * for name, value in line.iteritems(): + * fillStructureField(typeDesc, lineHandle, name, value) */ - __pyx_t_1 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 184, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_code, __pyx_t_1) < 0) __PYX_ERR(5, 183, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L6; + } - /* "src/pyrfc/server.pyx":182 - * rc = auth_function(func_name, request_context) - * if rc != RFC_OK: - * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< - * message=f"Authentication exception raised by callback function: '{func_name}'", - * code=RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":2410 + * fillStructureField(typeDesc, lineHandle, name, value) + * else: + * fillStructureField(typeDesc, lineHandle, '', line) # <<<<<<<<<<<<<< + * i += 1 + * */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 182, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_new_error = __pyx_t_1; - __pyx_t_1 = 0; + /*else*/ { + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillStructureField(__pyx_v_typeDesc, __pyx_v_lineHandle, __pyx_kp_s__5, __pyx_v_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L6:; - /* "src/pyrfc/server.pyx":186 - * code=RFC_EXTERNAL_FAILURE - * ) - * fillError(new_error, serverErrorInfo) # <<<<<<<<<<<<<< - * return RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":2411 + * else: + * fillStructureField(typeDesc, lineHandle, '', line) + * i += 1 # <<<<<<<<<<<<<< * + * cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_new_error, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 186, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_i = (__pyx_v_i + 1); + } - /* "src/pyrfc/server.pyx":187 - * ) - * fillError(new_error, serverErrorInfo) - * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2396 + * fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) * - * # Filter out variables that are of direction u'RFC_EXPORT' + * cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef RFC_STRUCTURE_HANDLE lineHandle */ - __pyx_r = RFC_EXTERNAL_FAILURE; - goto __pyx_L9_try_return; - /* "src/pyrfc/server.pyx":181 - * auth_function = server_context["auth_check"] - * rc = auth_function(func_name, request_context) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * new_error = ExternalRuntimeError( - * message=f"Authentication exception raised by callback function: '{func_name}'", - */ - } + /* 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_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pyrfc._cyrfc.fillTable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_line); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "src/pyrfc/server.pyx":191 - * # Filter out variables that are of direction u'RFC_EXPORT' - * # (these will be set by the callback function) - * func_handle_variables = wrapResult(funcDesc, funcHandle, RFC_EXPORT, server.rstrip) # <<<<<<<<<<<<<< +/* "pyrfc/_cyrfc.pyx":2413 + * i += 1 * - * # Invoke callback function + * cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_server, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 191, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapResult(__pyx_v_funcDesc, __pyx_v_funcHandle, RFC_EXPORT, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 191, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_func_handle_variables = __pyx_t_7; - __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":194 - * - * # Invoke callback function - * result = callback(request_context, **func_handle_variables) # <<<<<<<<<<<<<< - * - * # Return results +static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillVariable(RFCTYPE __pyx_v_typ, RFC_FUNCTION_HANDLE __pyx_v_container, SAP_UC *__pyx_v_cName, PyObject *__pyx_v_value, RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_STRUCTURE_HANDLE __pyx_v_struct; + RFC_TABLE_HANDLE __pyx_v_table; + SAP_UC *__pyx_v_cValue; + SAP_RAW *__pyx_v_bValue; + PyObject *__pyx_v_name = NULL; + CYTHON_UNUSED PyObject *__pyx_v_ex = NULL; + PyObject *__pyx_v_svalue = NULL; + PyObject *__pyx_v_locale_radix = NULL; + int __pyx_v_format_ok; + PyObject *__pyx_v_e = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + SAP_RAW *__pyx_t_13; + SAP_UC *__pyx_t_14; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + PyObject *__pyx_t_17 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + int __pyx_t_20; + PyObject *__pyx_t_21 = NULL; + RFC_INT __pyx_t_22; + RFC_INT8 __pyx_t_23; + Py_UCS4 __pyx_t_24; + PyObject *__pyx_t_25 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillVariable", 0); + __Pyx_INCREF(__pyx_v_value); + + /* "pyrfc/_cyrfc.pyx":2422 + * global _LOCALE_RADIX + * # print ("fill", wrapString(cName), value, type(value)) + * try: # <<<<<<<<<<<<<< + * if typ == RFCTYPE_STRUCTURE: + * if type(value) is not dict: */ - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 194, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_request_context); - __Pyx_GIVEREF(__pyx_v_request_context); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_request_context); - if (unlikely(__pyx_v_func_handle_variables == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(5, 194, __pyx_L5_error) - } - if (likely(PyDict_CheckExact(__pyx_v_func_handle_variables))) { - __pyx_t_1 = PyDict_Copy(__pyx_v_func_handle_variables); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 194, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_func_handle_variables, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 194, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_callback, __pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 194, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_result = __pyx_t_6; - __pyx_t_6 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { - /* "src/pyrfc/server.pyx":197 - * - * # Return results - * if context["call_type"] != UnitCallType.background_unit: # <<<<<<<<<<<<<< - * for name, value in result.iteritems(): - * fillFunctionParameter(funcDesc, funcHandle, name, value) + /* "pyrfc/_cyrfc.pyx":2423 + * # print ("fill", wrapString(cName), value, type(value)) + * try: + * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< + * if type(value) is not dict: + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) */ - __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_context, __pyx_n_s_call_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 197, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_UnitCallType); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 197, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_background_unit); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 197, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 197, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 197, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { + switch (__pyx_v_typ) { + case RFCTYPE_STRUCTURE: - /* "src/pyrfc/server.pyx":198 - * # Return results - * if context["call_type"] != UnitCallType.background_unit: - * for name, value in result.iteritems(): # <<<<<<<<<<<<<< - * fillFunctionParameter(funcDesc, funcHandle, name, value) - * + /* "pyrfc/_cyrfc.pyx":2424 + * try: + * if typ == RFCTYPE_STRUCTURE: + * if type(value) is not dict: # <<<<<<<<<<<<<< + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) + * rc = RfcGetStructure(container, cName, &struct, &errorInfo) */ - __pyx_t_4 = 0; - if (unlikely(__pyx_v_result == Py_None)) { + __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyDict_Type))); + __pyx_t_5 = (__pyx_t_4 != 0); + if (unlikely(__pyx_t_5)) { + + /* "pyrfc/_cyrfc.pyx":2425 + * if typ == RFCTYPE_STRUCTURE: + * if type(value) is not dict: + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) # <<<<<<<<<<<<<< + * rc = RfcGetStructure(container, cName, &struct, &errorInfo) + * if rc != RFC_OK: + */ + __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_value))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2425, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2425, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_kp_s_dictionary_required_for_structur); + __Pyx_GIVEREF(__pyx_kp_s_dictionary_required_for_structur); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_s_dictionary_required_for_structur); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2425, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 2425, __pyx_L3_error) + + /* "pyrfc/_cyrfc.pyx":2424 + * try: + * if typ == RFCTYPE_STRUCTURE: + * if type(value) is not dict: # <<<<<<<<<<<<<< + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) + * rc = RfcGetStructure(container, cName, &struct, &errorInfo) + */ + } + + /* "pyrfc/_cyrfc.pyx":2426 + * if type(value) is not dict: + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) + * rc = RfcGetStructure(container, cName, &struct, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_v_rc = RfcGetStructure(__pyx_v_container, __pyx_v_cName, (&__pyx_v_struct), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2427 + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) + * rc = RfcGetStructure(container, cName, &struct, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for name, value in value.iteritems(): + */ + __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_5)) { + + /* "pyrfc/_cyrfc.pyx":2428 + * rc = RfcGetStructure(container, cName, &struct, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * for name, value in value.iteritems(): + * fillStructureField(typeDesc, struct, name, value) + */ + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2428, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 2428, __pyx_L3_error) + + /* "pyrfc/_cyrfc.pyx":2427 + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) + * rc = RfcGetStructure(container, cName, &struct, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for name, value in value.iteritems(): + */ + } + + /* "pyrfc/_cyrfc.pyx":2429 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * for name, value in value.iteritems(): # <<<<<<<<<<<<<< + * fillStructureField(typeDesc, struct, name, value) + * elif typ == RFCTYPE_TABLE: + */ + __pyx_t_8 = 0; + if (unlikely(__pyx_v_value == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); - __PYX_ERR(5, 198, __pyx_L5_error) + __PYX_ERR(0, 2429, __pyx_L3_error) } - __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_result, 0, __pyx_n_s_iteritems, (&__pyx_t_15), (&__pyx_t_10)); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 198, __pyx_L5_error) + __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_value, 0, __pyx_n_s_iteritems, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2429, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_7; + __Pyx_XDECREF(__pyx_t_6); + __pyx_t_6 = __pyx_t_7; __pyx_t_7 = 0; while (1) { - __pyx_t_16 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_15, &__pyx_t_4, &__pyx_t_7, &__pyx_t_6, NULL, __pyx_t_10); - if (unlikely(__pyx_t_16 == 0)) break; - if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(5, 198, __pyx_L5_error) + __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_8, &__pyx_t_7, &__pyx_t_11, NULL, __pyx_t_10); + if (unlikely(__pyx_t_12 == 0)) break; + if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 2429, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); - __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_11); + __pyx_t_11 = 0; - /* "src/pyrfc/server.pyx":199 - * if context["call_type"] != UnitCallType.background_unit: - * for name, value in result.iteritems(): - * fillFunctionParameter(funcDesc, funcHandle, name, value) # <<<<<<<<<<<<<< - * - * # Server exception handling: cf. SAP NetWeaver RFC SDK 7.50 + /* "pyrfc/_cyrfc.pyx":2430 + * raise wrapError(&errorInfo) + * for name, value in value.iteritems(): + * fillStructureField(typeDesc, struct, name, value) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_TABLE: + * if type(value) is not list: */ - __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillFunctionParameter(__pyx_v_funcDesc, __pyx_v_funcHandle, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 199, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_11 = __pyx_f_5pyrfc_6_cyrfc_fillStructureField(__pyx_v_typeDesc, __pyx_v_struct, __pyx_v_name, __pyx_v_value); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2430, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/server.pyx":197 - * - * # Return results - * if context["call_type"] != UnitCallType.background_unit: # <<<<<<<<<<<<<< - * for name, value in result.iteritems(): - * fillFunctionParameter(funcDesc, funcHandle, name, value) + /* "pyrfc/_cyrfc.pyx":2423 + * # print ("fill", wrapString(cName), value, type(value)) + * try: + * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< + * if type(value) is not dict: + * raise TypeError('dictionary required for structure parameter, received', str(type(value))) */ - } + break; + case RFCTYPE_TABLE: - /* "src/pyrfc/server.pyx":157 - * # func_desc = func_data['func_desc_handle'] - * - * try: # <<<<<<<<<<<<<< - * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2432 + * fillStructureField(typeDesc, struct, name, value) + * elif typ == RFCTYPE_TABLE: + * if type(value) is not list: # <<<<<<<<<<<<<< + * raise TypeError('list required for table parameter, received', str(type(value))) + * rc = RfcGetTable(container, cName, &table, &errorInfo) */ - } - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - goto __pyx_L10_try_end; - __pyx_L5_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyList_Type))); + __pyx_t_4 = (__pyx_t_5 != 0); + if (unlikely(__pyx_t_4)) { - /* "src/pyrfc/server.pyx":203 - * # Server exception handling: cf. SAP NetWeaver RFC SDK 7.50 - * # 5.1 Preparing a Server Program for Receiving RFC Requests - * except ExternalRuntimeError as e: # System failure # <<<<<<<<<<<<<< - * # Parameter: message (optional: msg_type, msg_class, msg_number, msg_v1-v4) - * # returns: RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":2433 + * elif typ == RFCTYPE_TABLE: + * if type(value) is not list: + * raise TypeError('list required for table parameter, received', str(type(value))) # <<<<<<<<<<<<<< + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 203, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7); - __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; - if (__pyx_t_10) { - __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(5, 203, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_e = __pyx_t_6; - /*try:*/ { + __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_value))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2433, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2433, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_kp_s_list_required_for_table_paramete); + __Pyx_GIVEREF(__pyx_kp_s_list_required_for_table_paramete); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_list_required_for_table_paramete); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2433, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 2433, __pyx_L3_error) - /* "src/pyrfc/server.pyx":206 - * # Parameter: message (optional: msg_type, msg_class, msg_number, msg_v1-v4) - * # returns: RFC_EXTERNAL_FAILURE - * fillError(e, serverErrorInfo) # <<<<<<<<<<<<<< - * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") + /* "pyrfc/_cyrfc.pyx":2432 + * fillStructureField(typeDesc, struct, name, value) + * elif typ == RFCTYPE_TABLE: + * if type(value) is not list: # <<<<<<<<<<<<<< + * raise TypeError('list required for table parameter, received', str(type(value))) + * rc = RfcGetTable(container, cName, &table, &errorInfo) */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_e, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 206, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } - /* "src/pyrfc/server.pyx":207 - * # returns: RFC_EXTERNAL_FAILURE - * fillError(e, serverErrorInfo) - * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. # <<<<<<<<<<<<<< - * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") - * return RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":2434 + * if type(value) is not list: + * raise TypeError('list required for table parameter, received', str(type(value))) + * rc = RfcGetTable(container, cName, &table, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_v_serverErrorInfo->code = RFC_EXTERNAL_FAILURE; + __pyx_v_rc = RfcGetTable(__pyx_v_container, __pyx_v_cName, (&__pyx_v_table), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":208 - * fillError(e, serverErrorInfo) - * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") # <<<<<<<<<<<<<< - * return RFC_EXTERNAL_FAILURE - * except ABAPRuntimeError as e: # ABAP Message + /* "pyrfc/_cyrfc.pyx":2435 + * raise TypeError('list required for table parameter, received', str(type(value))) + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * fillTable(typeDesc, table, value) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_server_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_17 = PyTuple_New(5); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_15 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Request_for); - __pyx_t_15 += 13; - __Pyx_GIVEREF(__pyx_kp_u_Request_for); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_kp_u_Request_for); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_raises_ExternalRuntimeError); - __pyx_t_15 += 30; - __Pyx_GIVEREF(__pyx_kp_u_raises_ExternalRuntimeError); - PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_kp_u_raises_ExternalRuntimeError); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_code_set_to_RFC_EXTERNAL_FAILUR); - __pyx_t_15 += 36; - __Pyx_GIVEREF(__pyx_kp_u_code_set_to_RFC_EXTERNAL_FAILUR); - PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_kp_u_code_set_to_RFC_EXTERNAL_FAILUR); - __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_17, 5, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_19 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_19); - if (__pyx_t_17) { - __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17); __pyx_t_17 = NULL; - } - __Pyx_INCREF(__pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_n_s_genericHandler); - PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_18); - __pyx_t_18 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_19, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 208, __pyx_L22_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_4)) { - /* "src/pyrfc/server.pyx":209 - * serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") - * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< - * except ABAPRuntimeError as e: # ABAP Message - * # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 + /* "pyrfc/_cyrfc.pyx":2436 + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * fillTable(typeDesc, table, value) + * elif typ == RFCTYPE_BYTE: */ - __pyx_r = RFC_EXTERNAL_FAILURE; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L21_return; - } + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2436, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 2436, __pyx_L3_error) - /* "src/pyrfc/server.pyx":203 - * # Server exception handling: cf. SAP NetWeaver RFC SDK 7.50 - * # 5.1 Preparing a Server Program for Receiving RFC Requests - * except ExternalRuntimeError as e: # System failure # <<<<<<<<<<<<<< - * # Parameter: message (optional: msg_type, msg_class, msg_number, msg_v1-v4) - * # returns: RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":2435 + * raise TypeError('list required for table parameter, received', str(type(value))) + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * fillTable(typeDesc, table, value) */ - /*finally:*/ { - __pyx_L22_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_26); - __pyx_t_10 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_20 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26); - } - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_ErrRestore(__pyx_t_21, __pyx_t_22, __pyx_t_23); - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_20; - goto __pyx_L7_except_error; - } - __pyx_L21_return: { - __pyx_t_14 = __pyx_r; - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - __pyx_r = __pyx_t_14; - goto __pyx_L8_except_return; } - } - } - /* "src/pyrfc/server.pyx":210 - * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") - * return RFC_EXTERNAL_FAILURE - * except ABAPRuntimeError as e: # ABAP Message # <<<<<<<<<<<<<< - * # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 - * # returns: RFC_ABAP_MESSAGE + /* "pyrfc/_cyrfc.pyx":2437 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * fillTable(typeDesc, table, value) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_BYTE: + * bValue = fillBytes(value) */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ABAPRuntimeError); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 210, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_16 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7); - __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; - if (__pyx_t_16) { - __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(5, 210, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_e = __pyx_t_6; - /*try:*/ { + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_fillTable(__pyx_v_typeDesc, __pyx_v_table, __pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2437, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "src/pyrfc/server.pyx":213 - * # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 - * # returns: RFC_ABAP_MESSAGE - * fillError(e, serverErrorInfo) # <<<<<<<<<<<<<< - * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") + /* "pyrfc/_cyrfc.pyx":2431 + * for name, value in value.iteritems(): + * fillStructureField(typeDesc, struct, name, value) + * elif typ == RFCTYPE_TABLE: # <<<<<<<<<<<<<< + * if type(value) is not list: + * raise TypeError('list required for table parameter, received', str(type(value))) */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_e, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 213, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + break; + case RFCTYPE_BYTE: - /* "src/pyrfc/server.pyx":214 - * # returns: RFC_ABAP_MESSAGE - * fillError(e, serverErrorInfo) - * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. # <<<<<<<<<<<<<< - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") - * return RFC_ABAP_MESSAGE + /* "pyrfc/_cyrfc.pyx":2439 + * fillTable(typeDesc, table, value) + * elif typ == RFCTYPE_BYTE: + * bValue = fillBytes(value) # <<<<<<<<<<<<<< + * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) + * free(bValue) */ - __pyx_v_serverErrorInfo->code = RFC_ABAP_MESSAGE; + __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_fillBytes(__pyx_v_value); if (unlikely(__pyx_t_13 == ((SAP_RAW *)NULL))) __PYX_ERR(0, 2439, __pyx_L3_error) + __pyx_v_bValue = __pyx_t_13; - /* "src/pyrfc/server.pyx":215 - * fillError(e, serverErrorInfo) - * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") # <<<<<<<<<<<<<< - * return RFC_ABAP_MESSAGE - * except ABAPApplicationError as e: # ABAP Exception in implementing function + /* "pyrfc/_cyrfc.pyx":2440 + * elif typ == RFCTYPE_BYTE: + * bValue = fillBytes(value) + * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) # <<<<<<<<<<<<<< + * free(bValue) + * elif typ == RFCTYPE_XSTRING: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_server_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_19 = PyTuple_New(5); if (unlikely(!__pyx_t_19)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_15 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Request_for); - __pyx_t_15 += 13; - __Pyx_GIVEREF(__pyx_kp_u_Request_for); - PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_u_Request_for); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_raises_ABAPRuntimeError); - __pyx_t_15 += 26; - __Pyx_GIVEREF(__pyx_kp_u_raises_ABAPRuntimeError); - PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_u_raises_ABAPRuntimeError); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_code_set_to_RFC_ABAP_MESSAGE); - __pyx_t_15 += 32; - __Pyx_GIVEREF(__pyx_kp_u_code_set_to_RFC_ABAP_MESSAGE); - PyTuple_SET_ITEM(__pyx_t_19, 4, __pyx_kp_u_code_set_to_RFC_ABAP_MESSAGE); - __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_19, 5, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = NULL; - __pyx_t_16 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_16 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_17 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_17); - if (__pyx_t_19) { - __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_19); __pyx_t_19 = NULL; - } - __Pyx_INCREF(__pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_n_s_genericHandler); - PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_16, __pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_16, __pyx_t_18); - __pyx_t_18 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_17, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 215, __pyx_L33_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2440, __pyx_L3_error) + __pyx_v_rc = RfcSetBytes(__pyx_v_container, __pyx_v_cName, __pyx_v_bValue, ((unsigned int)__pyx_t_9), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":216 - * serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") - * return RFC_ABAP_MESSAGE # <<<<<<<<<<<<<< - * except ABAPApplicationError as e: # ABAP Exception in implementing function - * # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) + /* "pyrfc/_cyrfc.pyx":2441 + * bValue = fillBytes(value) + * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) + * free(bValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_XSTRING: + * bValue = fillBytes(value) */ - __pyx_r = RFC_ABAP_MESSAGE; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L32_return; - } + free(__pyx_v_bValue); - /* "src/pyrfc/server.pyx":210 - * _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") - * return RFC_EXTERNAL_FAILURE - * except ABAPRuntimeError as e: # ABAP Message # <<<<<<<<<<<<<< - * # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 - * # returns: RFC_ABAP_MESSAGE + /* "pyrfc/_cyrfc.pyx":2438 + * raise wrapError(&errorInfo) + * fillTable(typeDesc, table, value) + * elif typ == RFCTYPE_BYTE: # <<<<<<<<<<<<<< + * bValue = fillBytes(value) + * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) */ - /*finally:*/ { - __pyx_L33_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_26); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_21); - __pyx_t_16 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_27 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21); - } - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ErrRestore(__pyx_t_26, __pyx_t_25, __pyx_t_24); - __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; - __pyx_lineno = __pyx_t_16; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_27; - goto __pyx_L7_except_error; - } - __pyx_L32_return: { - __pyx_t_14 = __pyx_r; - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - __pyx_r = __pyx_t_14; - goto __pyx_L8_except_return; - } - } - } + break; + case RFCTYPE_XSTRING: - /* "src/pyrfc/server.pyx":217 - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") - * return RFC_ABAP_MESSAGE - * except ABAPApplicationError as e: # ABAP Exception in implementing function # <<<<<<<<<<<<<< - * # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) - * # returns: RFC_ABAP_EXCEPTION + /* "pyrfc/_cyrfc.pyx":2443 + * free(bValue) + * elif typ == RFCTYPE_XSTRING: + * bValue = fillBytes(value) # <<<<<<<<<<<<<< + * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) + * free(bValue) */ - __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ABAPApplicationError); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 217, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7); - __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; - if (__pyx_t_10) { - __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(5, 217, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_e = __pyx_t_6; - /*try:*/ { + __pyx_t_13 = __pyx_f_5pyrfc_6_cyrfc_fillBytes(__pyx_v_value); if (unlikely(__pyx_t_13 == ((SAP_RAW *)NULL))) __PYX_ERR(0, 2443, __pyx_L3_error) + __pyx_v_bValue = __pyx_t_13; - /* "src/pyrfc/server.pyx":220 - * # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) - * # returns: RFC_ABAP_EXCEPTION - * fillError(e, serverErrorInfo) # <<<<<<<<<<<<<< - * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") + /* "pyrfc/_cyrfc.pyx":2444 + * elif typ == RFCTYPE_XSTRING: + * bValue = fillBytes(value) + * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) # <<<<<<<<<<<<<< + * free(bValue) + * elif typ == RFCTYPE_CHAR: */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_e, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 220, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2444, __pyx_L3_error) + __pyx_v_rc = RfcSetXString(__pyx_v_container, __pyx_v_cName, __pyx_v_bValue, ((unsigned int)__pyx_t_9), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":221 - * # returns: RFC_ABAP_EXCEPTION - * fillError(e, serverErrorInfo) - * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. # <<<<<<<<<<<<<< - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") - * return RFC_ABAP_EXCEPTION + /* "pyrfc/_cyrfc.pyx":2445 + * bValue = fillBytes(value) + * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) + * free(bValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_CHAR: + * if type(value) is not str: */ - __pyx_v_serverErrorInfo->code = RFC_ABAP_EXCEPTION; + free(__pyx_v_bValue); - /* "src/pyrfc/server.pyx":222 - * fillError(e, serverErrorInfo) - * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") # <<<<<<<<<<<<<< - * return RFC_ABAP_EXCEPTION - * except Exception as ex: + /* "pyrfc/_cyrfc.pyx":2442 + * rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) + * free(bValue) + * elif typ == RFCTYPE_XSTRING: # <<<<<<<<<<<<<< + * bValue = fillBytes(value) + * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_server_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_17 = PyTuple_New(5); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_17); - __pyx_t_15 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Request_for); - __pyx_t_15 += 13; - __Pyx_GIVEREF(__pyx_kp_u_Request_for); - PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_kp_u_Request_for); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_raises_ABAPApplicationError); - __pyx_t_15 += 30; - __Pyx_GIVEREF(__pyx_kp_u_raises_ABAPApplicationError); - PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_kp_u_raises_ABAPApplicationError); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_e, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_code_set_to_RFC_ABAP_EXCEPTION); - __pyx_t_15 += 34; - __Pyx_GIVEREF(__pyx_kp_u_code_set_to_RFC_ABAP_EXCEPTION); - PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_kp_u_code_set_to_RFC_ABAP_EXCEPTION); - __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_17, 5, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_t_17 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_17)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_19 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_19); - if (__pyx_t_17) { - __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17); __pyx_t_17 = NULL; - } - __Pyx_INCREF(__pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_n_s_genericHandler); - PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_18); - __pyx_t_18 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_19, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 222, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + break; + case RFCTYPE_CHAR: - /* "src/pyrfc/server.pyx":223 - * serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") - * return RFC_ABAP_EXCEPTION # <<<<<<<<<<<<<< - * except Exception as ex: - * exctype, value = exc_info()[:2] + /* "pyrfc/_cyrfc.pyx":2447 + * free(bValue) + * elif typ == RFCTYPE_CHAR: + * if type(value) is not str: # <<<<<<<<<<<<<< + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) */ - __pyx_r = RFC_ABAP_EXCEPTION; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L43_return; - } + __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyString_Type))); + __pyx_t_5 = (__pyx_t_4 != 0); + if (unlikely(__pyx_t_5)) { - /* "src/pyrfc/server.pyx":217 - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") - * return RFC_ABAP_MESSAGE - * except ABAPApplicationError as e: # ABAP Exception in implementing function # <<<<<<<<<<<<<< - * # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) - * # returns: RFC_ABAP_EXCEPTION + /* "pyrfc/_cyrfc.pyx":2448 + * elif typ == RFCTYPE_CHAR: + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * cValue = fillString(value) + * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) */ - /*finally:*/ { - __pyx_L44_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_24, &__pyx_t_25, &__pyx_t_26); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23) < 0)) __Pyx_ErrFetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_26); - __pyx_t_10 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_28 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_ExceptionReset(__pyx_t_24, __pyx_t_25, __pyx_t_26); - } - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_ErrRestore(__pyx_t_21, __pyx_t_22, __pyx_t_23); - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_t_26 = 0; - __pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_28; - goto __pyx_L7_except_error; - } - __pyx_L43_return: { - __pyx_t_14 = __pyx_r; - __Pyx_DECREF(__pyx_v_e); - __pyx_v_e = NULL; - __pyx_r = __pyx_t_14; - goto __pyx_L8_except_return; - } - } - } + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2448, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_kp_s_an_string_is_required_received); + __Pyx_GIVEREF(__pyx_kp_s_an_string_is_required_received); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_an_string_is_required_received); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2448, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 2448, __pyx_L3_error) - /* "src/pyrfc/server.pyx":224 - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") - * return RFC_ABAP_EXCEPTION - * except Exception as ex: # <<<<<<<<<<<<<< - * exctype, value = exc_info()[:2] - * _server_log( + /* "pyrfc/_cyrfc.pyx":2447 + * free(bValue) + * elif typ == RFCTYPE_CHAR: + * if type(value) is not str: # <<<<<<<<<<<<<< + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) */ - __pyx_t_16 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_16) { - __Pyx_AddTraceback("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(5, 224, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_ex = __pyx_t_6; - /*try:*/ { + } - /* "src/pyrfc/server.pyx":225 - * return RFC_ABAP_EXCEPTION - * except Exception as ex: - * exctype, value = exc_info()[:2] # <<<<<<<<<<<<<< - * _server_log( - * "genericHandler", + /* "pyrfc/_cyrfc.pyx":2449 + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) # <<<<<<<<<<<<<< + * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 225, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - } - } - __pyx_t_8 = (__pyx_t_19) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_19) : __Pyx_PyObject_CallNoArg(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 225, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_t_8, 0, 2, NULL, NULL, &__pyx_slice__12, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 225, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { - PyObject* sequence = __pyx_t_9; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(5, 225, __pyx_L55_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_19 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_8 = PyList_GET_ITEM(sequence, 0); - __pyx_t_19 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(__pyx_t_19); - #else - __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 225, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_19 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(5, 225, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_19); - #endif - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_18 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 225, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_29 = Py_TYPE(__pyx_t_18)->tp_iternext; - index = 0; __pyx_t_8 = __pyx_t_29(__pyx_t_18); if (unlikely(!__pyx_t_8)) goto __pyx_L57_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 1; __pyx_t_19 = __pyx_t_29(__pyx_t_18); if (unlikely(!__pyx_t_19)) goto __pyx_L57_unpacking_failed; - __Pyx_GOTREF(__pyx_t_19); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_29(__pyx_t_18), 2) < 0) __PYX_ERR(5, 225, __pyx_L55_error) - __pyx_t_29 = NULL; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - goto __pyx_L58_unpacking_done; - __pyx_L57_unpacking_failed:; - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - __pyx_t_29 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(5, 225, __pyx_L55_error) - __pyx_L58_unpacking_done:; - } - __pyx_v_exctype = __pyx_t_8; - __pyx_t_8 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_19); - __pyx_t_19 = 0; + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2449, __pyx_L3_error) + __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/server.pyx":226 - * except Exception as ex: - * exctype, value = exc_info()[:2] - * _server_log( # <<<<<<<<<<<<<< - * "genericHandler", - * f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" + /* "pyrfc/_cyrfc.pyx":2450 + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) + * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< + * free(cValue) + * elif typ == RFCTYPE_STRING: */ - __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_server_log); if (unlikely(!__pyx_t_19)) __PYX_ERR(5, 226, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_19); + __pyx_v_rc = RfcSetChars(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":228 - * _server_log( - * "genericHandler", - * f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" # <<<<<<<<<<<<<< - * "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" - * "The values of the request were:\n" + /* "pyrfc/_cyrfc.pyx":2451 + * cValue = fillString(value) + * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_STRING: + * if type(value) is not str: */ - __pyx_t_8 = PyTuple_New(10); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 228, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_15 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Request_for); - __pyx_t_15 += 13; - __Pyx_GIVEREF(__pyx_kp_u_Request_for); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_Request_for); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 228, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_raises_an_invalid_exception_Exc); - __pyx_t_15 += 43; - __Pyx_GIVEREF(__pyx_kp_u_raises_an_invalid_exception_Exc); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u_raises_an_invalid_exception_Exc); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_exctype, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 228, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_Values); - __pyx_t_15 += 10; - __Pyx_GIVEREF(__pyx_kp_u_Values); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u_Values); - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_value, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 228, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_Callback_functions_may_only_rai); - __pyx_t_15 += 140; - __Pyx_GIVEREF(__pyx_kp_u_Callback_functions_may_only_rai); - PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_kp_u_Callback_functions_may_only_rai); + free(__pyx_v_cValue); - /* "src/pyrfc/server.pyx":231 - * "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" - * "The values of the request were:\n" - * f"params: {func_handle_variables}\nrequest_context: {request_context}" # <<<<<<<<<<<<<< - * ) - * new_error = ExternalRuntimeError( + /* "pyrfc/_cyrfc.pyx":2446 + * rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) + * free(bValue) + * elif typ == RFCTYPE_CHAR: # <<<<<<<<<<<<<< + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) */ - if (unlikely(!__pyx_v_func_handle_variables)) { __Pyx_RaiseUnboundLocalError("func_handle_variables"); __PYX_ERR(5, 231, __pyx_L55_error) } - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_func_handle_variables, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 231, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_INCREF(__pyx_kp_u_request_context_2); - __pyx_t_15 += 18; - __Pyx_GIVEREF(__pyx_kp_u_request_context_2); - PyTuple_SET_ITEM(__pyx_t_8, 8, __pyx_kp_u_request_context_2); - if (unlikely(!__pyx_v_request_context)) { __Pyx_RaiseUnboundLocalError("request_context"); __PYX_ERR(5, 231, __pyx_L55_error) } - __pyx_t_18 = __Pyx_PyObject_FormatSimple(__pyx_v_request_context, __pyx_empty_unicode); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 231, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_18); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_18) : __pyx_t_5; - __pyx_t_15 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_18); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_8, 9, __pyx_t_18); - __pyx_t_18 = 0; + break; + case RFCTYPE_STRING: - /* "src/pyrfc/server.pyx":228 - * _server_log( - * "genericHandler", - * f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" # <<<<<<<<<<<<<< - * "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" - * "The values of the request were:\n" + /* "pyrfc/_cyrfc.pyx":2453 + * free(cValue) + * elif typ == RFCTYPE_STRING: + * if type(value) is not str: # <<<<<<<<<<<<<< + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) */ - __pyx_t_18 = __Pyx_PyUnicode_Join(__pyx_t_8, 10, __pyx_t_15, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(5, 228, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - __pyx_t_16 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_19); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_19, function); - __pyx_t_16 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_19)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 226, __pyx_L55_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_s_genericHandler, __pyx_t_18}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 226, __pyx_L55_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - } else - #endif - { - __pyx_t_17 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 226, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_17); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_INCREF(__pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_n_s_genericHandler); - PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_16, __pyx_n_s_genericHandler); - __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_16, __pyx_t_18); - __pyx_t_18 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_17, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 226, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - } - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyString_Type))); + __pyx_t_4 = (__pyx_t_5 != 0); + if (unlikely(__pyx_t_4)) { - /* "src/pyrfc/server.pyx":233 - * f"params: {func_handle_variables}\nrequest_context: {request_context}" - * ) - * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< - * message="Invalid exception raised by callback function.", - * code=RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":2454 + * elif typ == RFCTYPE_STRING: + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * cValue = fillString(value) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 233, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2454, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_kp_s_an_string_is_required_received); + __Pyx_GIVEREF(__pyx_kp_s_an_string_is_required_received); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_an_string_is_required_received); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2454, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 2454, __pyx_L3_error) - /* "src/pyrfc/server.pyx":234 - * ) - * new_error = ExternalRuntimeError( - * message="Invalid exception raised by callback function.", # <<<<<<<<<<<<<< - * code=RFC_EXTERNAL_FAILURE - * ) + /* "pyrfc/_cyrfc.pyx":2453 + * free(cValue) + * elif typ == RFCTYPE_STRING: + * if type(value) is not str: # <<<<<<<<<<<<<< + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) */ - __pyx_t_19 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(5, 234, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_19); - if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_message, __pyx_kp_s_Invalid_exception_raised_by_call) < 0) __PYX_ERR(5, 234, __pyx_L55_error) + } - /* "src/pyrfc/server.pyx":235 - * new_error = ExternalRuntimeError( - * message="Invalid exception raised by callback function.", - * code=RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< - * ) - * fillError(new_error, serverErrorInfo) + /* "pyrfc/_cyrfc.pyx":2455 + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) # <<<<<<<<<<<<<< + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) */ - __pyx_t_17 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 235, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_17); - if (PyDict_SetItem(__pyx_t_19, __pyx_n_s_code, __pyx_t_17) < 0) __PYX_ERR(5, 234, __pyx_L55_error) - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2455, __pyx_L3_error) + __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/server.pyx":233 - * f"params: {func_handle_variables}\nrequest_context: {request_context}" - * ) - * new_error = ExternalRuntimeError( # <<<<<<<<<<<<<< - * message="Invalid exception raised by callback function.", - * code=RFC_EXTERNAL_FAILURE + /* "pyrfc/_cyrfc.pyx":2456 + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< + * free(cValue) + * elif typ == RFCTYPE_NUM: */ - __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 233, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF_SET(__pyx_v_new_error, __pyx_t_17); - __pyx_t_17 = 0; + __pyx_v_rc = RfcSetString(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":237 - * code=RFC_EXTERNAL_FAILURE - * ) - * fillError(new_error, serverErrorInfo) # <<<<<<<<<<<<<< - * return RFC_EXTERNAL_FAILURE - * + /* "pyrfc/_cyrfc.pyx":2457 + * cValue = fillString(value) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_NUM: + * try: */ - __pyx_t_17 = __pyx_f_5pyrfc_6_cyrfc_fillError(__pyx_v_new_error, __pyx_v_serverErrorInfo); if (unlikely(!__pyx_t_17)) __PYX_ERR(5, 237, __pyx_L55_error) - __Pyx_GOTREF(__pyx_t_17); - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + free(__pyx_v_cValue); - /* "src/pyrfc/server.pyx":238 - * ) - * fillError(new_error, serverErrorInfo) - * return RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< - * - * return RFC_OK + /* "pyrfc/_cyrfc.pyx":2452 + * rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) + * elif typ == RFCTYPE_STRING: # <<<<<<<<<<<<<< + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) */ - __pyx_r = RFC_EXTERNAL_FAILURE; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L54_return; - } + break; + case RFCTYPE_NUM: - /* "src/pyrfc/server.pyx":224 - * _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") - * return RFC_ABAP_EXCEPTION - * except Exception as ex: # <<<<<<<<<<<<<< - * exctype, value = exc_info()[:2] - * _server_log( + /* "pyrfc/_cyrfc.pyx":2459 + * free(cValue) + * elif typ == RFCTYPE_NUM: + * try: # <<<<<<<<<<<<<< + * if value.isdigit(): + * cValue = fillString(value) */ - /*finally:*/ { - __pyx_L55_error:; - /*exception exit:*/{ + { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; - __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24) < 0)) __Pyx_ErrFetch(&__pyx_t_26, &__pyx_t_25, &__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_26); - __Pyx_XGOTREF(__pyx_t_25); - __Pyx_XGOTREF(__pyx_t_24); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_21); - __pyx_t_16 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_30 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21); - } - __Pyx_XGIVEREF(__pyx_t_26); - __Pyx_XGIVEREF(__pyx_t_25); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ErrRestore(__pyx_t_26, __pyx_t_25, __pyx_t_24); - __pyx_t_26 = 0; __pyx_t_25 = 0; __pyx_t_24 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0; - __pyx_lineno = __pyx_t_16; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_30; - goto __pyx_L7_except_error; - } - __pyx_L54_return: { - __pyx_t_14 = __pyx_r; - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - __pyx_r = __pyx_t_14; - goto __pyx_L8_except_return; - } - } - } - goto __pyx_L7_except_error; - __pyx_L7_except_error:; + __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_17); + /*try:*/ { - /* "src/pyrfc/server.pyx":157 - * # func_desc = func_data['func_desc_handle'] - * - * try: # <<<<<<<<<<<<<< - * rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2460 + * elif typ == RFCTYPE_NUM: + * try: + * if value.isdigit(): # <<<<<<<<<<<<<< + * cValue = fillString(value) + * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) */ - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); - goto __pyx_L1_error; - __pyx_L9_try_return:; - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); - goto __pyx_L0; - __pyx_L8_except_return:; - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); - goto __pyx_L0; - __pyx_L10_try_end:; - } - - /* "src/pyrfc/server.pyx":240 - * return RFC_EXTERNAL_FAILURE - * - * return RFC_OK # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = RFC_OK; - goto __pyx_L0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_isdigit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2460, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2460, __pyx_L17_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2460, __pyx_L17_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (likely(__pyx_t_4)) { - /* "src/pyrfc/server.pyx":124 - * return server_context - * - * cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: # <<<<<<<<<<<<<< - * cdef RFC_RC rc - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":2461 + * try: + * if value.isdigit(): + * cValue = fillString(value) # <<<<<<<<<<<<<< + * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) */ + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2461, __pyx_L17_error) + __pyx_v_cValue = __pyx_t_14; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_17); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_WriteUnraisable("pyrfc._cyrfc.genericHandler", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (RFC_RC) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_context); - __Pyx_XDECREF(__pyx_v_err_msg); - __Pyx_XDECREF(__pyx_v_new_error); - __Pyx_XDECREF(__pyx_v_func_name); - __Pyx_XDECREF(__pyx_v_func_data); - __Pyx_XDECREF(__pyx_v_callback); - __Pyx_XDECREF(__pyx_v_server); - __Pyx_XDECREF(__pyx_v_conn_attr); - __Pyx_XDECREF(__pyx_v_request_context); - __Pyx_XDECREF(__pyx_v_auth_function); - __Pyx_XDECREF(__pyx_v_func_handle_variables); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XDECREF(__pyx_v_ex); - __Pyx_XDECREF(__pyx_v_exctype); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":289 - * } - * - * def __cinit__(self, server_params, client_params, config=None): # <<<<<<<<<<<<<< - * # config parsing - * config = config or {} + /* "pyrfc/_cyrfc.pyx":2462 + * if value.isdigit(): + * cValue = fillString(value) + * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< + * free(cValue) + * else: */ + __pyx_v_rc = RfcSetNum(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_6Server_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_6Server_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_server_params = 0; - PyObject *__pyx_v_client_params = 0; - PyObject *__pyx_v_config = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_server_params,&__pyx_n_s_client_params,&__pyx_n_s_config,0}; - PyObject* values[3] = {0,0,0}; - values[2] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 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_server_params)) != 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_client_params)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(5, 289, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_config); - if (value) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(5, 289, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_server_params = values[0]; - __pyx_v_client_params = values[1]; - __pyx_v_config = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 289, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server___cinit__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), __pyx_v_server_params, __pyx_v_client_params, __pyx_v_config); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2463 + * cValue = fillString(value) + * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) # <<<<<<<<<<<<<< + * else: + * raise + */ + free(__pyx_v_cValue); -static int __pyx_pf_5pyrfc_6_cyrfc_6Server___cinit__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_server_params, PyObject *__pyx_v_client_params, PyObject *__pyx_v_config) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); - __Pyx_INCREF(__pyx_v_config); + /* "pyrfc/_cyrfc.pyx":2460 + * elif typ == RFCTYPE_NUM: + * try: + * if value.isdigit(): # <<<<<<<<<<<<<< + * cValue = fillString(value) + * rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) + */ + goto __pyx_L23; + } - /* "src/pyrfc/server.pyx":291 - * def __cinit__(self, server_params, client_params, config=None): - * # config parsing - * config = config or {} # <<<<<<<<<<<<<< - * self.debug = config.get('debug', False) - * self.rstrip = config.get('rstrip', True) + /* "pyrfc/_cyrfc.pyx":2465 + * free(cValue) + * else: + * raise # <<<<<<<<<<<<<< + * except Exception as ex: + * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_config); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 291, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __Pyx_INCREF(__pyx_v_config); - __pyx_t_1 = __pyx_v_config; - goto __pyx_L3_bool_binop_done; - } - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_L3_bool_binop_done:; - __Pyx_DECREF_SET(__pyx_v_config, __pyx_t_1); - __pyx_t_1 = 0; + /*else*/ { + __Pyx_ReraiseException(); __PYX_ERR(0, 2465, __pyx_L17_error) + } + __pyx_L23:; - /* "src/pyrfc/server.pyx":292 - * # config parsing - * config = config or {} - * self.debug = config.get('debug', False) # <<<<<<<<<<<<<< - * self.rstrip = config.get('rstrip', True) - * server_context["server_log"] = config.get("server_log", False) + /* "pyrfc/_cyrfc.pyx":2459 + * free(cValue) + * elif typ == RFCTYPE_NUM: + * try: # <<<<<<<<<<<<<< + * if value.isdigit(): + * cValue = fillString(value) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 292, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_self->debug = __pyx_t_2; + } + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + goto __pyx_L22_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":293 - * config = config or {} - * self.debug = config.get('debug', False) - * self.rstrip = config.get('rstrip', True) # <<<<<<<<<<<<<< - * server_context["server_log"] = config.get("server_log", False) - * server_context["auth_check"] = config.get("auth_check", default_auth_check) + /* "pyrfc/_cyrfc.pyx":2466 + * else: + * raise + * except Exception as ex: # <<<<<<<<<<<<<< + * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) + * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 293, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->rstrip = __pyx_t_2; + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_11, &__pyx_t_7) < 0) __PYX_ERR(0, 2466, __pyx_L19_except_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_11); + __pyx_v_ex = __pyx_t_11; - /* "src/pyrfc/server.pyx":294 - * self.debug = config.get('debug', False) - * self.rstrip = config.get('rstrip', True) - * server_context["server_log"] = config.get("server_log", False) # <<<<<<<<<<<<<< - * server_context["auth_check"] = config.get("auth_check", default_auth_check) - * server_context["port"] = config.get("port", 8080) + /* "pyrfc/_cyrfc.pyx":2467 + * raise + * except Exception as ex: + * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + * # cast to string prevents rounding errors in NWRFC SDK */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_server_log_2, __pyx_t_3) < 0)) __PYX_ERR(5, 294, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_18 = PyTuple_New(4); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 2467, __pyx_L19_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_INCREF(__pyx_kp_s_a_numeric_string_is_required_rec); + __Pyx_GIVEREF(__pyx_kp_s_a_numeric_string_is_required_rec); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_kp_s_a_numeric_string_is_required_rec); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_18, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_18, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2467, __pyx_L19_except_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_Raise(__pyx_t_19, 0, 0, 0); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __PYX_ERR(0, 2467, __pyx_L19_except_error) + } + goto __pyx_L19_except_error; + __pyx_L19_except_error:; - /* "src/pyrfc/server.pyx":295 - * self.rstrip = config.get('rstrip', True) - * server_context["server_log"] = config.get("server_log", False) - * server_context["auth_check"] = config.get("auth_check", default_auth_check) # <<<<<<<<<<<<<< - * server_context["port"] = config.get("port", 8080) - * + /* "pyrfc/_cyrfc.pyx":2459 + * free(cValue) + * elif typ == RFCTYPE_NUM: + * try: # <<<<<<<<<<<<<< + * if value.isdigit(): + * cValue = fillString(value) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_default_auth_check); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_auth_check, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_n_s_auth_check, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_n_s_auth_check); - __Pyx_GIVEREF(__pyx_n_s_auth_check); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_s_auth_check); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_s_auth_check, __pyx_t_3) < 0)) __PYX_ERR(5, 295, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); + goto __pyx_L3_error; + __pyx_L22_try_end:; + } - /* "src/pyrfc/server.pyx":296 - * server_context["server_log"] = config.get("server_log", False) - * server_context["auth_check"] = config.get("auth_check", default_auth_check) - * server_context["port"] = config.get("port", 8080) # <<<<<<<<<<<<<< - * - * self._client_connection = Connection(**client_params) + /* "pyrfc/_cyrfc.pyx":2458 + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) + * elif typ == RFCTYPE_NUM: # <<<<<<<<<<<<<< + * try: + * if value.isdigit(): */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_config, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_n_s_port, __pyx_t_1) < 0)) __PYX_ERR(5, 296, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + break; + case RFCTYPE_BCD: - /* "src/pyrfc/server.pyx":298 - * server_context["port"] = config.get("port", 8080) - * - * self._client_connection = Connection(**client_params) # <<<<<<<<<<<<<< - * self._server_connection = ServerConnection(**server_params) - * self._server_thread=Thread(target=self.serve) + /* "pyrfc/_cyrfc.pyx":2468 + * except Exception as ex: + * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) + * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< + * # cast to string prevents rounding errors in NWRFC SDK + * try: */ - if (unlikely(__pyx_v_client_params == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(5, 298, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_v_client_params))) { - __pyx_t_1 = PyDict_Copy(__pyx_v_client_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_client_params, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Connection), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->_client_connection); - __Pyx_DECREF(((PyObject *)__pyx_v_self->_client_connection)); - __pyx_v_self->_client_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_t_3); - __pyx_t_3 = 0; + case RFCTYPE_FLOAT: + case RFCTYPE_DECF16: + case RFCTYPE_DECF34: - /* "src/pyrfc/server.pyx":299 - * - * self._client_connection = Connection(**client_params) - * self._server_connection = ServerConnection(**server_params) # <<<<<<<<<<<<<< - * self._server_thread=Thread(target=self.serve) - * + /* "pyrfc/_cyrfc.pyx":2470 + * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + * # cast to string prevents rounding errors in NWRFC SDK + * try: # <<<<<<<<<<<<<< + * if type(value) is float or type(value) is Decimal: + * svalue = str(value) */ - if (unlikely(__pyx_v_server_params == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(5, 299, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_v_server_params))) { - __pyx_t_3 = PyDict_Copy(__pyx_v_server_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_server_params, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_ServerConnection), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->_server_connection); - __Pyx_DECREF(((PyObject *)__pyx_v_self->_server_connection)); - __pyx_v_self->_server_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *)__pyx_t_1); - __pyx_t_1 = 0; + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_15); + /*try:*/ { - /* "src/pyrfc/server.pyx":300 - * self._client_connection = Connection(**client_params) - * self._server_connection = ServerConnection(**server_params) - * self._server_thread=Thread(target=self.serve) # <<<<<<<<<<<<<< - * - * @staticmethod + /* "pyrfc/_cyrfc.pyx":2471 + * # cast to string prevents rounding errors in NWRFC SDK + * try: + * if type(value) is float or type(value) is Decimal: # <<<<<<<<<<<<<< + * svalue = str(value) + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_serve); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_target, __pyx_t_7) < 0) __PYX_ERR(5, 300, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_v_self->_server_thread); - __Pyx_DECREF(__pyx_v_self->_server_thread); - __pyx_v_self->_server_thread = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)(&PyFloat_Type))); + __pyx_t_20 = (__pyx_t_5 != 0); + if (!__pyx_t_20) { + } else { + __pyx_t_4 = __pyx_t_20; + goto __pyx_L33_bool_binop_done; + } + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2471, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_20 = (((PyObject *)Py_TYPE(__pyx_v_value)) == __pyx_t_7); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = (__pyx_t_20 != 0); + __pyx_t_4 = __pyx_t_5; + __pyx_L33_bool_binop_done:; + if (__pyx_t_4) { - /* "src/pyrfc/server.pyx":289 - * } - * - * def __cinit__(self, server_params, client_params, config=None): # <<<<<<<<<<<<<< - * # config parsing - * config = config or {} + /* "pyrfc/_cyrfc.pyx":2472 + * try: + * if type(value) is float or type(value) is Decimal: + * svalue = str(value) # <<<<<<<<<<<<<< + * else: + * # string passed from application should be locale correct, do nothing */ + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2472, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_svalue = __pyx_t_7; + __pyx_t_7 = 0; - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_config); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2471 + * # cast to string prevents rounding errors in NWRFC SDK + * try: + * if type(value) is float or type(value) is Decimal: # <<<<<<<<<<<<<< + * svalue = str(value) + * else: + */ + goto __pyx_L32; + } -/* "src/pyrfc/server.pyx":303 - * - * @staticmethod - * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["check"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2475 + * else: + * # string passed from application should be locale correct, do nothing + * svalue = value # <<<<<<<<<<<<<< + * # decimal separator must be "." for the Decimal parsing check + * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] */ + /*else*/ { + __Pyx_INCREF(__pyx_v_value); + __pyx_v_svalue = __pyx_v_value; + } + __pyx_L32:; -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onCheckFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { - PyObject *__pyx_v_handler = NULL; - PyObject *__pyx_v_unit_identifier = NULL; - PyObject *__pyx_v_ex = NULL; - RFC_RC __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - RFC_RC __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - char const *__pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__onCheckFunction", 0); - - /* "src/pyrfc/server.pyx":304 - * @staticmethod - * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["check"] # <<<<<<<<<<<<<< - * if handler is None: - * return RCStatus.OK.value + /* "pyrfc/_cyrfc.pyx":2477 + * svalue = value + * # decimal separator must be "." for the Decimal parsing check + * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] # <<<<<<<<<<<<<< + * if locale_radix != ".": + * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_check); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_handler = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_LOCALE_RADIX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2477, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_locale_radix = __pyx_t_7; + __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":305 - * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["check"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2478 + * # decimal separator must be "." for the Decimal parsing check + * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] + * if locale_radix != ".": # <<<<<<<<<<<<<< + * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) + * else: */ - __pyx_t_3 = (__pyx_v_handler == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_locale_radix, __pyx_kp_s__20, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2478, __pyx_L26_error) + if (__pyx_t_4) { - /* "src/pyrfc/server.pyx":306 - * handler = Server.__bgRfcFunction["check"] - * if handler is None: - * return RCStatus.OK.value # <<<<<<<<<<<<<< - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) + /* "pyrfc/_cyrfc.pyx":2479 + * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] + * if locale_radix != ".": + * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) # <<<<<<<<<<<<<< + * else: + * Decimal(svalue) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 306, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_svalue, __pyx_n_s_rsplit); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_18 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_18)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_v_locale_radix, __pyx_int_1}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_6); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[3] = {__pyx_t_18, __pyx_v_locale_radix, __pyx_int_1}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_GOTREF(__pyx_t_6); + } else + #endif + { + __pyx_t_21 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_21); + if (__pyx_t_18) { + __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18); __pyx_t_18 = NULL; + } + __Pyx_INCREF(__pyx_v_locale_radix); + __Pyx_GIVEREF(__pyx_v_locale_radix); + PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_10, __pyx_v_locale_radix); + __Pyx_INCREF(__pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_10, __pyx_int_1); + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_21, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + } + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyString_Join(__pyx_kp_s__20, __pyx_t_6); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_6, __pyx_t_19) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_19); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2479, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":305 - * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["check"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2478 + * # decimal separator must be "." for the Decimal parsing check + * locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] + * if locale_radix != ".": # <<<<<<<<<<<<<< + * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) + * else: */ - } + goto __pyx_L35; + } - /* "src/pyrfc/server.pyx":307 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2481 + * Decimal('.'.join(svalue.rsplit(locale_radix, 1))) + * else: + * Decimal(svalue) # <<<<<<<<<<<<<< + * cValue = fillString(svalue) + * except Exception as ex: */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2481, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_19 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_19, __pyx_v_svalue) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_svalue); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2481, __pyx_L26_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_L35:; - /* "src/pyrfc/server.pyx":308 - * return RCStatus.OK.value - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: + /* "pyrfc/_cyrfc.pyx":2482 + * else: + * Decimal(svalue) + * cValue = fillString(svalue) # <<<<<<<<<<<<<< + * except Exception as ex: + * raise TypeError('a decimal value required, received', value, 'of type', type(value)) */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 308, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_unit_identifier = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_svalue); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2482, __pyx_L26_error) + __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/server.pyx":309 - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< - * except Exception as ex: - * _server_log("Error in bgRFC handler onCheck:", ex) + /* "pyrfc/_cyrfc.pyx":2470 + * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + * # cast to string prevents rounding errors in NWRFC SDK + * try: # <<<<<<<<<<<<<< + * if type(value) is float or type(value) is Decimal: + * svalue = str(value) */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 309, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_handler); - __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 309, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 309, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 309, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); - __Pyx_INCREF(__pyx_v_unit_identifier); - __Pyx_GIVEREF(__pyx_v_unit_identifier); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 309, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 309, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 309, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L8_try_return; + } + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L31_try_end; + __pyx_L26_error:; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":307 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2483 + * Decimal(svalue) + * cValue = fillString(svalue) + * except Exception as ex: # <<<<<<<<<<<<<< + * raise TypeError('a decimal value required, received', value, 'of type', type(value)) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) */ - } - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_19) < 0) __PYX_ERR(0, 2483, __pyx_L28_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_t_11); + __pyx_v_ex = __pyx_t_11; - /* "src/pyrfc/server.pyx":310 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onCheck:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2484 + * cValue = fillString(svalue) + * except Exception as ex: + * raise TypeError('a decimal value required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) */ - __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_11) { - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onCheckFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(5, 310, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_ex = __pyx_t_2; - /*try:*/ { + __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2484, __pyx_L28_except_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_kp_s_a_decimal_value_required_receive); + __Pyx_GIVEREF(__pyx_kp_s_a_decimal_value_required_receive); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_a_decimal_value_required_receive); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2484, __pyx_L28_except_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_21, 0, 0, 0); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __PYX_ERR(0, 2484, __pyx_L28_except_error) + } + goto __pyx_L28_except_error; + __pyx_L28_except_error:; - /* "src/pyrfc/server.pyx":311 - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: - * _server_log("Error in bgRFC handler onCheck:", ex) # <<<<<<<<<<<<<< - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * + /* "pyrfc/_cyrfc.pyx":2470 + * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + * # cast to string prevents rounding errors in NWRFC SDK + * try: # <<<<<<<<<<<<<< + * if type(value) is float or type(value) is Decimal: + * svalue = str(value) */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 311, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCheck, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 311, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCheck, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 311, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 311, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_14); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onCheck); - __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onCheck); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onCheck); - __Pyx_INCREF(__pyx_v_ex); - __Pyx_GIVEREF(__pyx_v_ex); - PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 311, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15); + goto __pyx_L3_error; + __pyx_L31_try_end:; } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":312 - * except Exception as ex: - * _server_log("Error in bgRFC handler onCheck:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< - * - * @staticmethod + /* "pyrfc/_cyrfc.pyx":2485 + * except Exception as ex: + * raise TypeError('a decimal value required, received', value, 'of type', type(value)) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< + * free(cValue) + * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 312, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 312, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 312, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 312, __pyx_L15_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L14_return; - } + __pyx_v_rc = RfcSetString(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":310 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onCheck:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2486 + * raise TypeError('a decimal value required, received', value, 'of type', type(value)) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) # <<<<<<<<<<<<<< + * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): + * if type(value) is not int: */ - /*finally:*/ { - __pyx_L15_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __pyx_t_11 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22); - } - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19); - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; - goto __pyx_L6_except_error; - } - __pyx_L14_return: { - __pyx_t_5 = __pyx_r; - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - __pyx_r = __pyx_t_5; - goto __pyx_L7_except_return; - } - } - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + free(__pyx_v_cValue); - /* "src/pyrfc/server.pyx":307 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2468 + * except Exception as ex: + * raise TypeError('a numeric string is required, received', value, 'of type', type(value)) + * elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< + * # cast to string prevents rounding errors in NWRFC SDK + * try: */ - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L8_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - } + break; + case RFCTYPE_INT: - /* "src/pyrfc/server.pyx":303 - * - * @staticmethod - * cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["check"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2487 + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) + * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): # <<<<<<<<<<<<<< + * if type(value) is not int: + * raise TypeError('an integer required, received', value, 'of type', type(value)) */ + case RFCTYPE_INT1: + case RFCTYPE_INT2: - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onCheckFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (RFC_RC) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_handler); - __Pyx_XDECREF(__pyx_v_unit_identifier); - __Pyx_XDECREF(__pyx_v_ex); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2488 + * free(cValue) + * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): + * if type(value) is not int: # <<<<<<<<<<<<<< + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt(container, cName, value, &errorInfo) + */ + __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyInt_Type))); + __pyx_t_5 = (__pyx_t_4 != 0); + if (unlikely(__pyx_t_5)) { -/* "src/pyrfc/server.pyx":315 - * - * @staticmethod - * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["commit"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2489 + * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): + * if type(value) is not int: + * raise TypeError('an integer required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * rc = RfcSetInt(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_INT8: */ + __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2489, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_kp_s_an_integer_required_received); + __Pyx_GIVEREF(__pyx_kp_s_an_integer_required_received); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_s_an_integer_required_received); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_19, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_19, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2489, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 2489, __pyx_L3_error) -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onCommitFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { - PyObject *__pyx_v_handler = NULL; - PyObject *__pyx_v_unit_identifier = NULL; - PyObject *__pyx_v_ex = NULL; - RFC_RC __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - RFC_RC __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - char const *__pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__onCommitFunction", 0); - - /* "src/pyrfc/server.pyx":316 - * @staticmethod - * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["commit"] # <<<<<<<<<<<<<< - * if handler is None: - * return RCStatus.OK.value - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_commit); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 316, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_handler = __pyx_t_2; - __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":317 - * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["commit"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2488 + * free(cValue) + * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): + * if type(value) is not int: # <<<<<<<<<<<<<< + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt(container, cName, value, &errorInfo) */ - __pyx_t_3 = (__pyx_v_handler == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + } - /* "src/pyrfc/server.pyx":318 - * handler = Server.__bgRfcFunction["commit"] - * if handler is None: - * return RCStatus.OK.value # <<<<<<<<<<<<<< - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) + /* "pyrfc/_cyrfc.pyx":2490 + * if type(value) is not int: + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt(container, cName, value, &errorInfo) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_INT8: + * if type(value) is not int: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 318, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 318, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 318, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 318, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L0; + __pyx_t_22 = __Pyx_PyInt_As_RFC_INT(__pyx_v_value); if (unlikely((__pyx_t_22 == ((RFC_INT)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2490, __pyx_L3_error) + __pyx_v_rc = RfcSetInt(__pyx_v_container, __pyx_v_cName, __pyx_t_22, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":317 - * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["commit"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2487 + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) + * elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): # <<<<<<<<<<<<<< + * if type(value) is not int: + * raise TypeError('an integer required, received', value, 'of type', type(value)) */ - } + break; + case RFCTYPE_INT8: - /* "src/pyrfc/server.pyx":319 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2492 + * rc = RfcSetInt(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_INT8: + * if type(value) is not int: # <<<<<<<<<<<<<< + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt8(container, cName, value, &errorInfo) */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { + __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyInt_Type))); + __pyx_t_4 = (__pyx_t_5 != 0); + if (unlikely(__pyx_t_4)) { - /* "src/pyrfc/server.pyx":320 - * return RCStatus.OK.value - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: + /* "pyrfc/_cyrfc.pyx":2493 + * elif typ == RFCTYPE_INT8: + * if type(value) is not int: + * raise TypeError('an integer required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * rc = RfcSetInt8(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_UTCLONG: */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 320, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_unit_identifier = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2493, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_kp_s_an_integer_required_received); + __Pyx_GIVEREF(__pyx_kp_s_an_integer_required_received); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_s_an_integer_required_received); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2493, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_Raise(__pyx_t_19, 0, 0, 0); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __PYX_ERR(0, 2493, __pyx_L3_error) - /* "src/pyrfc/server.pyx":321 - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< - * except Exception as ex: - * _server_log("Error in bgRFC handler onCommit:", ex) + /* "pyrfc/_cyrfc.pyx":2492 + * rc = RfcSetInt(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_INT8: + * if type(value) is not int: # <<<<<<<<<<<<<< + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt8(container, cName, value, &errorInfo) */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 321, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_handler); - __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 321, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 321, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 321, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); - __Pyx_INCREF(__pyx_v_unit_identifier); - __Pyx_GIVEREF(__pyx_v_unit_identifier); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 321, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 321, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 321, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L8_try_return; - /* "src/pyrfc/server.pyx":319 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2494 + * if type(value) is not int: + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt8(container, cName, value, &errorInfo) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_UTCLONG: + * if type(value) is not str: */ - } - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_23 = __Pyx_PyInt_As_RFC_INT8(__pyx_v_value); if (unlikely((__pyx_t_23 == ((RFC_INT8)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2494, __pyx_L3_error) + __pyx_v_rc = RfcSetInt8(__pyx_v_container, __pyx_v_cName, __pyx_t_23, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":322 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onCommit:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2491 + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_INT8: # <<<<<<<<<<<<<< + * if type(value) is not int: + * raise TypeError('an integer required, received', value, 'of type', type(value)) */ - __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_11) { - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onCommitFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(5, 322, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_ex = __pyx_t_2; - /*try:*/ { + break; + case RFCTYPE_UTCLONG: - /* "src/pyrfc/server.pyx":323 - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: - * _server_log("Error in bgRFC handler onCommit:", ex) # <<<<<<<<<<<<<< - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * + /* "pyrfc/_cyrfc.pyx":2496 + * rc = RfcSetInt8(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_UTCLONG: + * if type(value) is not str: # <<<<<<<<<<<<<< + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 323, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCommit, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 323, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onCommit, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 323, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 323, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_14); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onCommit); - __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onCommit); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onCommit); - __Pyx_INCREF(__pyx_v_ex); - __Pyx_GIVEREF(__pyx_v_ex); - PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 323, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) != ((PyObject *)(&PyString_Type))); + __pyx_t_5 = (__pyx_t_4 != 0); + if (unlikely(__pyx_t_5)) { - /* "src/pyrfc/server.pyx":324 - * except Exception as ex: - * _server_log("Error in bgRFC handler onCommit:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< - * - * @staticmethod + /* "pyrfc/_cyrfc.pyx":2497 + * elif typ == RFCTYPE_UTCLONG: + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * cValue = fillString(value) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 324, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 324, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 324, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 324, __pyx_L15_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L14_return; - } + __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_kp_s_an_string_is_required_received); + __Pyx_GIVEREF(__pyx_kp_s_an_string_is_required_received); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_s_an_string_is_required_received); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_19, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_19, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2497, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 2497, __pyx_L3_error) - /* "src/pyrfc/server.pyx":322 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onCommit:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2496 + * rc = RfcSetInt8(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_UTCLONG: + * if type(value) is not str: # <<<<<<<<<<<<<< + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) */ - /*finally:*/ { - __pyx_L15_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __pyx_t_11 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22); - } - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19); - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; - goto __pyx_L6_except_error; } - __pyx_L14_return: { - __pyx_t_5 = __pyx_r; - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - __pyx_r = __pyx_t_5; - goto __pyx_L7_except_return; - } - } - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; - /* "src/pyrfc/server.pyx":319 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2498 + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) # <<<<<<<<<<<<<< + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) */ - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L8_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - } + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2498, __pyx_L3_error) + __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/server.pyx":315 - * - * @staticmethod - * cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["commit"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2499 + * raise TypeError('an string is required, received', value, 'of type', type(value)) + * cValue = fillString(value) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) # <<<<<<<<<<<<<< + * free(cValue) + * elif typ == RFCTYPE_DATE: */ + __pyx_v_rc = RfcSetString(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, strlenU(__pyx_v_cValue), (&__pyx_v_errorInfo)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onCommitFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (RFC_RC) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_handler); - __Pyx_XDECREF(__pyx_v_unit_identifier); - __Pyx_XDECREF(__pyx_v_ex); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":327 - * - * @staticmethod - * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["rollback"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2500 + * cValue = fillString(value) + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_DATE: + * if value: */ + free(__pyx_v_cValue); -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onRollbackFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { - PyObject *__pyx_v_handler = NULL; - PyObject *__pyx_v_unit_identifier = NULL; - PyObject *__pyx_v_ex = NULL; - RFC_RC __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - RFC_RC __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - char const *__pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__onRollbackFunction", 0); - - /* "src/pyrfc/server.pyx":328 - * @staticmethod - * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["rollback"] # <<<<<<<<<<<<<< - * if handler is None: - * return RCStatus.OK.value + /* "pyrfc/_cyrfc.pyx":2495 + * raise TypeError('an integer required, received', value, 'of type', type(value)) + * rc = RfcSetInt8(container, cName, value, &errorInfo) + * elif typ == RFCTYPE_UTCLONG: # <<<<<<<<<<<<<< + * if type(value) is not str: + * raise TypeError('an string is required, received', value, 'of type', type(value)) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_rollback); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_handler = __pyx_t_2; - __pyx_t_2 = 0; + break; + case RFCTYPE_DATE: - /* "src/pyrfc/server.pyx":329 - * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["rollback"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2502 + * free(cValue) + * elif typ == RFCTYPE_DATE: + * if value: # <<<<<<<<<<<<<< + * format_ok = True + * if type(value) is date: */ - __pyx_t_3 = (__pyx_v_handler == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2502, __pyx_L3_error) + if (__pyx_t_5) { - /* "src/pyrfc/server.pyx":330 - * handler = Server.__bgRfcFunction["rollback"] - * if handler is None: - * return RCStatus.OK.value # <<<<<<<<<<<<<< - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) + /* "pyrfc/_cyrfc.pyx":2503 + * elif typ == RFCTYPE_DATE: + * if value: + * format_ok = True # <<<<<<<<<<<<<< + * if type(value) is date: + * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 330, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 330, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 330, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 330, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L0; + __pyx_v_format_ok = 1; - /* "src/pyrfc/server.pyx":329 - * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["rollback"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2504 + * if value: + * format_ok = True + * if type(value) is date: # <<<<<<<<<<<<<< + * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') + * else: */ - } + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_date); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2504, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) == __pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_4 = (__pyx_t_5 != 0); + if (__pyx_t_4) { - /* "src/pyrfc/server.pyx":331 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2505 + * format_ok = True + * if type(value) is date: + * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') # <<<<<<<<<<<<<< + * else: + * try: */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { - - /* "src/pyrfc/server.pyx":332 - * return RCStatus.OK.value - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: - */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 332, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_unit_identifier = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = 0; + __pyx_t_24 = 127; + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_year); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_19, __pyx_kp_u_04); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_24; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_month); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_19 = __Pyx_PyObject_Format(__pyx_t_7, __pyx_kp_u_02); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) : __pyx_t_24; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_19); + __Pyx_GIVEREF(__pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_19); + __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_day); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_19, __pyx_kp_u_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_24; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __pyx_t_9, __pyx_t_24); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_7); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2505, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_cValue = __pyx_t_14; - /* "src/pyrfc/server.pyx":333 - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< - * except Exception as ex: - * _server_log("Error in bgRFC handler onRollback:", ex) + /* "pyrfc/_cyrfc.pyx":2504 + * if value: + * format_ok = True + * if type(value) is date: # <<<<<<<<<<<<<< + * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') + * else: */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 333, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_handler); - __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 333, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 333, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 333, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); - __Pyx_INCREF(__pyx_v_unit_identifier); - __Pyx_GIVEREF(__pyx_v_unit_identifier); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 333, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 333, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 333, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L8_try_return; + goto __pyx_L42; + } - /* "src/pyrfc/server.pyx":331 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2507 + * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') + * else: + * try: # <<<<<<<<<<<<<< + * if len(value) != 8: + * format_ok = False */ - } - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + /*else*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_17); + /*try:*/ { - /* "src/pyrfc/server.pyx":334 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onRollback:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2508 + * else: + * try: + * if len(value) != 8: # <<<<<<<<<<<<<< + * format_ok = False + * else: */ - __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_11) { - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onRollbackFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(5, 334, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_ex = __pyx_t_2; - /*try:*/ { + __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2508, __pyx_L43_error) + __pyx_t_4 = ((__pyx_t_9 != 8) != 0); + if (__pyx_t_4) { - /* "src/pyrfc/server.pyx":335 - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: - * _server_log("Error in bgRFC handler onRollback:", ex) # <<<<<<<<<<<<<< - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * + /* "pyrfc/_cyrfc.pyx":2509 + * try: + * if len(value) != 8: + * format_ok = False # <<<<<<<<<<<<<< + * else: + * if len(value.rstrip()) > 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 335, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onRollbac, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 335, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onRollbac, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 335, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 335, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_14); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onRollbac); - __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onRollbac); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onRollbac); - __Pyx_INCREF(__pyx_v_ex); - __Pyx_GIVEREF(__pyx_v_ex); - PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 335, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_format_ok = 0; - /* "src/pyrfc/server.pyx":336 - * except Exception as ex: - * _server_log("Error in bgRFC handler onRollback:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< - * - * @staticmethod + /* "pyrfc/_cyrfc.pyx":2508 + * else: + * try: + * if len(value) != 8: # <<<<<<<<<<<<<< + * format_ok = False + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 336, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 336, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 336, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 336, __pyx_L15_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L14_return; - } + goto __pyx_L49; + } - /* "src/pyrfc/server.pyx":334 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onRollback:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2511 + * format_ok = False + * else: + * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< + * date(int(value[:4]), int(value[4:6]), int(value[6:8])) + * cValue = fillString(value) */ - /*finally:*/ { - __pyx_L15_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __pyx_t_11 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22); - } - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19); - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; - goto __pyx_L6_except_error; - } - __pyx_L14_return: { - __pyx_t_5 = __pyx_r; - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - __pyx_r = __pyx_t_5; - goto __pyx_L7_except_return; - } - } - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + /*else*/ { + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2511, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_19 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_19) : __Pyx_PyObject_CallNoArg(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2511, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2511, __pyx_L43_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = ((__pyx_t_9 > 0) != 0); + if (__pyx_t_4) { - /* "src/pyrfc/server.pyx":331 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2512 + * else: + * if len(value.rstrip()) > 0: + * date(int(value[:4]), int(value[4:6]), int(value[6:8])) # <<<<<<<<<<<<<< + * cValue = fillString(value) + * except Exception as ex: */ - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L8_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - } + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_date); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_19 = __Pyx_PyObject_GetSlice(__pyx_v_value, 0, 4, NULL, NULL, &__pyx_slice__37, 0, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_21 = __Pyx_PyNumber_Int(__pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyObject_GetSlice(__pyx_v_value, 4, 6, NULL, NULL, &__pyx_slice__38, 1, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_19); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyObject_GetSlice(__pyx_v_value, 6, 8, NULL, NULL, &__pyx_slice__39, 1, 1, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_18 = __Pyx_PyNumber_Int(__pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_11)) { + PyObject *__pyx_temp[4] = {__pyx_t_19, __pyx_t_21, __pyx_t_6, __pyx_t_18}; + __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { + PyObject *__pyx_temp[4] = {__pyx_t_19, __pyx_t_21, __pyx_t_6, __pyx_t_18}; + __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } else + #endif + { + __pyx_t_25 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_25); + if (__pyx_t_19) { + __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_19); __pyx_t_19 = NULL; + } + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_10, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_10, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_25, 2+__pyx_t_10, __pyx_t_18); + __pyx_t_21 = 0; + __pyx_t_6 = 0; + __pyx_t_18 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_25, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2512, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":327 - * - * @staticmethod - * cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["rollback"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2511 + * format_ok = False + * else: + * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< + * date(int(value[:4]), int(value[4:6]), int(value[6:8])) + * cValue = fillString(value) */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onRollbackFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (RFC_RC) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_handler); - __Pyx_XDECREF(__pyx_v_unit_identifier); - __Pyx_XDECREF(__pyx_v_ex); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":339 - * - * @staticmethod - * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["confirm"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2513 + * if len(value.rstrip()) > 0: + * date(int(value[:4]), int(value[4:6]), int(value[6:8])) + * cValue = fillString(value) # <<<<<<<<<<<<<< + * except Exception as ex: + * format_ok = False */ + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2513, __pyx_L43_error) + __pyx_v_cValue = __pyx_t_14; + } + __pyx_L49:; -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onConfirmFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier) { - PyObject *__pyx_v_handler = NULL; - PyObject *__pyx_v_unit_identifier = NULL; - PyObject *__pyx_v_ex = NULL; - RFC_RC __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - RFC_RC __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - char const *__pyx_t_16; - PyObject *__pyx_t_17 = NULL; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__onConfirmFunction", 0); - - /* "src/pyrfc/server.pyx":340 - * @staticmethod - * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["confirm"] # <<<<<<<<<<<<<< - * if handler is None: - * return RCStatus.OK.value + /* "pyrfc/_cyrfc.pyx":2507 + * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') + * else: + * try: # <<<<<<<<<<<<<< + * if len(value) != 8: + * format_ok = False */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_confirm); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_handler = __pyx_t_2; - __pyx_t_2 = 0; + } + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + goto __pyx_L48_try_end; + __pyx_L43_error:; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":341 - * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["confirm"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2514 + * date(int(value[:4]), int(value[4:6]), int(value[6:8])) + * cValue = fillString(value) + * except Exception as ex: # <<<<<<<<<<<<<< + * format_ok = False + * if not format_ok: */ - __pyx_t_3 = (__pyx_v_handler == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_25) < 0) __PYX_ERR(0, 2514, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_25); + __Pyx_INCREF(__pyx_t_11); + __pyx_v_ex = __pyx_t_11; - /* "src/pyrfc/server.pyx":342 - * handler = Server.__bgRfcFunction["confirm"] - * if handler is None: - * return RCStatus.OK.value # <<<<<<<<<<<<<< - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) + /* "pyrfc/_cyrfc.pyx":2515 + * cValue = fillString(value) + * except Exception as ex: + * format_ok = False # <<<<<<<<<<<<<< + * if not format_ok: + * raise TypeError('date value required, received', value, 'of type', type(value)) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 342, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L0; + __pyx_v_format_ok = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + goto __pyx_L44_exception_handled; + } + goto __pyx_L45_except_error; + __pyx_L45_except_error:; - /* "src/pyrfc/server.pyx":341 - * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - * handler = Server.__bgRfcFunction["confirm"] - * if handler is None: # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * try: + /* "pyrfc/_cyrfc.pyx":2507 + * cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') + * else: + * try: # <<<<<<<<<<<<<< + * if len(value) != 8: + * format_ok = False */ - } + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); + goto __pyx_L3_error; + __pyx_L44_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); + __pyx_L48_try_end:; + } + } + __pyx_L42:; - /* "src/pyrfc/server.pyx":343 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2516 + * except Exception as ex: + * format_ok = False + * if not format_ok: # <<<<<<<<<<<<<< + * raise TypeError('date value required, received', value, 'of type', type(value)) + * rc = RfcSetDate(container, cName, cValue, &errorInfo) */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { + __pyx_t_4 = ((!(__pyx_v_format_ok != 0)) != 0); + if (unlikely(__pyx_t_4)) { - /* "src/pyrfc/server.pyx":344 - * return RCStatus.OK.value - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: + /* "pyrfc/_cyrfc.pyx":2517 + * format_ok = False + * if not format_ok: + * raise TypeError('date value required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * rc = RfcSetDate(container, cName, cValue, &errorInfo) + * free(cValue) */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 344, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_unit_identifier = __pyx_t_2; - __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":345 - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value # <<<<<<<<<<<<<< - * except Exception as ex: - * _server_log("Error in bgRFC handler onConfirm:", ex) + __pyx_t_25 = PyTuple_New(4); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2517, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_INCREF(__pyx_kp_s_date_value_required_received); + __Pyx_GIVEREF(__pyx_kp_s_date_value_required_received); + PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_kp_s_date_value_required_received); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_25, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_25, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_25, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2517, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 2517, __pyx_L3_error) + + /* "pyrfc/_cyrfc.pyx":2516 + * except Exception as ex: + * format_ok = False + * if not format_ok: # <<<<<<<<<<<<<< + * raise TypeError('date value required, received', value, 'of type', type(value)) + * rc = RfcSetDate(container, cName, cValue, &errorInfo) */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 345, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_handler); - __pyx_t_9 = __pyx_v_handler; __pyx_t_10 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_9, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 345, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 345, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 345, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); - __Pyx_INCREF(__pyx_v_unit_identifier); - __Pyx_GIVEREF(__pyx_v_unit_identifier); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 345, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 345, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 345, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_r = __pyx_t_5; - goto __pyx_L8_try_return; + } - /* "src/pyrfc/server.pyx":343 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2518 + * if not format_ok: + * raise TypeError('date value required, received', value, 'of type', type(value)) + * rc = RfcSetDate(container, cName, cValue, &errorInfo) # <<<<<<<<<<<<<< + * free(cValue) + * else: */ - } - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_rc = RfcSetDate(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":346 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onConfirm:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2519 + * raise TypeError('date value required, received', value, 'of type', type(value)) + * rc = RfcSetDate(container, cName, cValue, &errorInfo) + * free(cValue) # <<<<<<<<<<<<<< + * else: + * rc = RFC_OK */ - __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_11) { - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onConfirmFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(5, 346, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_INCREF(__pyx_t_2); - __pyx_v_ex = __pyx_t_2; - /*try:*/ { + free(__pyx_v_cValue); - /* "src/pyrfc/server.pyx":347 - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: - * _server_log("Error in bgRFC handler onConfirm:", ex) # <<<<<<<<<<<<<< - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * + /* "pyrfc/_cyrfc.pyx":2502 + * free(cValue) + * elif typ == RFCTYPE_DATE: + * if value: # <<<<<<<<<<<<<< + * format_ok = True + * if type(value) is date: */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 347, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onConfirm, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 347, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_s_Error_in_bgRFC_handler_onConfirm, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 347, __pyx_L15_error) - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_14 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 347, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_14); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onConfirm); - __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onConfirm); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onConfirm); - __Pyx_INCREF(__pyx_v_ex); - __Pyx_GIVEREF(__pyx_v_ex); - PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_v_ex); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 347, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + goto __pyx_L41; } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":348 - * except Exception as ex: - * _server_log("Error in bgRFC handler onConfirm:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< - * - * @staticmethod + /* "pyrfc/_cyrfc.pyx":2521 + * free(cValue) + * else: + * rc = RFC_OK # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_TIME: + * if value: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 348, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 348, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 348, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_5 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 348, __pyx_L15_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_5; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L14_return; - } + /*else*/ { + __pyx_v_rc = RFC_OK; + } + __pyx_L41:; - /* "src/pyrfc/server.pyx":346 - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onConfirm:", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2501 + * rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + * free(cValue) + * elif typ == RFCTYPE_DATE: # <<<<<<<<<<<<<< + * if value: + * format_ok = True */ - /*finally:*/ { - __pyx_L15_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_18); - __Pyx_XGOTREF(__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __pyx_t_11 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22); - } - __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_18); - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19); - __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; - __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; - goto __pyx_L6_except_error; - } - __pyx_L14_return: { - __pyx_t_5 = __pyx_r; - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - __pyx_r = __pyx_t_5; - goto __pyx_L7_except_return; - } - } - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + break; + case RFCTYPE_TIME: - /* "src/pyrfc/server.pyx":343 - * if handler is None: - * return RCStatus.OK.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * return handler(rfcHandle, unit_identifier).value + /* "pyrfc/_cyrfc.pyx":2523 + * rc = RFC_OK + * elif typ == RFCTYPE_TIME: + * if value: # <<<<<<<<<<<<<< + * format_ok = True + * if type(value) is time: */ - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L8_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2523, __pyx_L3_error) + if (__pyx_t_4) { - /* "src/pyrfc/server.pyx":339 - * - * @staticmethod - * cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: # <<<<<<<<<<<<<< - * handler = Server.__bgRfcFunction["confirm"] - * if handler is None: + /* "pyrfc/_cyrfc.pyx":2524 + * elif typ == RFCTYPE_TIME: + * if value: + * format_ok = True # <<<<<<<<<<<<<< + * if type(value) is time: + * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') */ + __pyx_v_format_ok = 1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onConfirmFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (RFC_RC) 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_handler); - __Pyx_XDECREF(__pyx_v_unit_identifier); - __Pyx_XDECREF(__pyx_v_ex); - __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2525 + * if value: + * format_ok = True + * if type(value) is time: # <<<<<<<<<<<<<< + * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_time); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2525, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) == __pyx_t_11); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_5 = (__pyx_t_4 != 0); + if (__pyx_t_5) { -/* "src/pyrfc/server.pyx":351 - * - * @staticmethod - * cdef RFC_RC __onGetStateFunction( # <<<<<<<<<<<<<< - * RFC_CONNECTION_HANDLE rfcHandle, - * const RFC_UNIT_IDENTIFIER *identifier, + /* "pyrfc/_cyrfc.pyx":2526 + * format_ok = True + * if type(value) is time: + * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') # <<<<<<<<<<<<<< + * else: + * try: */ + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = 0; + __pyx_t_24 = 127; + __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_hour); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_25, __pyx_kp_u_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_24; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_minute); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_25 = __Pyx_PyObject_Format(__pyx_t_7, __pyx_kp_u_02); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_25) : __pyx_t_24; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_25); + __Pyx_GIVEREF(__pyx_t_25); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_25); + __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_second); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_7 = __Pyx_PyObject_Format(__pyx_t_25, __pyx_kp_u_02); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_24 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_24) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_24; + __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __pyx_t_9, __pyx_t_24); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_7); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2526, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_cValue = __pyx_t_14; -static RFC_RC __pyx_f_5pyrfc_6_cyrfc_6Server___onGetStateFunction(RFC_CONNECTION_HANDLE __pyx_v_rfcHandle, RFC_UNIT_IDENTIFIER const *__pyx_v_identifier, RFC_UNIT_STATE *__pyx_v_unitState) { - PyObject *__pyx_v_handler = NULL; - PyObject *__pyx_v_unit_identifier = NULL; - PyObject *__pyx_v_state = NULL; - PyObject *__pyx_v_ex = NULL; - RFC_RC __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - RFC_RC __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - Py_ssize_t __pyx_t_13; - Py_UCS4 __pyx_t_14; - PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; - int __pyx_t_17; - char const *__pyx_t_18; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - #ifdef WITH_THREAD - PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); - #endif - __Pyx_RefNannySetupContext("__onGetStateFunction", 0); + /* "pyrfc/_cyrfc.pyx":2525 + * if value: + * format_ok = True + * if type(value) is time: # <<<<<<<<<<<<<< + * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') + * else: + */ + goto __pyx_L55; + } - /* "src/pyrfc/server.pyx":356 - * RFC_UNIT_STATE *unitState - * ) with gil: - * handler = Server.__bgRfcFunction["getState"] # <<<<<<<<<<<<<< - * if handler is None: - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + /* "pyrfc/_cyrfc.pyx":2528 + * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') + * else: + * try: # <<<<<<<<<<<<<< + * if len(value) != 6: + * format_ok = False */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_getState); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 356, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_handler = __pyx_t_2; - __pyx_t_2 = 0; + /*else*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_15); + /*try:*/ { - /* "src/pyrfc/server.pyx":357 - * ) with gil: - * handler = Server.__bgRfcFunction["getState"] - * if handler is None: # <<<<<<<<<<<<<< - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2529 + * else: + * try: + * if len(value) != 6: # <<<<<<<<<<<<<< + * format_ok = False + * else: */ - __pyx_t_3 = (__pyx_v_handler == Py_None); - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_9 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2529, __pyx_L56_error) + __pyx_t_5 = ((__pyx_t_9 != 6) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/server.pyx":358 - * handler = Server.__bgRfcFunction["getState"] - * if handler is None: - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") # <<<<<<<<<<<<<< - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * try: + /* "pyrfc/_cyrfc.pyx":2530 + * try: + * if len(value) != 6: + * format_ok = False # <<<<<<<<<<<<<< + * else: + * if len(value.rstrip()) > 0: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_kp_s_bgRFC_handler_onGetState_is_not) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_bgRFC_handler_onGetState_is_not); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_format_ok = 0; - /* "src/pyrfc/server.pyx":359 - * if handler is None: - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") - * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) + /* "pyrfc/_cyrfc.pyx":2529 + * else: + * try: + * if len(value) != 6: # <<<<<<<<<<<<<< + * format_ok = False + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 359, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - goto __pyx_L0; + goto __pyx_L62; + } - /* "src/pyrfc/server.pyx":357 - * ) with gil: - * handler = Server.__bgRfcFunction["getState"] - * if handler is None: # <<<<<<<<<<<<<< - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2532 + * format_ok = False + * else: + * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< + * time(int(value[:2]), int(value[2:4]), int(value[4:6])) + * cValue = fillString(value) */ - } + /*else*/ { + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2532, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_25 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_25)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_25); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_25) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_25) : __Pyx_PyObject_CallNoArg(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2532, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2532, __pyx_L56_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_5 = ((__pyx_t_9 > 0) != 0); + if (__pyx_t_5) { - /* "src/pyrfc/server.pyx":360 - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * state = handler(rfcHandle, unit_identifier) + /* "pyrfc/_cyrfc.pyx":2533 + * else: + * if len(value.rstrip()) > 0: + * time(int(value[:2]), int(value[2:4]), int(value[4:6])) # <<<<<<<<<<<<<< + * cValue = fillString(value) + * except Exception as ex: */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - /*try:*/ { + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_time); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_25 = __Pyx_PyObject_GetSlice(__pyx_v_value, 0, 2, NULL, NULL, &__pyx_slice__29, 0, 1, 1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_18 = __Pyx_PyNumber_Int(__pyx_t_25); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyObject_GetSlice(__pyx_v_value, 2, 4, NULL, NULL, &__pyx_slice__40, 1, 1, 1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_25); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyObject_GetSlice(__pyx_v_value, 4, 6, NULL, NULL, &__pyx_slice__38, 1, 1, 1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_21 = __Pyx_PyNumber_Int(__pyx_t_25); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_25)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_25); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_11)) { + PyObject *__pyx_temp[4] = {__pyx_t_25, __pyx_t_18, __pyx_t_6, __pyx_t_21}; + __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { + PyObject *__pyx_temp[4] = {__pyx_t_25, __pyx_t_18, __pyx_t_6, __pyx_t_21}; + __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + } else + #endif + { + __pyx_t_19 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_19); + if (__pyx_t_25) { + __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_25); __pyx_t_25 = NULL; + } + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_10, __pyx_t_21); + __pyx_t_18 = 0; + __pyx_t_6 = 0; + __pyx_t_21 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_19, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2533, __pyx_L56_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + } + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":361 - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) # <<<<<<<<<<<<<< - * state = handler(rfcHandle, unit_identifier) - * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 + /* "pyrfc/_cyrfc.pyx":2532 + * format_ok = False + * else: + * if len(value.rstrip()) > 0: # <<<<<<<<<<<<<< + * time(int(value[:2]), int(value[2:4]), int(value[4:6])) + * cValue = fillString(value) */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier((__pyx_v_identifier[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 361, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_unit_identifier = __pyx_t_2; - __pyx_t_2 = 0; + } - /* "src/pyrfc/server.pyx":362 - * try: - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * state = handler(rfcHandle, unit_identifier) # <<<<<<<<<<<<<< - * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 - * if state == UnitState.created or state == UnitState.executed: - */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_rfcHandle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 362, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_handler); - __pyx_t_5 = __pyx_v_handler; __pyx_t_10 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 362, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_1, __pyx_v_unit_identifier}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 362, __pyx_L4_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 362, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_1); - __Pyx_INCREF(__pyx_v_unit_identifier); - __Pyx_GIVEREF(__pyx_v_unit_identifier); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_unit_identifier); - __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 362, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_state = __pyx_t_2; - __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":364 - * state = handler(rfcHandle, unit_identifier) - * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 - * if state == UnitState.created or state == UnitState.executed: # <<<<<<<<<<<<<< - * unitState[0] = RFC_UNIT_IN_PROCESS - * elif state == UnitState.committed: + /* "pyrfc/_cyrfc.pyx":2534 + * if len(value.rstrip()) > 0: + * time(int(value[:2]), int(value[2:4]), int(value[4:6])) + * cValue = fillString(value) # <<<<<<<<<<<<<< + * except Exception as ex: + * format_ok = False */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_created); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_3) { - } else { - __pyx_t_4 = __pyx_t_3; - goto __pyx_L11_bool_binop_done; - } - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_executed); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 364, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_t_3; - __pyx_L11_bool_binop_done:; - if (__pyx_t_4) { + __pyx_t_14 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_value); if (unlikely(__pyx_t_14 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2534, __pyx_L56_error) + __pyx_v_cValue = __pyx_t_14; + } + __pyx_L62:; - /* "src/pyrfc/server.pyx":365 - * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 - * if state == UnitState.created or state == UnitState.executed: - * unitState[0] = RFC_UNIT_IN_PROCESS # <<<<<<<<<<<<<< - * elif state == UnitState.committed: - * idunitStateentifier[0] = RFC_UNIT_COMMITTED + /* "pyrfc/_cyrfc.pyx":2528 + * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') + * else: + * try: # <<<<<<<<<<<<<< + * if len(value) != 6: + * format_ok = False */ - (__pyx_v_unitState[0]) = RFC_UNIT_IN_PROCESS; + } + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + goto __pyx_L61_try_end; + __pyx_L56_error:; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "src/pyrfc/server.pyx":364 - * state = handler(rfcHandle, unit_identifier) - * # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 - * if state == UnitState.created or state == UnitState.executed: # <<<<<<<<<<<<<< - * unitState[0] = RFC_UNIT_IN_PROCESS - * elif state == UnitState.committed: + /* "pyrfc/_cyrfc.pyx":2535 + * time(int(value[:2]), int(value[2:4]), int(value[4:6])) + * cValue = fillString(value) + * except Exception as ex: # <<<<<<<<<<<<<< + * format_ok = False + * */ - goto __pyx_L10; - } + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_11, &__pyx_t_19) < 0) __PYX_ERR(0, 2535, __pyx_L58_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_t_11); + __pyx_v_ex = __pyx_t_11; - /* "src/pyrfc/server.pyx":366 - * if state == UnitState.created or state == UnitState.executed: - * unitState[0] = RFC_UNIT_IN_PROCESS - * elif state == UnitState.committed: # <<<<<<<<<<<<<< - * idunitStateentifier[0] = RFC_UNIT_COMMITTED - * elif state == UnitState.rolled_back: + /* "pyrfc/_cyrfc.pyx":2536 + * cValue = fillString(value) + * except Exception as ex: + * format_ok = False # <<<<<<<<<<<<<< + * + * if not format_ok: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 366, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_committed); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 366, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 366, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(5, 366, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { + __pyx_v_format_ok = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + goto __pyx_L57_exception_handled; + } + goto __pyx_L58_except_error; + __pyx_L58_except_error:; - /* "src/pyrfc/server.pyx":367 - * unitState[0] = RFC_UNIT_IN_PROCESS - * elif state == UnitState.committed: - * idunitStateentifier[0] = RFC_UNIT_COMMITTED # <<<<<<<<<<<<<< - * elif state == UnitState.rolled_back: - * unitState[0] = RFC_UNIT_ROLLED_BACK + /* "pyrfc/_cyrfc.pyx":2528 + * cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') + * else: + * try: # <<<<<<<<<<<<<< + * if len(value) != 6: + * format_ok = False */ - __pyx_t_2 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_COMMITTED); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 367, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_idunitStateentifier); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 367, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_SetItemInt(__pyx_t_5, 0, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(5, 367, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15); + goto __pyx_L3_error; + __pyx_L57_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_17); + __Pyx_XGIVEREF(__pyx_t_16); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_16, __pyx_t_15); + __pyx_L61_try_end:; + } + } + __pyx_L55:; - /* "src/pyrfc/server.pyx":366 - * if state == UnitState.created or state == UnitState.executed: - * unitState[0] = RFC_UNIT_IN_PROCESS - * elif state == UnitState.committed: # <<<<<<<<<<<<<< - * idunitStateentifier[0] = RFC_UNIT_COMMITTED - * elif state == UnitState.rolled_back: + /* "pyrfc/_cyrfc.pyx":2538 + * format_ok = False + * + * if not format_ok: # <<<<<<<<<<<<<< + * raise TypeError('time value required, received', value, 'of type', type(value)) + * rc = RfcSetTime(container, cName, cValue, &errorInfo) */ - goto __pyx_L10; - } + __pyx_t_5 = ((!(__pyx_v_format_ok != 0)) != 0); + if (unlikely(__pyx_t_5)) { - /* "src/pyrfc/server.pyx":368 - * elif state == UnitState.committed: - * idunitStateentifier[0] = RFC_UNIT_COMMITTED - * elif state == UnitState.rolled_back: # <<<<<<<<<<<<<< - * unitState[0] = RFC_UNIT_ROLLED_BACK - * elif state == UnitState.confirmed: + /* "pyrfc/_cyrfc.pyx":2539 + * + * if not format_ok: + * raise TypeError('time value required, received', value, 'of type', type(value)) # <<<<<<<<<<<<<< + * rc = RfcSetTime(container, cName, cValue, &errorInfo) + * free(cValue) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 368, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_rolled_back); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 368, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 368, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(5, 368, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { + __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2539, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_INCREF(__pyx_kp_s_time_value_required_received); + __Pyx_GIVEREF(__pyx_kp_s_time_value_required_received); + PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_kp_s_time_value_required_received); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_of_type); + __Pyx_GIVEREF(__pyx_kp_s_of_type); + PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_kp_s_of_type); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_value))); + PyTuple_SET_ITEM(__pyx_t_19, 3, ((PyObject *)Py_TYPE(__pyx_v_value))); + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_19, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2539, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 2539, __pyx_L3_error) - /* "src/pyrfc/server.pyx":369 - * idunitStateentifier[0] = RFC_UNIT_COMMITTED - * elif state == UnitState.rolled_back: - * unitState[0] = RFC_UNIT_ROLLED_BACK # <<<<<<<<<<<<<< - * elif state == UnitState.confirmed: - * unitState[0] = RFC_UNIT_CONFIRMED + /* "pyrfc/_cyrfc.pyx":2538 + * format_ok = False + * + * if not format_ok: # <<<<<<<<<<<<<< + * raise TypeError('time value required, received', value, 'of type', type(value)) + * rc = RfcSetTime(container, cName, cValue, &errorInfo) */ - (__pyx_v_unitState[0]) = RFC_UNIT_ROLLED_BACK; + } - /* "src/pyrfc/server.pyx":368 - * elif state == UnitState.committed: - * idunitStateentifier[0] = RFC_UNIT_COMMITTED - * elif state == UnitState.rolled_back: # <<<<<<<<<<<<<< - * unitState[0] = RFC_UNIT_ROLLED_BACK - * elif state == UnitState.confirmed: + /* "pyrfc/_cyrfc.pyx":2540 + * if not format_ok: + * raise TypeError('time value required, received', value, 'of type', type(value)) + * rc = RfcSetTime(container, cName, cValue, &errorInfo) # <<<<<<<<<<<<<< + * free(cValue) + * else: */ - goto __pyx_L10; - } + __pyx_v_rc = RfcSetTime(__pyx_v_container, __pyx_v_cName, __pyx_v_cValue, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":370 - * elif state == UnitState.rolled_back: - * unitState[0] = RFC_UNIT_ROLLED_BACK - * elif state == UnitState.confirmed: # <<<<<<<<<<<<<< - * unitState[0] = RFC_UNIT_CONFIRMED + /* "pyrfc/_cyrfc.pyx":2541 + * raise TypeError('time value required, received', value, 'of type', type(value)) + * rc = RfcSetTime(container, cName, cValue, &errorInfo) + * free(cValue) # <<<<<<<<<<<<<< * else: + * rc = RFC_OK */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UnitState); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 370, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_confirmed); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 370, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_state, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 370, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(5, 370, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(__pyx_t_4)) { + free(__pyx_v_cValue); - /* "src/pyrfc/server.pyx":371 - * unitState[0] = RFC_UNIT_ROLLED_BACK - * elif state == UnitState.confirmed: - * unitState[0] = RFC_UNIT_CONFIRMED # <<<<<<<<<<<<<< - * else: - * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") + /* "pyrfc/_cyrfc.pyx":2523 + * rc = RFC_OK + * elif typ == RFCTYPE_TIME: + * if value: # <<<<<<<<<<<<<< + * format_ok = True + * if type(value) is time: */ - (__pyx_v_unitState[0]) = RFC_UNIT_CONFIRMED; + goto __pyx_L54; + } - /* "src/pyrfc/server.pyx":370 - * elif state == UnitState.rolled_back: - * unitState[0] = RFC_UNIT_ROLLED_BACK - * elif state == UnitState.confirmed: # <<<<<<<<<<<<<< - * unitState[0] = RFC_UNIT_CONFIRMED + /* "pyrfc/_cyrfc.pyx":2543 + * free(cValue) * else: + * rc = RFC_OK # <<<<<<<<<<<<<< + * else: + * raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) */ - goto __pyx_L10; - } + /*else*/ { + __pyx_v_rc = RFC_OK; + } + __pyx_L54:; - /* "src/pyrfc/server.pyx":373 - * unitState[0] = RFC_UNIT_CONFIRMED + /* "pyrfc/_cyrfc.pyx":2522 * else: - * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") # <<<<<<<<<<<<<< - * return RCStatus.OK.value - * except Exception as ex: + * rc = RFC_OK + * elif typ == RFCTYPE_TIME: # <<<<<<<<<<<<<< + * if value: + * format_ok = True */ - /*else*/ { - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 373, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = 0; - __pyx_t_14 = 127; - __Pyx_INCREF(__pyx_kp_u_TID); - __pyx_t_13 += 4; - __Pyx_GIVEREF(__pyx_kp_u_TID); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_TID); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit_identifier, __pyx_n_s_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 373, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 373, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_14; - __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_12); - __pyx_t_12 = 0; - __Pyx_INCREF(__pyx_kp_u_invalid_state); - __pyx_t_13 += 16; - __Pyx_GIVEREF(__pyx_kp_u_invalid_state); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_invalid_state); - __pyx_t_12 = __Pyx_PyObject_FormatSimple(__pyx_v_state, __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 373, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_12) : __pyx_t_14; - __pyx_t_13 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_12); - __pyx_t_12 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_13 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__6); - __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 373, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 373, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(5, 373, __pyx_L4_error) - } - __pyx_L10:; + break; + default: - /* "src/pyrfc/server.pyx":374 - * else: - * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") - * return RCStatus.OK.value # <<<<<<<<<<<<<< - * except Exception as ex: - * _server_log("Error in bgRFC handler onGetState:\n", ex) + /* "pyrfc/_cyrfc.pyx":2545 + * rc = RFC_OK + * else: + * raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) # <<<<<<<<<<<<<< + * except TypeError as e: + * # This way the field name will be attached in reverse direction */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 374, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OK); if (unlikely(!__pyx_t_12)) __PYX_ERR(5, 374, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 374, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_6 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 374, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_6; - goto __pyx_L8_try_return; + __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2545, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_19); + __pyx_t_7 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_typ); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2545, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_21 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_cName, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2545, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2545, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_21); + __pyx_t_7 = 0; + __pyx_t_21 = 0; + __pyx_t_21 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_RFC_type_d_when_filling, __pyx_t_6); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2545, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + } + } + __pyx_t_11 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_19, __pyx_t_6, __pyx_t_21) : __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_21); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2545, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __PYX_ERR(0, 2545, __pyx_L3_error) + break; + } - /* "src/pyrfc/server.pyx":360 - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * state = handler(rfcHandle, unit_identifier) + /* "pyrfc/_cyrfc.pyx":2422 + * global _LOCALE_RADIX + * # print ("fill", wrapString(cName), value, type(value)) + * try: # <<<<<<<<<<<<<< + * if typ == RFCTYPE_STRUCTURE: + * if type(value) is not dict: */ } - __pyx_L4_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_try_end; + __pyx_L3_error:; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "pyrfc/_cyrfc.pyx":2546 + * else: + * raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) + * except TypeError as e: # <<<<<<<<<<<<<< + * # This way the field name will be attached in reverse direction + * # to the argument list of the exception. This helps users to find + */ + __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); + if (__pyx_t_10) { + __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_19, &__pyx_t_21) < 0) __PYX_ERR(0, 2546, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_t_19); + __Pyx_GOTREF(__pyx_t_21); + __Pyx_INCREF(__pyx_t_19); + __pyx_v_e = __pyx_t_19; + + /* "pyrfc/_cyrfc.pyx":2550 + * # to the argument list of the exception. This helps users to find + * # mistakes easier in complex mapping scenarios. + * e.args += (wrapString(cName), ) # <<<<<<<<<<<<<< + * raise + * if rc != RFC_OK: + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2550, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_cName, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2550, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 2550, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_6, __pyx_t_18); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2550, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_e, __pyx_n_s_args, __pyx_t_7) < 0) __PYX_ERR(0, 2550, __pyx_L5_except_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "pyrfc/_cyrfc.pyx":2551 + * # mistakes easier in complex mapping scenarios. + * e.args += (wrapString(cName), ) + * raise # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_21); + __Pyx_ErrRestoreWithState(__pyx_t_11, __pyx_t_19, __pyx_t_21); + __pyx_t_11 = 0; __pyx_t_19 = 0; __pyx_t_21 = 0; + __PYX_ERR(0, 2551, __pyx_L5_except_error) + } + goto __pyx_L5_except_error; + __pyx_L5_except_error:; + + /* "pyrfc/_cyrfc.pyx":2422 + * global _LOCALE_RADIX + * # print ("fill", wrapString(cName), value, type(value)) + * try: # <<<<<<<<<<<<<< + * if typ == RFCTYPE_STRUCTURE: + * if type(value) is not dict: + */ + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_2); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L8_try_end:; + } + + /* "pyrfc/_cyrfc.pyx":2552 + * e.args += (wrapString(cName), ) + * raise + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * + */ + __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_5)) { + + /* "pyrfc/_cyrfc.pyx":2553 + * raise + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * + * cdef SAP_RAW* fillBytes(pystr) except NULL: + */ + __pyx_t_21 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 2553, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_Raise(__pyx_t_21, 0, 0, 0); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __PYX_ERR(0, 2553, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2552 + * e.args += (wrapString(cName), ) + * raise + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * + */ + } + + /* "pyrfc/_cyrfc.pyx":2413 + * i += 1 + * + * cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_25); + __Pyx_AddTraceback("pyrfc._cyrfc.fillVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_ex); + __Pyx_XDECREF(__pyx_v_svalue); + __Pyx_XDECREF(__pyx_v_locale_radix); + __Pyx_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2555 + * raise wrapError(&errorInfo) + * + * cdef SAP_RAW* fillBytes(pystr) except NULL: # <<<<<<<<<<<<<< + * cdef size_t size = len(pystr) + * cdef SAP_RAW* bytes = malloc(size) + */ + +static SAP_RAW *__pyx_f_5pyrfc_6_cyrfc_fillBytes(PyObject *__pyx_v_pystr) { + size_t __pyx_v_size; + SAP_RAW *__pyx_v_bytes; + SAP_RAW *__pyx_r; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + char *__pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillBytes", 0); + + /* "pyrfc/_cyrfc.pyx":2556 + * + * cdef SAP_RAW* fillBytes(pystr) except NULL: + * cdef size_t size = len(pystr) # <<<<<<<<<<<<<< + * cdef SAP_RAW* bytes = malloc(size) + * memcpy(bytes, pystr, size) + */ + __pyx_t_1 = PyObject_Length(__pyx_v_pystr); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2556, __pyx_L1_error) + __pyx_v_size = __pyx_t_1; + + /* "pyrfc/_cyrfc.pyx":2557 + * cdef SAP_RAW* fillBytes(pystr) except NULL: + * cdef size_t size = len(pystr) + * cdef SAP_RAW* bytes = malloc(size) # <<<<<<<<<<<<<< + * memcpy(bytes, pystr, size) + * return bytes + */ + __pyx_v_bytes = ((SAP_RAW *)malloc(__pyx_v_size)); + + /* "pyrfc/_cyrfc.pyx":2558 + * cdef size_t size = len(pystr) + * cdef SAP_RAW* bytes = malloc(size) + * memcpy(bytes, pystr, size) # <<<<<<<<<<<<<< + * return bytes + * + */ + __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_pystr); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2558, __pyx_L1_error) + (void)(memcpy(__pyx_v_bytes, ((char *)__pyx_t_2), __pyx_v_size)); + + /* "pyrfc/_cyrfc.pyx":2559 + * cdef SAP_RAW* bytes = malloc(size) + * memcpy(bytes, pystr, size) + * return bytes # <<<<<<<<<<<<<< + * + * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): + */ + __pyx_r = __pyx_v_bytes; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":2555 + * raise wrapError(&errorInfo) + * + * cdef SAP_RAW* fillBytes(pystr) except NULL: # <<<<<<<<<<<<<< + * cdef size_t size = len(pystr) + * cdef SAP_RAW* bytes = malloc(size) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pyrfc._cyrfc.fillBytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2561 + * return bytes + * + * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * group2error = { + * ABAPApplicationError: ABAP_APPLICATION_FAILURE, + */ + +static PyObject *__pyx_f_5pyrfc_6_cyrfc_fillError(PyObject *__pyx_v_exception, RFC_ERROR_INFO *__pyx_v_errorInfo) { + PyObject *__pyx_v_group2error = NULL; + PyObject *__pyx_v_str = NULL; + SAP_UC *__pyx_v_sapuc; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + RFC_ERROR_GROUP __pyx_t_6; + SAP_UC *__pyx_t_7; + long __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + RFC_RC __pyx_t_11; + RFC_RC __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillError", 0); + + /* "pyrfc/_cyrfc.pyx":2563 + * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): + * group2error = { + * ABAPApplicationError: ABAP_APPLICATION_FAILURE, # <<<<<<<<<<<<<< + * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, + * LogonError: LOGON_FAILURE, + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ABAPApplicationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_APPLICATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":2564 + * group2error = { + * ABAPApplicationError: ABAP_APPLICATION_FAILURE, + * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, # <<<<<<<<<<<<<< + * LogonError: LOGON_FAILURE, + * CommunicationError: COMMUNICATION_FAILURE, + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ABAPRuntimeError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_RUNTIME_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2564, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2565 + * ABAPApplicationError: ABAP_APPLICATION_FAILURE, + * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, + * LogonError: LOGON_FAILURE, # <<<<<<<<<<<<<< + * CommunicationError: COMMUNICATION_FAILURE, + * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_LogonError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(LOGON_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":2566 + * ABAPRuntimeError: ABAP_RUNTIME_FAILURE, + * LogonError: LOGON_FAILURE, + * CommunicationError: COMMUNICATION_FAILURE, # <<<<<<<<<<<<<< + * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, + * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CommunicationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(COMMUNICATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2567 + * LogonError: LOGON_FAILURE, + * CommunicationError: COMMUNICATION_FAILURE, + * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, # <<<<<<<<<<<<<< + * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, + * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2567, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_RUNTIME_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2567, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":2568 + * CommunicationError: COMMUNICATION_FAILURE, + * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, + * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, # <<<<<<<<<<<<<< + * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE + * } + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ExternalApplicationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_APPLICATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2568, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2569 + * ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, + * ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, + * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE # <<<<<<<<<<<<<< + * } + * if type(exception) not in group2error: + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExternalAuthorizationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_AUTHORIZATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 2563, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_group2error = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2571 + * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE + * } + * if type(exception) not in group2error: # <<<<<<<<<<<<<< + * raise RFCError("Not a valid error group.") + * + */ + __pyx_t_4 = (__Pyx_PyDict_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_exception)), __pyx_v_group2error, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2571, __pyx_L1_error) + __pyx_t_5 = (__pyx_t_4 != 0); + if (unlikely(__pyx_t_5)) { + + /* "pyrfc/_cyrfc.pyx":2572 + * } + * if type(exception) not in group2error: + * raise RFCError("Not a valid error group.") # <<<<<<<<<<<<<< + * + * errorInfo.group = group2error.get(type(exception)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s_Not_a_valid_error_group) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Not_a_valid_error_group); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2572, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2572, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2571 + * ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE + * } + * if type(exception) not in group2error: # <<<<<<<<<<<<<< + * raise RFCError("Not a valid error group.") + * + */ + } + + /* "pyrfc/_cyrfc.pyx":2574 + * raise RFCError("Not a valid error group.") + * + * errorInfo.group = group2error.get(type(exception)) # <<<<<<<<<<<<<< + * + * if exception.message: # fixed length, exactly 512 chars + */ + __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_group2error, ((PyObject *)Py_TYPE(__pyx_v_exception)), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2574, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = ((RFC_ERROR_GROUP)__Pyx_PyInt_As_RFC_ERROR_GROUP(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2574, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_errorInfo->group = __pyx_t_6; + + /* "pyrfc/_cyrfc.pyx":2576 + * errorInfo.group = group2error.get(type(exception)) + * + * if exception.message: # fixed length, exactly 512 chars # <<<<<<<<<<<<<< + * # str = exception.message[0:512].ljust(512) + * str = exception.message[0:512] + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2576, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2578 + * if exception.message: # fixed length, exactly 512 chars + * # str = exception.message[0:512].ljust(512) + * str = exception.message[0:512] # <<<<<<<<<<<<<< + * sapuc = fillString(str) + * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 0x200, NULL, NULL, &__pyx_slice__41, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_str = __pyx_t_3; + __pyx_t_3 = 0; + + /* "pyrfc/_cyrfc.pyx":2579 + * # str = exception.message[0:512].ljust(512) + * str = exception.message[0:512] + * sapuc = fillString(str) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) + * free(sapuc) + */ + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_str); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2579, __pyx_L1_error) + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2580 + * str = exception.message[0:512] + * sapuc = fillString(str) + * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) # <<<<<<<<<<<<<< + * free(sapuc) + * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + */ + __pyx_t_8 = 0x200; + __pyx_t_9 = PyObject_Length(__pyx_v_str); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2580, __pyx_L1_error) + __pyx_t_10 = (__pyx_t_9 + 1); + if (((__pyx_t_8 < __pyx_t_10) != 0)) { + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_10; + } + strncpyU(__pyx_v_errorInfo->message, __pyx_v_sapuc, __pyx_t_9); + + /* "pyrfc/_cyrfc.pyx":2581 + * sapuc = fillString(str) + * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) + * free(sapuc) # <<<<<<<<<<<<<< + * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + * if exception.key: # fixed length, exactly 128 chars + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2576 + * errorInfo.group = group2error.get(type(exception)) + * + * if exception.message: # fixed length, exactly 512 chars # <<<<<<<<<<<<<< + * # str = exception.message[0:512].ljust(512) + * str = exception.message[0:512] + */ + } + + /* "pyrfc/_cyrfc.pyx":2582 + * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) + * free(sapuc) + * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR # <<<<<<<<<<<<<< + * if exception.key: # fixed length, exactly 128 chars + * str = exception.key[0:128] + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2582, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_3)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2582, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_11 = __pyx_t_12; + } else { + __pyx_t_11 = RFC_UNKNOWN_ERROR; + } + __pyx_v_errorInfo->code = __pyx_t_11; + + /* "pyrfc/_cyrfc.pyx":2583 + * free(sapuc) + * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + * if exception.key: # fixed length, exactly 128 chars # <<<<<<<<<<<<<< + * str = exception.key[0:128] + * sapuc = fillString(str) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2583, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2584 + * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + * if exception.key: # fixed length, exactly 128 chars + * str = exception.key[0:128] # <<<<<<<<<<<<<< + * sapuc = fillString(str) + * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 0x80, NULL, NULL, &__pyx_slice__42, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_str, __pyx_t_1); + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2585 + * if exception.key: # fixed length, exactly 128 chars + * str = exception.key[0:128] + * sapuc = fillString(str) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + * free(sapuc) + */ + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_str); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2585, __pyx_L1_error) + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2586 + * str = exception.key[0:128] + * sapuc = fillString(str) + * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) # <<<<<<<<<<<<<< + * free(sapuc) + * if exception.msg_class: + */ + __pyx_t_8 = 0x80; + __pyx_t_9 = PyObject_Length(__pyx_v_str); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2586, __pyx_L1_error) + __pyx_t_10 = (__pyx_t_9 + 1); + if (((__pyx_t_8 < __pyx_t_10) != 0)) { + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_10; + } + strncpyU(__pyx_v_errorInfo->key, __pyx_v_sapuc, __pyx_t_9); + + /* "pyrfc/_cyrfc.pyx":2587 + * sapuc = fillString(str) + * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + * free(sapuc) # <<<<<<<<<<<<<< + * if exception.msg_class: + * sapuc = fillString(exception.msg_class[0:20]) + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2583 + * free(sapuc) + * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + * if exception.key: # fixed length, exactly 128 chars # <<<<<<<<<<<<<< + * str = exception.key[0:128] + * sapuc = fillString(str) + */ + } + + /* "pyrfc/_cyrfc.pyx":2588 + * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + * free(sapuc) + * if exception.msg_class: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_class[0:20]) + * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2588, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2589 + * free(sapuc) + * if exception.msg_class: + * sapuc = fillString(exception.msg_class[0:20]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 20, NULL, NULL, &__pyx_slice__14, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2589, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2590 + * if exception.msg_class: + * sapuc = fillString(exception.msg_class[0:20]) + * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if exception.msg_type: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 20, NULL, NULL, &__pyx_slice__14, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2590, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_errorInfo->abapMsgClass, __pyx_v_sapuc, (__pyx_t_9 + 1)); + + /* "pyrfc/_cyrfc.pyx":2591 + * sapuc = fillString(exception.msg_class[0:20]) + * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if exception.msg_type: + * sapuc = fillString(exception.msg_type[0:1]) + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2588 + * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + * free(sapuc) + * if exception.msg_class: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_class[0:20]) + * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + */ + } + + /* "pyrfc/_cyrfc.pyx":2592 + * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + * free(sapuc) + * if exception.msg_type: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_type[0:1]) + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2592, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2592, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2593 + * free(sapuc) + * if exception.msg_type: + * sapuc = fillString(exception.msg_type[0:1]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 1, NULL, NULL, &__pyx_slice__43, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2593, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2594 + * if exception.msg_type: + * sapuc = fillString(exception.msg_type[0:1]) + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if exception.msg_number: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 1, NULL, NULL, &__pyx_slice__43, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2594, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2594, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_errorInfo->abapMsgType, __pyx_v_sapuc, (__pyx_t_9 + 1)); + + /* "pyrfc/_cyrfc.pyx":2595 + * sapuc = fillString(exception.msg_type[0:1]) + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if exception.msg_number: + * sapuc = fillString(exception.msg_number[0:3]) + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2592 + * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + * free(sapuc) + * if exception.msg_type: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_type[0:1]) + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + */ + } + + /* "pyrfc/_cyrfc.pyx":2596 + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + * free(sapuc) + * if exception.msg_number: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_number[0:3]) + * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2596, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2597 + * free(sapuc) + * if exception.msg_number: + * sapuc = fillString(exception.msg_number[0:3]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 3, NULL, NULL, &__pyx_slice__13, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2598 + * if exception.msg_number: + * sapuc = fillString(exception.msg_number[0:3]) + * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if exception.msg_v1: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_number); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 3, NULL, NULL, &__pyx_slice__13, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2598, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2598, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_errorInfo->abapMsgNumber, __pyx_v_sapuc, (__pyx_t_9 + 1)); + + /* "pyrfc/_cyrfc.pyx":2599 + * sapuc = fillString(exception.msg_number[0:3]) + * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if exception.msg_v1: + * sapuc = fillString(exception.msg_v1[0:50]) + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2596 + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + * free(sapuc) + * if exception.msg_number: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_number[0:3]) + * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + */ + } + + /* "pyrfc/_cyrfc.pyx":2600 + * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + * free(sapuc) + * if exception.msg_v1: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v1[0:50]) + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2600, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2601 + * free(sapuc) + * if exception.msg_v1: + * sapuc = fillString(exception.msg_v1[0:50]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2601, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2602 + * if exception.msg_v1: + * sapuc = fillString(exception.msg_v1[0:50]) + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if exception.msg_v2: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2602, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_errorInfo->abapMsgV1, __pyx_v_sapuc, (__pyx_t_9 + 1)); + + /* "pyrfc/_cyrfc.pyx":2603 + * sapuc = fillString(exception.msg_v1[0:50]) + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if exception.msg_v2: + * sapuc = fillString(exception.msg_v2[0:50]) + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2600 + * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + * free(sapuc) + * if exception.msg_v1: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v1[0:50]) + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + */ + } + + /* "pyrfc/_cyrfc.pyx":2604 + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + * free(sapuc) + * if exception.msg_v2: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v2[0:50]) + * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2604, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2604, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2605 + * free(sapuc) + * if exception.msg_v2: + * sapuc = fillString(exception.msg_v2[0:50]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2605, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2605, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2606 + * if exception.msg_v2: + * sapuc = fillString(exception.msg_v2[0:50]) + * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if exception.msg_v3: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2606, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2606, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2606, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_errorInfo->abapMsgV2, __pyx_v_sapuc, (__pyx_t_9 + 1)); + + /* "pyrfc/_cyrfc.pyx":2607 + * sapuc = fillString(exception.msg_v2[0:50]) + * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if exception.msg_v3: + * sapuc = fillString(exception.msg_v3[0:50]) + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2604 + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + * free(sapuc) + * if exception.msg_v2: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v2[0:50]) + * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + */ + } + + /* "pyrfc/_cyrfc.pyx":2608 + * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + * free(sapuc) + * if exception.msg_v3: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v3[0:50]) + * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2608, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2608, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2609 + * free(sapuc) + * if exception.msg_v3: + * sapuc = fillString(exception.msg_v3[0:50]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2609, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2610 + * if exception.msg_v3: + * sapuc = fillString(exception.msg_v3[0:50]) + * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * if exception.msg_v4: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2610, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2610, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_errorInfo->abapMsgV3, __pyx_v_sapuc, (__pyx_t_9 + 1)); + + /* "pyrfc/_cyrfc.pyx":2611 + * sapuc = fillString(exception.msg_v3[0:50]) + * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * if exception.msg_v4: + * sapuc = fillString(exception.msg_v4[0:50]) + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2608 + * strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + * free(sapuc) + * if exception.msg_v3: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v3[0:50]) + * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + */ + } + + /* "pyrfc/_cyrfc.pyx":2612 + * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + * free(sapuc) + * if exception.msg_v4: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v4[0:50]) + * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2612, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2612, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2613 + * free(sapuc) + * if exception.msg_v4: + * sapuc = fillString(exception.msg_v4[0:50]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) + * free(sapuc) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_3); if (unlikely(__pyx_t_7 == ((SAP_UC *)NULL))) __PYX_ERR(0, 2613, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sapuc = __pyx_t_7; + + /* "pyrfc/_cyrfc.pyx":2614 + * if exception.msg_v4: + * sapuc = fillString(exception.msg_v4[0:50]) + * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) # <<<<<<<<<<<<<< + * free(sapuc) + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_msg_v4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_3, 0, 50, NULL, NULL, &__pyx_slice__44, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2614, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + strncpyU(__pyx_v_errorInfo->abapMsgV4, __pyx_v_sapuc, (__pyx_t_9 + 1)); + + /* "pyrfc/_cyrfc.pyx":2615 + * sapuc = fillString(exception.msg_v4[0:50]) + * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) + * free(sapuc) # <<<<<<<<<<<<<< + * + * cdef SAP_UC* fillString(pyuc) except NULL: + */ + free(__pyx_v_sapuc); + + /* "pyrfc/_cyrfc.pyx":2612 + * strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + * free(sapuc) + * if exception.msg_v4: # <<<<<<<<<<<<<< + * sapuc = fillString(exception.msg_v4[0:50]) + * strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) + */ + } + + /* "pyrfc/_cyrfc.pyx":2561 + * return bytes + * + * cdef fillError(exception, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * group2error = { + * ABAPApplicationError: ABAP_APPLICATION_FAILURE, + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.fillError", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_group2error); + __Pyx_XDECREF(__pyx_v_str); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2617 + * free(sapuc) + * + * cdef SAP_UC* fillString(pyuc) except NULL: # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + */ + +static SAP_UC *__pyx_f_5pyrfc_6_cyrfc_fillString(PyObject *__pyx_v_pyuc) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + PyObject *__pyx_v_ucbytes = NULL; + unsigned int __pyx_v_ucbytes_len; + unsigned int __pyx_v_sapuc_size; + SAP_UC *__pyx_v_sapuc; + unsigned int __pyx_v_result_len; + SAP_UC *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + unsigned char const *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fillString", 0); + + /* "pyrfc/_cyrfc.pyx":2620 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * ucbytes = pyuc.encode() # <<<<<<<<<<<<<< + * cdef unsigned ucbytes_len = len(ucbytes) + * cdef unsigned sapuc_size = ucbytes_len + 1 + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pyuc, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_ucbytes = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":2621 + * cdef RFC_ERROR_INFO errorInfo + * ucbytes = pyuc.encode() + * cdef unsigned ucbytes_len = len(ucbytes) # <<<<<<<<<<<<<< + * cdef unsigned sapuc_size = ucbytes_len + 1 + * cdef SAP_UC* sapuc = mallocU(sapuc_size) + */ + __pyx_t_4 = PyObject_Length(__pyx_v_ucbytes); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2621, __pyx_L1_error) + __pyx_v_ucbytes_len = ((unsigned int)__pyx_t_4); + + /* "pyrfc/_cyrfc.pyx":2622 + * ucbytes = pyuc.encode() + * cdef unsigned ucbytes_len = len(ucbytes) + * cdef unsigned sapuc_size = ucbytes_len + 1 # <<<<<<<<<<<<<< + * cdef SAP_UC* sapuc = mallocU(sapuc_size) + * sapuc[0] = 0 + */ + __pyx_v_sapuc_size = (__pyx_v_ucbytes_len + 1); + + /* "pyrfc/_cyrfc.pyx":2623 + * cdef unsigned ucbytes_len = len(ucbytes) + * cdef unsigned sapuc_size = ucbytes_len + 1 + * cdef SAP_UC* sapuc = mallocU(sapuc_size) # <<<<<<<<<<<<<< + * sapuc[0] = 0 + * cdef unsigned result_len = 0 + */ + __pyx_v_sapuc = mallocU(__pyx_v_sapuc_size); + + /* "pyrfc/_cyrfc.pyx":2624 + * cdef unsigned sapuc_size = ucbytes_len + 1 + * cdef SAP_UC* sapuc = mallocU(sapuc_size) + * sapuc[0] = 0 # <<<<<<<<<<<<<< + * cdef unsigned result_len = 0 + * if ucbytes_len > 0: + */ + (__pyx_v_sapuc[0]) = 0; + + /* "pyrfc/_cyrfc.pyx":2625 + * cdef SAP_UC* sapuc = mallocU(sapuc_size) + * sapuc[0] = 0 + * cdef unsigned result_len = 0 # <<<<<<<<<<<<<< + * if ucbytes_len > 0: + * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + */ + __pyx_v_result_len = 0; + + /* "pyrfc/_cyrfc.pyx":2626 + * sapuc[0] = 0 + * cdef unsigned result_len = 0 + * if ucbytes_len > 0: # <<<<<<<<<<<<<< + * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + * if rc != RFC_OK: + */ + __pyx_t_5 = ((__pyx_v_ucbytes_len > 0) != 0); + if (__pyx_t_5) { + + /* "pyrfc/_cyrfc.pyx":2627 + * cdef unsigned result_len = 0 + * if ucbytes_len > 0: + * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_t_6 = __Pyx_PyObject_AsUString(__pyx_v_ucbytes); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 2627, __pyx_L1_error) + __pyx_v_rc = RfcUTF8ToSAPUC(__pyx_t_6, __pyx_v_ucbytes_len, __pyx_v_sapuc, (&__pyx_v_sapuc_size), (&__pyx_v_result_len), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2628 + * if ucbytes_len > 0: + * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return sapuc + */ + __pyx_t_5 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_5)) { + + /* "pyrfc/_cyrfc.pyx":2629 + * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return sapuc + * + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 2629, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2628 + * if ucbytes_len > 0: + * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return sapuc + */ + } + + /* "pyrfc/_cyrfc.pyx":2626 + * sapuc[0] = 0 + * cdef unsigned result_len = 0 + * if ucbytes_len > 0: # <<<<<<<<<<<<<< + * rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + * if rc != RFC_OK: + */ + } + + /* "pyrfc/_cyrfc.pyx":2630 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return sapuc # <<<<<<<<<<<<<< + * + * ################################################################################ + */ + __pyx_r = __pyx_v_sapuc; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":2617 + * free(sapuc) + * + * cdef SAP_UC* fillString(pyuc) except NULL: # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyrfc._cyrfc.fillString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ucbytes); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":2637 + * # wrapper functions take C values and returns Python values + * + * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): # <<<<<<<<<<<<<< + * return { + * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') + */ + +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapConnectionAttributes(RFC_ATTRIBUTES __pyx_v_attributes) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrapConnectionAttributes", 0); + + /* "pyrfc/_cyrfc.pyx":2638 + * + * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): + * return { # <<<<<<<<<<<<<< + * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') + * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') + */ + __Pyx_XDECREF(__pyx_r); + + /* "pyrfc/_cyrfc.pyx":2639 + * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): + * return { + * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') + * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(25); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_64; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.dest, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dest, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2640 + * return { + * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') + * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') + * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_100; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.host, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_host, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2641 + * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') + * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') + * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') + * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_100; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerHost, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerHost, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2642 + * , 'host': wrapString(attributes.host, 100, True).rstrip('\0') + * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') + * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') + * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_2; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.sysNumber, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sysNumber, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2643 + * , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') + * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') + * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') + * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_8; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.sysId, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2643, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sysId, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2644 + * , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') + * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') + * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') + * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_3; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.client, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2644, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_client, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2645 + * , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') + * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') + * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') + * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_12; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.user, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_user, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2646 + * , 'client': wrapString(attributes.client, 3, True).rstrip('\0') + * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') + * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') + * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_2; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.language, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2646, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_language, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2647 + * , 'user': wrapString(attributes.user, 12, True).rstrip('\0') + * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') + * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') + * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_1; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.trace, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_trace, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2648 + * , 'language': wrapString(attributes.language, 2, True).rstrip('\0') + * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') + * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') + * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_2; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.isoLanguage, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_isoLanguage, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2649 + * , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') + * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') + * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') + * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_4; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.codepage, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2649, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2649, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2649, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_codepage, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2650 + * , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') + * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') + * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') + * , 'type': wrapString(attributes.type, 1).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_4; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerCodepage, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2650, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerCodepage, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2651 + * , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') + * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') + * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'type': wrapString(attributes.type, 1).rstrip('\0') + * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_1; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.rfcRole, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2651, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rfcRole, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2652 + * , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') + * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') + * , 'type': wrapString(attributes.type, 1).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') + * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.uclen = __pyx_int_1; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.type, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_type, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2653 + * , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') + * , 'type': wrapString(attributes.type, 1).rstrip('\0') + * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') + * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_1; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerType, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2653, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerType, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2654 + * , 'type': wrapString(attributes.type, 1).rstrip('\0') + * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') + * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') + * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_4; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.rel, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rel, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2655 + * , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') + * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') + * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') + * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_4; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerRel, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerRel, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2656 + * , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') + * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') + * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') + * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_4; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.kernelRel, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_kernelRel, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2657 + * , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') + * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') + * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') + * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_8; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.cpicConvId, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2657, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_cpicConvId, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2658 + * , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') + * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') + * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') + * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') + */ + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_128; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.progName, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_progName, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":375 - * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") - * return RCStatus.OK.value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onGetState:\n", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2659 + * , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') + * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') + * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') + * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') */ - __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_11) { - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__onGetStateFunction", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_12, &__pyx_t_5) < 0) __PYX_ERR(5, 375, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_12); - __pyx_v_ex = __pyx_t_12; - /*try:*/ { + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_1; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerBytesPerChar, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerBytesPerChar, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":376 - * return RCStatus.OK.value - * except Exception as ex: - * _server_log("Error in bgRFC handler onGetState:\n", ex) # <<<<<<<<<<<<<< - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * + /* "pyrfc/_cyrfc.pyx":2660 + * , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') + * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') + * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') + * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 376, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_15 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_15)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_15); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_kp_s_Error_in_bgRFC_handler_onGetStat, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 376, __pyx_L18_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_kp_s_Error_in_bgRFC_handler_onGetStat, __pyx_v_ex}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 376, __pyx_L18_error) - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_16 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_16)) __PYX_ERR(5, 376, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_15) { - __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_Error_in_bgRFC_handler_onGetStat); - __Pyx_GIVEREF(__pyx_kp_s_Error_in_bgRFC_handler_onGetStat); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_11, __pyx_kp_s_Error_in_bgRFC_handler_onGetStat); - __Pyx_INCREF(__pyx_v_ex); - __Pyx_GIVEREF(__pyx_v_ex); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_11, __pyx_v_ex); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 376, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_4; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerSystemCodepage, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2660, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2660, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2660, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerSystemCodepage, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":377 - * except Exception as ex: - * _server_log("Error in bgRFC handler onGetState:\n", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value # <<<<<<<<<<<<<< - * - * def bgrfc_init(self, sysId, bgRfcFunction): + /* "pyrfc/_cyrfc.pyx":2661 + * , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') + * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') + * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') + * , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RCStatus); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 377, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 377, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 377, __pyx_L18_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_6 = ((RFC_RC)__Pyx_PyInt_As_RFC_RC(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 377, __pyx_L18_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_6; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L17_return; - } + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_15; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerIP, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerIP, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":375 - * raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") - * return RCStatus.OK.value - * except Exception as ex: # <<<<<<<<<<<<<< - * _server_log("Error in bgRFC handler onGetState:\n", ex) - * return RCStatus.RFC_EXTERNAL_FAILURE.value + /* "pyrfc/_cyrfc.pyx":2662 + * , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') + * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') + * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') # <<<<<<<<<<<<<< + * , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') + * } */ - /*finally:*/ { - __pyx_L18_error:; - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_19); - __Pyx_XGOTREF(__pyx_t_20); - __Pyx_XGOTREF(__pyx_t_21); - __Pyx_XGOTREF(__pyx_t_22); - __Pyx_XGOTREF(__pyx_t_23); - __Pyx_XGOTREF(__pyx_t_24); - __pyx_t_11 = __pyx_lineno; __pyx_t_17 = __pyx_clineno; __pyx_t_18 = __pyx_filename; - { - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - } - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_22); - __Pyx_XGIVEREF(__pyx_t_23); - __Pyx_XGIVEREF(__pyx_t_24); - __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24); - } - __Pyx_XGIVEREF(__pyx_t_19); - __Pyx_XGIVEREF(__pyx_t_20); - __Pyx_XGIVEREF(__pyx_t_21); - __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21); - __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; - __pyx_lineno = __pyx_t_11; __pyx_clineno = __pyx_t_17; __pyx_filename = __pyx_t_18; - goto __pyx_L6_except_error; - } - __pyx_L17_return: { - __pyx_t_6 = __pyx_r; - __Pyx_DECREF(__pyx_v_ex); - __pyx_v_ex = NULL; - __pyx_r = __pyx_t_6; - goto __pyx_L7_except_return; - } - } + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_45; + __pyx_t_4.rstrip = Py_True; + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.partnerIPv6, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_partnerIPv6, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":360 - * _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * try: # <<<<<<<<<<<<<< - * unit_identifier = wrapUnitIdentifier(identifier[0]) - * state = handler(rfcHandle, unit_identifier) + /* "pyrfc/_cyrfc.pyx":2663 + * , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') + * , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') + * , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') # <<<<<<<<<<<<<< + * } + * */ - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - goto __pyx_L1_error; - __pyx_L8_try_return:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - goto __pyx_L0; - __pyx_L7_except_return:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - goto __pyx_L0; + __pyx_t_4.__pyx_n = 2; + __pyx_t_4.uclen = __pyx_int_17; + __pyx_t_4.rstrip = Py_True; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.reserved, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_kp_s__45) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s__45); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_reserved, __pyx_t_2) < 0) __PYX_ERR(0, 2639, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "src/pyrfc/server.pyx":351 + /* "pyrfc/_cyrfc.pyx":2637 + * # wrapper functions take C values and returns Python values * - * @staticmethod - * cdef RFC_RC __onGetStateFunction( # <<<<<<<<<<<<<< - * RFC_CONNECTION_HANDLE rfcHandle, - * const RFC_UNIT_IDENTIFIER *identifier, + * cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): # <<<<<<<<<<<<<< + * return { + * 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_15); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_WriteUnraisable("pyrfc._cyrfc.Server.__onGetStateFunction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (RFC_RC) 0; + __Pyx_AddTraceback("pyrfc._cyrfc.wrapConnectionAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_handler); - __Pyx_XDECREF(__pyx_v_unit_identifier); - __Pyx_XDECREF(__pyx_v_state); - __Pyx_XDECREF(__pyx_v_ex); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); - #ifdef WITH_THREAD - __Pyx_PyGILState_Release(__pyx_gilstate_save); - #endif return __pyx_r; } -/* "src/pyrfc/server.pyx":379 - * return RCStatus.RFC_EXTERNAL_FAILURE.value +/* "pyrfc/_cyrfc.pyx":2667 * - * def bgrfc_init(self, sysId, bgRfcFunction): # <<<<<<<<<<<<<< - * """Installs the necessary callback functions for processing incoming bgRFC calls. + * + * cdef wrapTypeDescription(RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< + * """ Parses a RFC_TYPE_DESC_HANDLE * */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_3bgrfc_init(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_2bgrfc_init[] = "Installs the necessary callback functions for processing incoming bgRFC calls.\n\n These functions need to be implemented by Python application and will be used by the RFC runtime.\n When no callback function is provided, the default one is used,\n not necessarily matching your application requirements.\n\n For more info search for the ``RfcInstallBgRfcHandlers`` method in\n `SAP NetWeaver RFC SDK Doxygen Documentation `_\n\n :param sysId: System ID of the SAP system for which to use this set of transaction handlers, or None\n When None value provided, the transaction handlers will be used for bgRFC calls from\n any backend system, for which no explicit handlers have been installed.\n :type sysId: string or None\n\n :param bgRfcFunction: Function callbacks\n :type bgRfcFunction: dict(str, function)\n\n * \"check\": onCheckFunction,\n * \"commit\": onCommitFunction,\n * \"rollback\": onRollbackFunction,\n * \"confirm\": onConfirmFunction,\n * \"getState\": onGetStateFunction,\n\n :return: error code, zero when no error\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_3bgrfc_init(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_sysId = 0; - PyObject *__pyx_v_bgRfcFunction = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("bgrfc_init (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sysId,&__pyx_n_s_bgRfcFunction_2,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_sysId)) != 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_bgRfcFunction_2)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("bgrfc_init", 1, 2, 2, 1); __PYX_ERR(5, 379, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bgrfc_init") < 0)) __PYX_ERR(5, 379, __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_sysId = values[0]; - __pyx_v_bgRfcFunction = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("bgrfc_init", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 379, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Server.bgrfc_init", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_2bgrfc_init(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), __pyx_v_sysId, __pyx_v_bgRfcFunction); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_2bgrfc_init(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_sysId, PyObject *__pyx_v_bgRfcFunction) { - PyObject *__pyx_v_func_name = NULL; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc) { + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + RFC_FIELD_DESC __pyx_v_fieldDesc; + RFC_ABAP_NAME __pyx_v_typeName; + unsigned int __pyx_v_nuc_length; + unsigned int __pyx_v_uc_length; + unsigned int __pyx_v_i; + unsigned int __pyx_v_fieldCount; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_type_desc = NULL; + PyObject *__pyx_v_field_description = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_UCS4 __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + unsigned int __pyx_t_9; + unsigned int __pyx_t_10; + unsigned int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("bgrfc_init", 0); - - /* "src/pyrfc/server.pyx":405 - * :return: error code, zero when no error - * """ - * for func_name in bgRfcFunction: # <<<<<<<<<<<<<< - * if func_name not in Server.__bgRfcFunction: - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") - */ - if (likely(PyList_CheckExact(__pyx_v_bgRfcFunction)) || PyTuple_CheckExact(__pyx_v_bgRfcFunction)) { - __pyx_t_1 = __pyx_v_bgRfcFunction; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_bgRfcFunction); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 405, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(5, 405, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(5, 405, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(5, 405, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_4); - __pyx_t_4 = 0; - - /* "src/pyrfc/server.pyx":406 - * """ - * for func_name in bgRfcFunction: - * if func_name not in Server.__bgRfcFunction: # <<<<<<<<<<<<<< - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") - * if not callable(bgRfcFunction[func_name]): - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_func_name, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(5, 406, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (__pyx_t_5 != 0); - if (unlikely(__pyx_t_6)) { + __Pyx_RefNannySetupContext("wrapTypeDescription", 0); - /* "src/pyrfc/server.pyx":407 - * for func_name in bgRfcFunction: - * if func_name not in Server.__bgRfcFunction: - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") # <<<<<<<<<<<<<< - * if not callable(bgRfcFunction[func_name]): - * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") + /* "pyrfc/_cyrfc.pyx":2680 + * cdef unsigned i, fieldCount + * + * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = 0; - __pyx_t_8 = 127; - __Pyx_INCREF(__pyx_kp_u_BgRfc_callback_function_key_not); - __pyx_t_7 += 44; - __Pyx_GIVEREF(__pyx_kp_u_BgRfc_callback_function_key_not); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_BgRfc_callback_function_key_not); - __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; - __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_7 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__6); - __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(5, 407, __pyx_L1_error) + __pyx_v_rc = RfcGetTypeName(__pyx_v_typeDesc, __pyx_v_typeName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":406 - * """ - * for func_name in bgRfcFunction: - * if func_name not in Server.__bgRfcFunction: # <<<<<<<<<<<<<< - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") - * if not callable(bgRfcFunction[func_name]): + /* "pyrfc/_cyrfc.pyx":2681 + * + * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * name = wrapString(typeName) */ - } + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":408 - * if func_name not in Server.__bgRfcFunction: - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") - * if not callable(bgRfcFunction[func_name]): # <<<<<<<<<<<<<< - * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") - * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] + /* "pyrfc/_cyrfc.pyx":2682 + * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * name = wrapString(typeName) + * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_bgRfcFunction, __pyx_v_func_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 408, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_t_4); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(5, 408, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0); - if (unlikely(__pyx_t_5)) { + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2682, __pyx_L1_error) - /* "src/pyrfc/server.pyx":409 - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") - * if not callable(bgRfcFunction[func_name]): - * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") # <<<<<<<<<<<<<< - * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] - * return self.install_bgrfc_handlers(sysId) - */ - __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = 0; - __pyx_t_8 = 127; - __Pyx_INCREF(__pyx_kp_u_BgRfc_callback_function_referenc); - __pyx_t_7 += 39; - __Pyx_GIVEREF(__pyx_kp_u_BgRfc_callback_function_referenc); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_BgRfc_callback_function_referenc); - __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; - __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_INCREF(__pyx_kp_u_is_not_callable); - __pyx_t_7 += 20; - __Pyx_GIVEREF(__pyx_kp_u_is_not_callable); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_is_not_callable); - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_bgRfcFunction, __pyx_v_func_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_t_9, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_8; - __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_10); - __pyx_t_10 = 0; - __Pyx_INCREF(__pyx_kp_u__6); - __pyx_t_7 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__6); - __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(5, 409, __pyx_L1_error) + /* "pyrfc/_cyrfc.pyx":2681 + * + * rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * name = wrapString(typeName) + */ + } - /* "src/pyrfc/server.pyx":408 - * if func_name not in Server.__bgRfcFunction: - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") - * if not callable(bgRfcFunction[func_name]): # <<<<<<<<<<<<<< - * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") - * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] + /* "pyrfc/_cyrfc.pyx":2683 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * name = wrapString(typeName) # <<<<<<<<<<<<<< + * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) + * if rc != RFC_OK: */ - } + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_typeName, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2683, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_name = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":410 - * if not callable(bgRfcFunction[func_name]): - * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") - * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] # <<<<<<<<<<<<<< - * return self.install_bgrfc_handlers(sysId) + /* "pyrfc/_cyrfc.pyx":2684 + * raise wrapError(&errorInfo) + * name = wrapString(typeName) + * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_v_rc = RfcGetTypeLength(__pyx_v_typeDesc, (&__pyx_v_nuc_length), (&__pyx_v_uc_length), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2685 + * name = wrapString(typeName) + * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * type_desc = TypeDescription(name, nuc_length, uc_length) + */ + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pyrfc/_cyrfc.pyx":2686 + * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * type_desc = TypeDescription(name, nuc_length, uc_length) * */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_bgRfcFunction, __pyx_v_func_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 410, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server), __pyx_n_s_bgRfcFunction); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 410, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_v_func_name, __pyx_t_4) < 0)) __PYX_ERR(5, 410, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2686, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2686, __pyx_L1_error) - /* "src/pyrfc/server.pyx":405 - * :return: error code, zero when no error - * """ - * for func_name in bgRfcFunction: # <<<<<<<<<<<<<< - * if func_name not in Server.__bgRfcFunction: - * raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") + /* "pyrfc/_cyrfc.pyx":2685 + * name = wrapString(typeName) + * rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * type_desc = TypeDescription(name, nuc_length, uc_length) */ } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":411 - * raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") - * Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] - * return self.install_bgrfc_handlers(sysId) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2687 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * type_desc = TypeDescription(name, nuc_length, uc_length) # <<<<<<<<<<<<<< * - * def install_bgrfc_handlers(self, sysId): + * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_install_bgrfc_handlers); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 411, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_TypeDescription_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nuc_length); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_uc_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_7 = 1; } } - __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_v_sysId) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_sysId); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_name, __pyx_t_4, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2687, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_name, __pyx_t_4, __pyx_t_5}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2687, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_name); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_type_desc = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":379 - * return RCStatus.RFC_EXTERNAL_FAILURE.value - * - * def bgrfc_init(self, sysId, bgRfcFunction): # <<<<<<<<<<<<<< - * """Installs the necessary callback functions for processing incoming bgRFC calls. + /* "pyrfc/_cyrfc.pyx":2689 + * type_desc = TypeDescription(name, nuc_length, uc_length) * + * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ + __pyx_v_rc = RfcGetFieldCount(__pyx_v_typeDesc, (&__pyx_v_fieldCount), (&__pyx_v_errorInfo)); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.bgrfc_init", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_func_name); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":413 - * return self.install_bgrfc_handlers(sysId) + /* "pyrfc/_cyrfc.pyx":2690 * - * def install_bgrfc_handlers(self, sysId): # <<<<<<<<<<<<<< - * ucSysId = fillString(sysId) if sysId is not None else NULL - * cdef RFC_ERROR_INFO errorInfo + * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for i in range(fieldCount): */ + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5install_bgrfc_handlers(PyObject *__pyx_v_self, PyObject *__pyx_v_sysId); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5install_bgrfc_handlers(PyObject *__pyx_v_self, PyObject *__pyx_v_sysId) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("install_bgrfc_handlers (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_4install_bgrfc_handlers(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v_sysId)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_4install_bgrfc_handlers(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_sysId) { - SAP_UC *__pyx_v_ucSysId; - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - SAP_UC *__pyx_t_1; - int __pyx_t_2; - SAP_UC *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("install_bgrfc_handlers", 0); + /* "pyrfc/_cyrfc.pyx":2691 + * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * for i in range(fieldCount): + * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + */ + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2691, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2691, __pyx_L1_error) - /* "src/pyrfc/server.pyx":414 + /* "pyrfc/_cyrfc.pyx":2690 * - * def install_bgrfc_handlers(self, sysId): - * ucSysId = fillString(sysId) if sysId is not None else NULL # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcInstallBgRfcHandlers( + * rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for i in range(fieldCount): */ - __pyx_t_2 = (__pyx_v_sysId != Py_None); - if ((__pyx_t_2 != 0)) { - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_sysId); if (unlikely(__pyx_t_3 == ((SAP_UC *)NULL))) __PYX_ERR(5, 414, __pyx_L1_error) - __pyx_t_1 = __pyx_t_3; - } else { - __pyx_t_1 = NULL; } - __pyx_v_ucSysId = __pyx_t_1; - /* "src/pyrfc/server.pyx":416 - * ucSysId = fillString(sysId) if sysId is not None else NULL - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcInstallBgRfcHandlers( # <<<<<<<<<<<<<< - * ucSysId, - * Server.__onCheckFunction, + /* "pyrfc/_cyrfc.pyx":2692 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * for i in range(fieldCount): # <<<<<<<<<<<<<< + * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + * if rc != RFC_OK: */ - __pyx_v_rc = RfcInstallBgRfcHandlers(__pyx_v_ucSysId, __pyx_f_5pyrfc_6_cyrfc_6Server___onCheckFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onCommitFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onRollbackFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onConfirmFunction, __pyx_f_5pyrfc_6_cyrfc_6Server___onGetStateFunction, (&__pyx_v_errorInfo)); + __pyx_t_9 = __pyx_v_fieldCount; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; - /* "src/pyrfc/server.pyx":425 - * &errorInfo - * ) - * free(ucSysId) # <<<<<<<<<<<<<< - * if rc != RFC_OK or errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2693 + * raise wrapError(&errorInfo) + * for i in range(fieldCount): + * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: * raise wrapError(&errorInfo) */ - free(__pyx_v_ucSysId); + __pyx_v_rc = RfcGetFieldDescByIndex(__pyx_v_typeDesc, __pyx_v_i, (&__pyx_v_fieldDesc), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":426 - * ) - * free(ucSysId) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2694 + * for i in range(fieldCount): + * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * return rc + * field_description = { */ - __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); - if (!__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - __pyx_t_2 = __pyx_t_4; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_2)) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":427 - * free(ucSysId) - * if rc != RFC_OK or errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2695 + * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * return rc - * + * field_description = { + * 'name': wrapString(fieldDesc.name), */ - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(5, 427, __pyx_L1_error) + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2695, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2695, __pyx_L1_error) - /* "src/pyrfc/server.pyx":426 - * ) - * free(ucSysId) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2694 + * for i in range(fieldCount): + * rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * return rc + * field_description = { */ - } + } - /* "src/pyrfc/server.pyx":428 - * if rc != RFC_OK or errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2697 * raise wrapError(&errorInfo) - * return rc # <<<<<<<<<<<<<< - * - * def add_function(self, func_name, callback): + * field_description = { + * 'name': wrapString(fieldDesc.name), # <<<<<<<<<<<<<< + * 'field_type': RfcFieldType(fieldDesc.type).name, + * 'nuc_length': fieldDesc.nucLength, */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_fieldDesc.name, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_name, __pyx_t_3) < 0) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":413 - * return self.install_bgrfc_handlers(sysId) - * - * def install_bgrfc_handlers(self, sysId): # <<<<<<<<<<<<<< - * ucSysId = fillString(sysId) if sysId is not None else NULL - * cdef RFC_ERROR_INFO errorInfo + /* "pyrfc/_cyrfc.pyx":2698 + * field_description = { + * 'name': wrapString(fieldDesc.name), + * 'field_type': RfcFieldType(fieldDesc.type).name, # <<<<<<<<<<<<<< + * 'nuc_length': fieldDesc.nucLength, + * 'nuc_offset': fieldDesc.nucOffset, */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_5 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_fieldDesc.type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2698, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_field_type, __pyx_t_8) < 0) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.install_bgrfc_handlers", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2699 + * 'name': wrapString(fieldDesc.name), + * 'field_type': RfcFieldType(fieldDesc.type).name, + * 'nuc_length': fieldDesc.nucLength, # <<<<<<<<<<<<<< + * 'nuc_offset': fieldDesc.nucOffset, + * 'uc_length': fieldDesc.ucLength, + */ + __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.nucLength); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nuc_length, __pyx_t_8) < 0) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; -/* "src/pyrfc/server.pyx":430 - * return rc - * - * def add_function(self, func_name, callback): # <<<<<<<<<<<<<< - * """ - * Installs a function in the server. + /* "pyrfc/_cyrfc.pyx":2700 + * 'field_type': RfcFieldType(fieldDesc.type).name, + * 'nuc_length': fieldDesc.nucLength, + * 'nuc_offset': fieldDesc.nucOffset, # <<<<<<<<<<<<<< + * 'uc_length': fieldDesc.ucLength, + * 'uc_offset': fieldDesc.ucOffset, */ + __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.nucOffset); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2700, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nuc_offset, __pyx_t_8) < 0) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_7add_function(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_6add_function[] = "\n Installs a function in the server.\n\n :param func_name: ABAP remote function module name\n :type func_name: string\n\n :param callback: A callback function that implements the logic.\n The function must accept a ``request_context`` parameter and\n all IMPORT, CHANGING, and TABLE parameters of the given\n ``func_desc``.\n :raises: :exc:`TypeError` if a function with the name given is already\n installed.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_7add_function(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_func_name = 0; - PyObject *__pyx_v_callback = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_function (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func_name,&__pyx_n_s_callback,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_func_name)) != 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_callback)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_function", 1, 2, 2, 1); __PYX_ERR(5, 430, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_function") < 0)) __PYX_ERR(5, 430, __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); + /* "pyrfc/_cyrfc.pyx":2701 + * 'nuc_length': fieldDesc.nucLength, + * 'nuc_offset': fieldDesc.nucOffset, + * 'uc_length': fieldDesc.ucLength, # <<<<<<<<<<<<<< + * 'uc_offset': fieldDesc.ucOffset, + * 'decimals': fieldDesc.decimals + */ + __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.ucLength); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uc_length, __pyx_t_8) < 0) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "pyrfc/_cyrfc.pyx":2702 + * 'nuc_offset': fieldDesc.nucOffset, + * 'uc_length': fieldDesc.ucLength, + * 'uc_offset': fieldDesc.ucOffset, # <<<<<<<<<<<<<< + * 'decimals': fieldDesc.decimals + * } + */ + __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.ucOffset); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2702, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uc_offset, __pyx_t_8) < 0) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "pyrfc/_cyrfc.pyx":2703 + * 'uc_length': fieldDesc.ucLength, + * 'uc_offset': fieldDesc.ucOffset, + * 'decimals': fieldDesc.decimals # <<<<<<<<<<<<<< + * } + * if fieldDesc.typeDescHandle is NULL: + */ + __pyx_t_8 = __Pyx_PyInt_From_unsigned_int(__pyx_v_fieldDesc.decimals); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_decimals, __pyx_t_8) < 0) __PYX_ERR(0, 2697, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_field_description, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":2705 + * 'decimals': fieldDesc.decimals + * } + * if fieldDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< + * field_description['type_description'] = None + * else: + */ + __pyx_t_1 = ((__pyx_v_fieldDesc.typeDescHandle == NULL) != 0); + if (__pyx_t_1) { + + /* "pyrfc/_cyrfc.pyx":2706 + * } + * if fieldDesc.typeDescHandle is NULL: + * field_description['type_description'] = None # <<<<<<<<<<<<<< + * else: + * field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) + */ + if (unlikely(PyDict_SetItem(__pyx_v_field_description, __pyx_n_s_type_description, Py_None) < 0)) __PYX_ERR(0, 2706, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2705 + * 'decimals': fieldDesc.decimals + * } + * if fieldDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< + * field_description['type_description'] = None + * else: + */ + goto __pyx_L9; } - __pyx_v_func_name = values[0]; - __pyx_v_callback = values[1]; + + /* "pyrfc/_cyrfc.pyx":2708 + * field_description['type_description'] = None + * else: + * field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) # <<<<<<<<<<<<<< + * # Add field to object + * type_desc.add_field(**field_description) + */ + /*else*/ { + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(__pyx_v_fieldDesc.typeDescHandle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2708, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(PyDict_SetItem(__pyx_v_field_description, __pyx_n_s_type_description, __pyx_t_2) < 0)) __PYX_ERR(0, 2708, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L9:; + + /* "pyrfc/_cyrfc.pyx":2710 + * field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) + * # Add field to object + * type_desc.add_field(**field_description) # <<<<<<<<<<<<<< + * + * return type_desc + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_add_field); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyDict_Copy(__pyx_v_field_description); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2710, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_function", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(5, 430, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Server.add_function", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_6add_function(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), __pyx_v_func_name, __pyx_v_callback); + + /* "pyrfc/_cyrfc.pyx":2712 + * type_desc.add_field(**field_description) + * + * return type_desc # <<<<<<<<<<<<<< + * + * cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_type_desc); + __pyx_r = __pyx_v_type_desc; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":2667 + * + * + * cdef wrapTypeDescription(RFC_TYPE_DESC_HANDLE typeDesc): # <<<<<<<<<<<<<< + * """ Parses a RFC_TYPE_DESC_HANDLE + * + */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapTypeDescription", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_type_desc); + __Pyx_XDECREF(__pyx_v_field_description); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_6add_function(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_func_name, PyObject *__pyx_v_callback) { +/* "pyrfc/_cyrfc.pyx":2714 + * return type_desc + * + * cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + */ + +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc) { + RFC_RC __pyx_v_rc; RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_ABAP_NAME __pyx_v_funcName; - RFC_FUNCTION_DESC_HANDLE __pyx_v_func_desc_handle; + RFC_ABAP_NAME __pyx_v_functionName; + unsigned int __pyx_v_i; + unsigned int __pyx_v_paramCount; + RFC_PARAMETER_DESC __pyx_v_paramDesc; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_func_desc = NULL; + PyObject *__pyx_v_parameter_description = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - Py_UCS4 __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - SAP_UC *__pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + unsigned int __pyx_t_5; + unsigned int __pyx_t_6; + unsigned int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("add_function", 0); - - /* "src/pyrfc/server.pyx":445 - * """ - * global server_functions - * if func_name in server_functions: # <<<<<<<<<<<<<< - * raise TypeError(f"Server function '{func_name}' already installed.") - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_func_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(5, 445, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (unlikely(__pyx_t_3)) { - - /* "src/pyrfc/server.pyx":446 - * global server_functions - * if func_name in server_functions: - * raise TypeError(f"Server function '{func_name}' already installed.") # <<<<<<<<<<<<<< - * - * if not self._client_connection: - */ - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = 0; - __pyx_t_5 = 127; - __Pyx_INCREF(__pyx_kp_u_Server_function); - __pyx_t_4 += 17; - __Pyx_GIVEREF(__pyx_kp_u_Server_function); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Server_function); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_func_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6); - __pyx_t_6 = 0; - __Pyx_INCREF(__pyx_kp_u_already_installed); - __pyx_t_4 += 20; - __Pyx_GIVEREF(__pyx_kp_u_already_installed); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_already_installed); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(5, 446, __pyx_L1_error) + __Pyx_RefNannySetupContext("wrapFunctionDescription", 0); - /* "src/pyrfc/server.pyx":445 - * """ - * global server_functions - * if func_name in server_functions: # <<<<<<<<<<<<<< - * raise TypeError(f"Server function '{func_name}' already installed.") + /* "pyrfc/_cyrfc.pyx":2721 + * cdef RFC_PARAMETER_DESC paramDesc * + * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - } + __pyx_v_rc = RfcGetFunctionName(__pyx_v_funcDesc, __pyx_v_functionName, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":448 - * raise TypeError(f"Server function '{func_name}' already installed.") + /* "pyrfc/_cyrfc.pyx":2722 * - * if not self._client_connection: # <<<<<<<<<<<<<< - * self._client_connection.open() - * cdef RFC_ERROR_INFO errorInfo + * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * name = wrapString(functionName) */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_client_connection)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 448, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_3) != 0); - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":449 - * - * if not self._client_connection: - * self._client_connection.open() # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_ABAP_NAME funcName = fillString(func_name) + /* "pyrfc/_cyrfc.pyx":2723 + * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * name = wrapString(functionName) + * func_desc = FunctionDescription(name) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_client_connection), __pyx_n_s_open); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2723, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2723, __pyx_L1_error) - /* "src/pyrfc/server.pyx":448 - * raise TypeError(f"Server function '{func_name}' already installed.") + /* "pyrfc/_cyrfc.pyx":2722 * - * if not self._client_connection: # <<<<<<<<<<<<<< - * self._client_connection.open() - * cdef RFC_ERROR_INFO errorInfo + * rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * name = wrapString(functionName) */ } - /* "src/pyrfc/server.pyx":451 - * self._client_connection.open() - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_ABAP_NAME funcName = fillString(func_name) # <<<<<<<<<<<<<< - * cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) - * self._client_connection.close() - */ - __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_v_func_name); if (unlikely(__pyx_t_8 == ((SAP_UC *)NULL))) __PYX_ERR(5, 451, __pyx_L1_error) - memcpy(&(__pyx_v_funcName[0]), __pyx_t_8, sizeof(__pyx_v_funcName[0]) * ((30 + 1) - 0)); - - /* "src/pyrfc/server.pyx":452 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_ABAP_NAME funcName = fillString(func_name) - * cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) # <<<<<<<<<<<<<< - * self._client_connection.close() + /* "pyrfc/_cyrfc.pyx":2724 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * name = wrapString(functionName) # <<<<<<<<<<<<<< + * func_desc = FunctionDescription(name) * */ - __pyx_v_func_desc_handle = RfcGetFunctionDesc(__pyx_v_self->_client_connection->_handle, __pyx_v_funcName, (&__pyx_v_errorInfo)); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_functionName, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_name = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":453 - * cdef RFC_ABAP_NAME funcName = fillString(func_name) - * cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) - * self._client_connection.close() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2725 + * raise wrapError(&errorInfo) + * name = wrapString(functionName) + * func_desc = FunctionDescription(name) # <<<<<<<<<<<<<< * - * if errorInfo.code != RFC_OK: + * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_client_connection), __pyx_n_s_close_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FunctionDescription_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 453, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_name); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_func_desc = __pyx_t_2; + __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":455 - * self._client_connection.close() - * - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2727 + * func_desc = FunctionDescription(name) * + * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_v_rc = RfcGetParameterCount(__pyx_v_funcDesc, (&__pyx_v_paramCount), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":456 - * - * if errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2728 * - * server_functions[func_name] = { + * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for i in range(paramCount): */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(5, 456, __pyx_L1_error) + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":455 - * self._client_connection.close() - * - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2729 + * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * for i in range(paramCount): + * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) */ - } + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2729, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2729, __pyx_L1_error) - /* "src/pyrfc/server.pyx":459 + /* "pyrfc/_cyrfc.pyx":2728 * - * server_functions[func_name] = { - * "func_desc_handle": func_desc_handle, # <<<<<<<<<<<<<< - * "callback": callback, - * "server": self + * rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * for i in range(paramCount): */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 459, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_func_desc_handle)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 459, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_func_desc_handle, __pyx_t_6) < 0) __PYX_ERR(5, 459, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } - /* "src/pyrfc/server.pyx":460 - * server_functions[func_name] = { - * "func_desc_handle": func_desc_handle, - * "callback": callback, # <<<<<<<<<<<<<< - * "server": self - * } + /* "pyrfc/_cyrfc.pyx":2730 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * for i in range(paramCount): # <<<<<<<<<<<<<< + * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) + * if rc != RFC_OK: */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_callback, __pyx_v_callback) < 0) __PYX_ERR(5, 459, __pyx_L1_error) + __pyx_t_5 = __pyx_v_paramCount; + __pyx_t_6 = __pyx_t_5; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "src/pyrfc/server.pyx":461 - * "func_desc_handle": func_desc_handle, - * "callback": callback, - * "server": self # <<<<<<<<<<<<<< - * } - * + /* "pyrfc/_cyrfc.pyx":2731 + * raise wrapError(&errorInfo) + * for i in range(paramCount): + * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_server, ((PyObject *)__pyx_v_self)) < 0) __PYX_ERR(5, 459, __pyx_L1_error) + __pyx_v_rc = RfcGetParameterDescByIndex(__pyx_v_funcDesc, __pyx_v_i, (&__pyx_v_paramDesc), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":458 + /* "pyrfc/_cyrfc.pyx":2732 + * for i in range(paramCount): + * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * - * server_functions[func_name] = { # <<<<<<<<<<<<<< - * "func_desc_handle": func_desc_handle, - * "callback": callback, + * parameter_description = { */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_v_func_name, __pyx_t_1) < 0)) __PYX_ERR(5, 458, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":464 - * } - * - * _server_log("Server function installed", func_name) # <<<<<<<<<<<<<< - * _server_log("Server function installed", server_functions[func_name]) - * + /* "pyrfc/_cyrfc.pyx":2733 + * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * parameter_description = { + * 'name': wrapString(paramDesc.name), */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Server_function_installed, __pyx_v_func_name}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 464, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_kp_s_Server_function_installed, __pyx_v_func_name}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 464, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_INCREF(__pyx_kp_s_Server_function_installed); - __Pyx_GIVEREF(__pyx_kp_s_Server_function_installed); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_kp_s_Server_function_installed); - __Pyx_INCREF(__pyx_v_func_name); - __Pyx_GIVEREF(__pyx_v_func_name); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_func_name); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2733, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2733, __pyx_L1_error) - /* "src/pyrfc/server.pyx":465 - * - * _server_log("Server function installed", func_name) - * _server_log("Server function installed", server_functions[func_name]) # <<<<<<<<<<<<<< - * - * def serve(self): + /* "pyrfc/_cyrfc.pyx":2732 + * for i in range(paramCount): + * rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * parameter_description = { */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_server_log); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_v_func_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_s_Server_function_installed, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 465, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_kp_s_Server_function_installed, __pyx_t_7}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 465, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; } - __Pyx_INCREF(__pyx_kp_s_Server_function_installed); - __Pyx_GIVEREF(__pyx_kp_s_Server_function_installed); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_9, __pyx_kp_s_Server_function_installed); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_9, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":430 - * return rc - * - * def add_function(self, func_name, callback): # <<<<<<<<<<<<<< - * """ - * Installs a function in the server. + /* "pyrfc/_cyrfc.pyx":2735 + * raise wrapError(&errorInfo) + * parameter_description = { + * 'name': wrapString(paramDesc.name), # <<<<<<<<<<<<<< + * 'parameter_type': RfcFieldType(paramDesc.type).name, + * 'direction': RfcParameterDirection(paramDesc.direction).name, */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.name, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_name, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.add_function", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":467 - * _server_log("Server function installed", server_functions[func_name]) - * - * def serve(self): # <<<<<<<<<<<<<< - * """ - * Starts the RFC server, waiting for incoming requests and processes them. + /* "pyrfc/_cyrfc.pyx":2736 + * parameter_description = { + * 'name': wrapString(paramDesc.name), + * 'parameter_type': RfcFieldType(paramDesc.type).name, # <<<<<<<<<<<<<< + * 'direction': RfcParameterDirection(paramDesc.direction).name, + * 'nuc_length': paramDesc.nucLength, */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_paramDesc.type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2736, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_parameter_type, __pyx_t_4) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_9serve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_8serve[] = "\n Starts the RFC server, waiting for incoming requests and processes them.\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the server processing fails.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_9serve(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("serve (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_8serve(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_8serve(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("serve", 0); - - /* "src/pyrfc/server.pyx":476 - * cdef RFC_ERROR_INFO errorInfo - * - * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2737 + * 'name': wrapString(paramDesc.name), + * 'parameter_type': RfcFieldType(paramDesc.type).name, + * 'direction': RfcParameterDirection(paramDesc.direction).name, # <<<<<<<<<<<<<< + * 'nuc_length': paramDesc.nucLength, + * 'uc_length': paramDesc.ucLength, */ - __pyx_v_rc = RfcInstallGenericServerFunction(__pyx_f_5pyrfc_6_cyrfc_genericHandler, __pyx_f_5pyrfc_6_cyrfc_metadataLookup, (&__pyx_v_errorInfo)); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2737, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyInt_From_RFC_DIRECTION(__pyx_v_paramDesc.direction); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2737, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2737, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2737, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_direction, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":477 - * - * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2738 + * 'parameter_type': RfcFieldType(paramDesc.type).name, + * 'direction': RfcParameterDirection(paramDesc.direction).name, + * 'nuc_length': paramDesc.nucLength, # <<<<<<<<<<<<<< + * 'uc_length': paramDesc.ucLength, + * 'decimals': paramDesc.decimals, */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_paramDesc.nucLength); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2738, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_nuc_length, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":478 - * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * - * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":2739 + * 'direction': RfcParameterDirection(paramDesc.direction).name, + * 'nuc_length': paramDesc.nucLength, + * 'uc_length': paramDesc.ucLength, # <<<<<<<<<<<<<< + * 'decimals': paramDesc.decimals, + * 'default_value': wrapString(paramDesc.defaultValue), */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 478, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_paramDesc.ucLength); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2739, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_uc_length, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(5, 478, __pyx_L1_error) - /* "src/pyrfc/server.pyx":477 - * - * cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2740 + * 'nuc_length': paramDesc.nucLength, + * 'uc_length': paramDesc.ucLength, + * 'decimals': paramDesc.decimals, # <<<<<<<<<<<<<< + * 'default_value': wrapString(paramDesc.defaultValue), + * 'parameter_text': wrapString(paramDesc.parameterText), */ - } + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_paramDesc.decimals); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2740, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_decimals, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":480 - * raise wrapError(&errorInfo) - * - * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2741 + * 'uc_length': paramDesc.ucLength, + * 'decimals': paramDesc.decimals, + * 'default_value': wrapString(paramDesc.defaultValue), # <<<<<<<<<<<<<< + * 'parameter_text': wrapString(paramDesc.parameterText), + * 'optional': bool(paramDesc.optional) */ - __pyx_v_rc = RfcLaunchServer(__pyx_v_self->_server_connection->_handle, (&__pyx_v_errorInfo)); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.defaultValue, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2741, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_default_value, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":481 - * - * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _server_log("Server", f"launched {self._server_connection.handle}") + /* "pyrfc/_cyrfc.pyx":2742 + * 'decimals': paramDesc.decimals, + * 'default_value': wrapString(paramDesc.defaultValue), + * 'parameter_text': wrapString(paramDesc.parameterText), # <<<<<<<<<<<<<< + * 'optional': bool(paramDesc.optional) + * # skip: void* extendedDescription; */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L7_bool_binop_done:; - if (unlikely(__pyx_t_1)) { + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.parameterText, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2742, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_parameter_text, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":482 - * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _server_log("Server", f"launched {self._server_connection.handle}") - * + /* "pyrfc/_cyrfc.pyx":2743 + * 'default_value': wrapString(paramDesc.defaultValue), + * 'parameter_text': wrapString(paramDesc.parameterText), + * 'optional': bool(paramDesc.optional) # <<<<<<<<<<<<<< + * # skip: void* extendedDescription; + * # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 482, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_SAP_RAW(__pyx_v_paramDesc.optional); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2743, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2743, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_optional, __pyx_t_3) < 0) __PYX_ERR(0, 2735, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(5, 482, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_parameter_description, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":481 - * - * rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _server_log("Server", f"launched {self._server_connection.handle}") + /* "pyrfc/_cyrfc.pyx":2747 + * # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. + * } + * if paramDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< + * parameter_description['type_description'] = None + * else: */ - } + __pyx_t_1 = ((__pyx_v_paramDesc.typeDescHandle == NULL) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/server.pyx":483 - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) - * _server_log("Server", f"launched {self._server_connection.handle}") # <<<<<<<<<<<<<< - * - * return rc + /* "pyrfc/_cyrfc.pyx":2748 + * } + * if paramDesc.typeDescHandle is NULL: + * parameter_description['type_description'] = None # <<<<<<<<<<<<<< + * else: + * parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_server_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_server_connection), __pyx_n_s_handle); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_launched, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; + if (unlikely(PyDict_SetItem(__pyx_v_parameter_description, __pyx_n_s_type_description, Py_None) < 0)) __PYX_ERR(0, 2748, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2747 + * # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. + * } + * if paramDesc.typeDescHandle is NULL: # <<<<<<<<<<<<<< + * parameter_description['type_description'] = None + * else: + */ + goto __pyx_L8; } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_s_Server, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 483, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_s_Server, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 483, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 483, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + + /* "pyrfc/_cyrfc.pyx":2750 + * parameter_description['type_description'] = None + * else: + * parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) # <<<<<<<<<<<<<< + * func_desc.add_parameter(**parameter_description) + * + */ + /*else*/ { + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapTypeDescription(__pyx_v_paramDesc.typeDescHandle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2750, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (unlikely(PyDict_SetItem(__pyx_v_parameter_description, __pyx_n_s_type_description, __pyx_t_2) < 0)) __PYX_ERR(0, 2750, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_INCREF(__pyx_n_s_Server); - __Pyx_GIVEREF(__pyx_n_s_Server); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_n_s_Server); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 483, __pyx_L1_error) + __pyx_L8:; + + /* "pyrfc/_cyrfc.pyx":2751 + * else: + * parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) + * func_desc.add_parameter(**parameter_description) # <<<<<<<<<<<<<< + * + * return func_desc + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_desc, __pyx_n_s_add_parameter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2751, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyDict_Copy(__pyx_v_parameter_description); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2751, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2751, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/server.pyx":485 - * _server_log("Server", f"launched {self._server_connection.handle}") + /* "pyrfc/_cyrfc.pyx":2753 + * func_desc.add_parameter(**parameter_description) + * + * return func_desc # <<<<<<<<<<<<<< * - * return rc # <<<<<<<<<<<<<< * - * def start(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_RFC_RC(__pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 485, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_v_func_desc); + __pyx_r = __pyx_v_func_desc; goto __pyx_L0; - /* "src/pyrfc/server.pyx":467 - * _server_log("Server function installed", server_functions[func_name]) + /* "pyrfc/_cyrfc.pyx":2714 + * return type_desc * - * def serve(self): # <<<<<<<<<<<<<< - * """ - * Starts the RFC server, waiting for incoming requests and processes them. + * cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.serve", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapFunctionDescription", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_func_desc); + __Pyx_XDECREF(__pyx_v_parameter_description); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":487 - * return rc +/* "pyrfc/_cyrfc.pyx":2756 * - * def start(self): # <<<<<<<<<<<<<< - * """ - * Start the RFC server in new thread, waiting for incoming requests and processes them. + * + * cdef wrapResult( # <<<<<<<<<<<<<< + * RFC_FUNCTION_DESC_HANDLE funcDesc, + * RFC_FUNCTION_HANDLE container, */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_11start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_10start[] = "\n Start the RFC server in new thread, waiting for incoming requests and processes them.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_11start(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("start (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_10start(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_10start(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapResult(RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc, RFC_FUNCTION_HANDLE __pyx_v_container, RFC_DIRECTION __pyx_v_filter_parameter_direction, PyObject *__pyx_v_config) { + unsigned int __pyx_v_i; + unsigned int __pyx_v_paramCount; + RFC_PARAMETER_DESC __pyx_v_paramDesc; + PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_2; + unsigned int __pyx_t_3; + unsigned int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("start", 0); - - /* "src/pyrfc/server.pyx":491 - * Start the RFC server in new thread, waiting for incoming requests and processes them. - * """ - * self._server_thread.start() # <<<<<<<<<<<<<< - * - * def stop(self): - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_server_thread, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 491, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 491, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/server.pyx":487 - * return rc - * - * def start(self): # <<<<<<<<<<<<<< - * """ - * Start the RFC server in new thread, waiting for incoming requests and processes them. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.start", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __Pyx_RefNannySetupContext("wrapResult", 0); -/* "src/pyrfc/server.pyx":493 - * self._server_thread.start() - * - * def stop(self): # <<<<<<<<<<<<<< - * """ - * Stop the RFC server thread. + /* "pyrfc/_cyrfc.pyx":2772 + * cdef unsigned i, paramCount + * cdef RFC_PARAMETER_DESC paramDesc + * RfcGetParameterCount(funcDesc, ¶mCount, NULL) # <<<<<<<<<<<<<< + * result = {} + * for i in range(paramCount): */ + (void)(RfcGetParameterCount(__pyx_v_funcDesc, (&__pyx_v_paramCount), NULL)); -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_13stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_12stop[] = "\n Stop the RFC server thread.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_13stop(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("stop (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_12stop(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_12stop(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("stop", 0); - - /* "src/pyrfc/server.pyx":497 - * Stop the RFC server thread. - * """ - * if self._server_thread.is_alive(): # <<<<<<<<<<<<<< - * self._server_thread.join() - * + /* "pyrfc/_cyrfc.pyx":2773 + * cdef RFC_PARAMETER_DESC paramDesc + * RfcGetParameterCount(funcDesc, ¶mCount, NULL) + * result = {} # <<<<<<<<<<<<<< + * for i in range(paramCount): + * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_server_thread, __pyx_n_s_is_alive); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 497, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 497, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2773, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(5, 497, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":498 - * """ - * if self._server_thread.is_alive(): - * self._server_thread.join() # <<<<<<<<<<<<<< - * - * def close(self): + /* "pyrfc/_cyrfc.pyx":2774 + * RfcGetParameterCount(funcDesc, ¶mCount, NULL) + * result = {} + * for i in range(paramCount): # <<<<<<<<<<<<<< + * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) + * if paramDesc.direction != filter_parameter_direction: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_server_thread, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __pyx_v_paramCount; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "src/pyrfc/server.pyx":497 - * Stop the RFC server thread. - * """ - * if self._server_thread.is_alive(): # <<<<<<<<<<<<<< - * self._server_thread.join() - * + /* "pyrfc/_cyrfc.pyx":2775 + * result = {} + * for i in range(paramCount): + * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) # <<<<<<<<<<<<<< + * if paramDesc.direction != filter_parameter_direction: + * result[wrapString(paramDesc.name)] = wrapVariable( */ - } + (void)(RfcGetParameterDescByIndex(__pyx_v_funcDesc, __pyx_v_i, (&__pyx_v_paramDesc), NULL)); - /* "src/pyrfc/server.pyx":493 - * self._server_thread.start() - * - * def stop(self): # <<<<<<<<<<<<<< - * """ - * Stop the RFC server thread. + /* "pyrfc/_cyrfc.pyx":2776 + * for i in range(paramCount): + * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) + * if paramDesc.direction != filter_parameter_direction: # <<<<<<<<<<<<<< + * result[wrapString(paramDesc.name)] = wrapVariable( + * paramDesc.type, */ + __pyx_t_5 = ((__pyx_v_paramDesc.direction != __pyx_v_filter_parameter_direction) != 0); + if (__pyx_t_5) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.stop", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":500 - * self._server_thread.join() - * - * def close(self): # <<<<<<<<<<<<<< - * """ Explicitly close the registration. - * Note that this is usually not necessary as the registration will be closed + /* "pyrfc/_cyrfc.pyx":2777 + * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) + * if paramDesc.direction != filter_parameter_direction: + * result[wrapString(paramDesc.name)] = wrapVariable( # <<<<<<<<<<<<<< + * paramDesc.type, + * container, */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapVariable(__pyx_v_paramDesc.type, __pyx_v_container, __pyx_v_paramDesc.name, __pyx_v_paramDesc.nucLength, __pyx_v_paramDesc.typeDescHandle, __pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_paramDesc.name, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(PyDict_SetItem(__pyx_v_result, __pyx_t_6, __pyx_t_1) < 0)) __PYX_ERR(0, 2777, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_14close[] = " Explicitly close the registration.\n Note that this is usually not necessary as the registration will be closed\n automatically upon object destruction. However, if the the object destruction\n is delayed by the garbage collection, problems may occur when too many\n servers are registered.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_15close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("close (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_14close(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_14close(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("close", 0); - - /* "src/pyrfc/server.pyx":507 - * servers are registered. - * """ - * self.stop() # <<<<<<<<<<<<<< - * self._close() - * + /* "pyrfc/_cyrfc.pyx":2776 + * for i in range(paramCount): + * RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) + * if paramDesc.direction != filter_parameter_direction: # <<<<<<<<<<<<<< + * result[wrapString(paramDesc.name)] = wrapVariable( + * paramDesc.type, */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":508 - * """ - * self.stop() - * self._close() # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2785 + * config + * ) + * return result # <<<<<<<<<<<<<< * - * def get_server_attributes(self): + * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "src/pyrfc/server.pyx":500 - * self._server_thread.join() + /* "pyrfc/_cyrfc.pyx":2756 * - * def close(self): # <<<<<<<<<<<<<< - * """ Explicitly close the registration. - * Note that this is usually not necessary as the registration will be closed + * + * cdef wrapResult( # <<<<<<<<<<<<<< + * RFC_FUNCTION_DESC_HANDLE funcDesc, + * RFC_FUNCTION_HANDLE container, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapResult", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":510 - * self._close() - * - * def get_server_attributes(self): # <<<<<<<<<<<<<< - * """Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server. +/* "pyrfc/_cyrfc.pyx":2787 + * return result * + * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): # <<<<<<<<<<<<<< + * return { + * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_17get_server_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_16get_server_attributes[] = "Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server.\n\n :returns: Dictionary with server state and attributes\n :rtype: dict(str, str or int)\n\n * serverName: This server's name as given when creating the server.\n * protocolType: This RFC server's type:\n RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER\n * registrationCount: The current number of active registrations (in case of a Registered Server)\n or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server)\n * state: Used in state information in order to indicate the current state of an RFC Server.\n * currentBusyCount: The number of requests currently being processed.\n * peakBusyCount: The maximum number of requests the server has been processing in parallel since it has been created\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_17get_server_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_server_attributes (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_16get_server_attributes(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_16get_server_attributes(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { - RFC_RC __pyx_v_rc; - RFC_SERVER_ATTRIBUTES __pyx_v_attributes; - RFC_ERROR_INFO __pyx_v_errorInfo; - PyObject *__pyx_v_rfcServerState = NULL; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapUnitIdentifier(RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_3; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_server_attributes", 0); - - /* "src/pyrfc/server.pyx":529 - * cdef RFC_ERROR_INFO errorInfo - * - * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetServerAttributes(__pyx_v_self->_server_connection->_handle, (&__pyx_v_attributes), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/server.pyx":530 - * - * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) - */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (!__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "src/pyrfc/server.pyx":531 - * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) - * return { - */ - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(5, 531, __pyx_L1_error) + __Pyx_RefNannySetupContext("wrapUnitIdentifier", 0); - /* "src/pyrfc/server.pyx":530 + /* "pyrfc/_cyrfc.pyx":2788 * - * rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) - * if rc != RFC_OK or errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) - */ - } - - /* "src/pyrfc/server.pyx":532 - * if rc != RFC_OK or errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) - * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) # <<<<<<<<<<<<<< - * return { - * # This server's name as given when creating the server. - */ - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_neg_1; - __pyx_t_4.rstrip = Py_True; - __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(RfcGetServerStateAsString(__pyx_v_attributes.state), &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_rfcServerState = __pyx_t_3; - __pyx_t_3 = 0; - - /* "src/pyrfc/server.pyx":533 - * raise wrapError(&errorInfo) - * rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) - * return { # <<<<<<<<<<<<<< - * # This server's name as given when creating the server. - * 'serverName': wrapString(attributes.serverName, -1, True) + * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): + * return { # <<<<<<<<<<<<<< + * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), + * 'id': wrapString(uIdentifier.unitID) */ __Pyx_XDECREF(__pyx_r); - /* "src/pyrfc/server.pyx":535 - * return { - * # This server's name as given when creating the server. - * 'serverName': wrapString(attributes.serverName, -1, True) # <<<<<<<<<<<<<< - * # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER - * , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER - */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4.__pyx_n = 2; - __pyx_t_4.uclen = __pyx_int_neg_1; - __pyx_t_4.rstrip = Py_True; - __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_attributes.serverName, &__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_serverName, __pyx_t_5) < 0) __PYX_ERR(5, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "src/pyrfc/server.pyx":537 - * 'serverName': wrapString(attributes.serverName, -1, True) - * # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER - * , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER # <<<<<<<<<<<<<< - * else socket.gethostname() # Own host name - * # The current number of active registrations (in case of a Registered Server) - */ - if (((__pyx_v_attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER) != 0)) { - __Pyx_INCREF(__pyx_kp_s_multi_count); - __pyx_t_5 = __pyx_kp_s_multi_count; - } else { - - /* "src/pyrfc/server.pyx":538 - * # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER - * , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER - * else socket.gethostname() # Own host name # <<<<<<<<<<<<<< - * # The current number of active registrations (in case of a Registered Server) - * # or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) - */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_socket); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_gethostname); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_5 = __pyx_t_6; - __pyx_t_6 = 0; - } - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_protocolType, __pyx_t_5) < 0) __PYX_ERR(5, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "src/pyrfc/server.pyx":541 - * # The current number of active registrations (in case of a Registered Server) - * # or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) - * , 'registrationCount': attributes.registrationCount # <<<<<<<<<<<<<< - * # Used in state information in order to indicate the current state of an RFC Server. - * , 'state': rfcServerState - */ - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_attributes.registrationCount); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 541, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_registrationCount, __pyx_t_5) < 0) __PYX_ERR(5, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "src/pyrfc/server.pyx":543 - * , 'registrationCount': attributes.registrationCount - * # Used in state information in order to indicate the current state of an RFC Server. - * , 'state': rfcServerState # <<<<<<<<<<<<<< - * # The number of requests currently being processed. - * , 'currentBusyCount': attributes.currentBusyCount - */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_state, __pyx_v_rfcServerState) < 0) __PYX_ERR(5, 535, __pyx_L1_error) - - /* "src/pyrfc/server.pyx":545 - * , 'state': rfcServerState - * # The number of requests currently being processed. - * , 'currentBusyCount': attributes.currentBusyCount # <<<<<<<<<<<<<< - * # The maximum number of requests the server has been processing in parallel since it has been created - * , 'peakBusyCount': attributes.peakBusyCount + /* "pyrfc/_cyrfc.pyx":2789 + * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): + * return { + * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), # <<<<<<<<<<<<<< + * 'id': wrapString(uIdentifier.unitID) + * } */ - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_attributes.currentBusyCount); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 545, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_currentBusyCount, __pyx_t_5) < 0) __PYX_ERR(5, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3.__pyx_n = 1; + __pyx_t_3.uclen = __pyx_int_1; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString((&__pyx_v_uIdentifier.unitType), &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_RichCompare(__pyx_n_s_Q, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2789, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_queued, __pyx_t_4) < 0) __PYX_ERR(0, 2789, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/server.pyx":547 - * , 'currentBusyCount': attributes.currentBusyCount - * # The maximum number of requests the server has been processing in parallel since it has been created - * , 'peakBusyCount': attributes.peakBusyCount # <<<<<<<<<<<<<< - * } + /* "pyrfc/_cyrfc.pyx":2790 + * return { + * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), + * 'id': wrapString(uIdentifier.unitID) # <<<<<<<<<<<<<< + * } * */ - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_attributes.peakBusyCount); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 547, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_peakBusyCount, __pyx_t_5) < 0) __PYX_ERR(5, 535, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uIdentifier.unitID, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_id, __pyx_t_4) < 0) __PYX_ERR(0, 2789, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "src/pyrfc/server.pyx":510 - * self._close() - * - * def get_server_attributes(self): # <<<<<<<<<<<<<< - * """Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server. + /* "pyrfc/_cyrfc.pyx":2787 + * return result * + * cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): # <<<<<<<<<<<<<< + * return { + * 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.get_server_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapUnitIdentifier", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_rfcServerState); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":550 - * } +/* "pyrfc/_cyrfc.pyx":2793 + * } * - * def _close(self): # <<<<<<<<<<<<<< - * """ Close the connection (private function) - * :raises: :exc:`~pyrfc.RFCError` or a subclass + * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): # <<<<<<<<<<<<<< + * unit_attributes = {} + * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_19_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_6Server_18_close[] = " Close the connection (private function)\n :raises: :exc:`~pyrfc.RFCError` or a subclass\n thereof if the connection cannot be closed cleanly.\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_19_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_close (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_18_close(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_18_close(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { - PyObject *__pyx_v_after_remove = NULL; - PyObject *__pyx_v_func_name = NULL; - PyObject *__pyx_v_func_data = NULL; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *__pyx_v_uattr) { + PyObject *__pyx_v_unit_attributes = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *(*__pyx_t_9)(PyObject *); + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_close", 0); - - /* "src/pyrfc/server.pyx":556 - * """ - * # Shutdown server - * if self._server_connection: # <<<<<<<<<<<<<< - * self._server_connection.close() - * # Remove all installed server functions - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_server_connection)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(5, 556, __pyx_L1_error) - if (__pyx_t_1) { - - /* "src/pyrfc/server.pyx":557 - * # Shutdown server - * if self._server_connection: - * self._server_connection.close() # <<<<<<<<<<<<<< - * # Remove all installed server functions - * after_remove = {} - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_server_connection), __pyx_n_s_close_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 557, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 557, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_RefNannySetupContext("wrapUnitAttributes", 0); - /* "src/pyrfc/server.pyx":556 - * """ - * # Shutdown server - * if self._server_connection: # <<<<<<<<<<<<<< - * self._server_connection.close() - * # Remove all installed server functions + /* "pyrfc/_cyrfc.pyx":2794 + * + * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): + * unit_attributes = {} # <<<<<<<<<<<<<< + * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 + * unit_attributes['sat_trace'] = uattr.satTrace != 0 */ - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_unit_attributes = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":559 - * self._server_connection.close() - * # Remove all installed server functions - * after_remove = {} # <<<<<<<<<<<<<< - * global server_functions - * for func_name, func_data in server_functions.items(): + /* "pyrfc/_cyrfc.pyx":2795 + * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): + * unit_attributes = {} + * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 # <<<<<<<<<<<<<< + * unit_attributes['sat_trace'] = uattr.satTrace != 0 + * unit_attributes['unit_history'] = uattr.unitHistory != 0 */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 559, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_after_remove = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->kernelTrace != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_kernel_trace, __pyx_t_1) < 0)) __PYX_ERR(0, 2795, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":561 - * after_remove = {} - * global server_functions - * for func_name, func_data in server_functions.items(): # <<<<<<<<<<<<<< - * if func_data["server"] != self: - * after_remove[func_name] = func_data + /* "pyrfc/_cyrfc.pyx":2796 + * unit_attributes = {} + * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 + * unit_attributes['sat_trace'] = uattr.satTrace != 0 # <<<<<<<<<<<<<< + * unit_attributes['unit_history'] = uattr.unitHistory != 0 + * unit_attributes['lock'] = uattr.lock != 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_server_functions); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 561, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(5, 561, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(5, 561, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(5, 561, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { - PyObject* sequence = __pyx_t_2; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(5, 561, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_7 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 561, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L6_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(5, 561, __pyx_L1_error) - __pyx_t_9 = NULL; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L7_unpacking_done; - __pyx_L6_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(5, 561, __pyx_L1_error) - __pyx_L7_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_func_name, __pyx_t_3); - __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_func_data, __pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->satTrace != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2796, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_sat_trace, __pyx_t_1) < 0)) __PYX_ERR(0, 2796, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":562 - * global server_functions - * for func_name, func_data in server_functions.items(): - * if func_data["server"] != self: # <<<<<<<<<<<<<< - * after_remove[func_name] = func_data - * server_functions = after_remove + /* "pyrfc/_cyrfc.pyx":2797 + * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 + * unit_attributes['sat_trace'] = uattr.satTrace != 0 + * unit_attributes['unit_history'] = uattr.unitHistory != 0 # <<<<<<<<<<<<<< + * unit_attributes['lock'] = uattr.lock != 0 + * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_func_data, __pyx_n_s_server); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 562, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_v_self), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(5, 562, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(5, 562, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->unitHistory != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2797, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_unit_history, __pyx_t_1) < 0)) __PYX_ERR(0, 2797, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":563 - * for func_name, func_data in server_functions.items(): - * if func_data["server"] != self: - * after_remove[func_name] = func_data # <<<<<<<<<<<<<< - * server_functions = after_remove - * + /* "pyrfc/_cyrfc.pyx":2798 + * unit_attributes['sat_trace'] = uattr.satTrace != 0 + * unit_attributes['unit_history'] = uattr.unitHistory != 0 + * unit_attributes['lock'] = uattr.lock != 0 # <<<<<<<<<<<<<< + * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 + * unit_attributes['user'] = wrapString(uattr.user, 12, True) */ - if (unlikely(PyDict_SetItem(__pyx_v_after_remove, __pyx_v_func_name, __pyx_v_func_data) < 0)) __PYX_ERR(5, 563, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->lock != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_lock, __pyx_t_1) < 0)) __PYX_ERR(0, 2798, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":562 - * global server_functions - * for func_name, func_data in server_functions.items(): - * if func_data["server"] != self: # <<<<<<<<<<<<<< - * after_remove[func_name] = func_data - * server_functions = after_remove + /* "pyrfc/_cyrfc.pyx":2799 + * unit_attributes['unit_history'] = uattr.unitHistory != 0 + * unit_attributes['lock'] = uattr.lock != 0 + * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 # <<<<<<<<<<<<<< + * unit_attributes['user'] = wrapString(uattr.user, 12, True) + * unit_attributes['client'] = wrapString(uattr.client, 3, True) */ - } + __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_uattr->noCommitCheck != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_no_commit_check, __pyx_t_1) < 0)) __PYX_ERR(0, 2799, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":561 - * after_remove = {} - * global server_functions - * for func_name, func_data in server_functions.items(): # <<<<<<<<<<<<<< - * if func_data["server"] != self: - * after_remove[func_name] = func_data + /* "pyrfc/_cyrfc.pyx":2800 + * unit_attributes['lock'] = uattr.lock != 0 + * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 + * unit_attributes['user'] = wrapString(uattr.user, 12, True) # <<<<<<<<<<<<<< + * unit_attributes['client'] = wrapString(uattr.client, 3, True) + * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.uclen = __pyx_int_12; + __pyx_t_2.rstrip = Py_True; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->user, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2800, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_user, __pyx_t_1) < 0)) __PYX_ERR(0, 2800, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":564 - * if func_data["server"] != self: - * after_remove[func_name] = func_data - * server_functions = after_remove # <<<<<<<<<<<<<< - * - * cdef _error(self, RFC_ERROR_INFO* errorInfo): + /* "pyrfc/_cyrfc.pyx":2801 + * unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 + * unit_attributes['user'] = wrapString(uattr.user, 12, True) + * unit_attributes['client'] = wrapString(uattr.client, 3, True) # <<<<<<<<<<<<<< + * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) + * unit_attributes['program'] = wrapString(uattr.program, 40, True) */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_functions, __pyx_v_after_remove) < 0) __PYX_ERR(5, 564, __pyx_L1_error) + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.uclen = __pyx_int_3; + __pyx_t_2.rstrip = Py_True; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->client, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2801, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_client, __pyx_t_1) < 0)) __PYX_ERR(0, 2801, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":550 - * } - * - * def _close(self): # <<<<<<<<<<<<<< - * """ Close the connection (private function) - * :raises: :exc:`~pyrfc.RFCError` or a subclass + /* "pyrfc/_cyrfc.pyx":2802 + * unit_attributes['user'] = wrapString(uattr.user, 12, True) + * unit_attributes['client'] = wrapString(uattr.client, 3, True) + * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) # <<<<<<<<<<<<<< + * unit_attributes['program'] = wrapString(uattr.program, 40, True) + * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) */ + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.uclen = __pyx_int_20; + __pyx_t_2.rstrip = Py_True; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->tCode, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2802, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_t_code, __pyx_t_1) < 0)) __PYX_ERR(0, 2802, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* 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_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyrfc._cyrfc.Server._close", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_after_remove); - __Pyx_XDECREF(__pyx_v_func_name); - __Pyx_XDECREF(__pyx_v_func_data); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2803 + * unit_attributes['client'] = wrapString(uattr.client, 3, True) + * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) + * unit_attributes['program'] = wrapString(uattr.program, 40, True) # <<<<<<<<<<<<<< + * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) + * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) + */ + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.uclen = __pyx_int_40; + __pyx_t_2.rstrip = Py_True; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->program, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2803, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_program, __pyx_t_1) < 0)) __PYX_ERR(0, 2803, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -/* "src/pyrfc/server.pyx":566 - * server_functions = after_remove - * - * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * """ - * Error treatment of a connection. + /* "pyrfc/_cyrfc.pyx":2804 + * unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) + * unit_attributes['program'] = wrapString(uattr.program, 40, True) + * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) # <<<<<<<<<<<<<< + * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) + * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) */ + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.uclen = __pyx_int_40; + __pyx_t_2.rstrip = Py_True; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->hostname, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_hostname, __pyx_t_1) < 0)) __PYX_ERR(0, 2804, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static PyObject *__pyx_f_5pyrfc_6_cyrfc_6Server__error(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, RFC_ERROR_INFO *__pyx_v_errorInfo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_error", 0); + /* "pyrfc/_cyrfc.pyx":2805 + * unit_attributes['program'] = wrapString(uattr.program, 40, True) + * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) + * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) # <<<<<<<<<<<<<< + * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) + * return unit_attributes + */ + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.uclen = __pyx_int_8; + __pyx_t_2.rstrip = Py_True; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->sendingDate, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_sending_date, __pyx_t_1) < 0)) __PYX_ERR(0, 2805, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":581 - * # self.alive = False - * - * raise wrapError(errorInfo) # <<<<<<<<<<<<<< - * + /* "pyrfc/_cyrfc.pyx":2806 + * unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) + * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) + * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) # <<<<<<<<<<<<<< + * return unit_attributes * */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError(__pyx_v_errorInfo); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 581, __pyx_L1_error) + __pyx_t_2.__pyx_n = 2; + __pyx_t_2.uclen = __pyx_int_6; + __pyx_t_2.rstrip = Py_True; + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_uattr->sendingTime, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + if (unlikely(PyDict_SetItem(__pyx_v_unit_attributes, __pyx_n_s_sending_time, __pyx_t_1) < 0)) __PYX_ERR(0, 2806, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(5, 581, __pyx_L1_error) - /* "src/pyrfc/server.pyx":566 - * server_functions = after_remove + /* "pyrfc/_cyrfc.pyx":2807 + * unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) + * unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) + * return unit_attributes # <<<<<<<<<<<<<< * - * cdef _error(self, RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< - * """ - * Error treatment of a connection. + * cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_unit_attributes); + __pyx_r = __pyx_v_unit_attributes; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":2793 + * } + * + * cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): # <<<<<<<<<<<<<< + * unit_attributes = {} + * unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Server._error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapUnitAttributes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_unit_attributes); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":275 - * thereof if the connection attempt fails. - * """ - * cdef public bint debug # <<<<<<<<<<<<<< - * cdef public bint rstrip - * cdef Connection _client_connection +/* "pyrfc/_cyrfc.pyx":2809 + * return unit_attributes + * + * cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): # <<<<<<<<<<<<<< + * cdef unsigned i, fieldCount + * cdef RFC_FIELD_DESC fieldDesc */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_5debug___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_5debug___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapStructure(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_STRUCTURE_HANDLE __pyx_v_container, PyObject *__pyx_v_config) { + unsigned int __pyx_v_i; + unsigned int __pyx_v_fieldCount; + RFC_FIELD_DESC __pyx_v_fieldDesc; + PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + unsigned int __pyx_t_2; + unsigned int __pyx_t_3; + unsigned int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->debug); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 275, __pyx_L1_error) + __Pyx_RefNannySetupContext("wrapStructure", 0); + + /* "pyrfc/_cyrfc.pyx":2812 + * cdef unsigned i, fieldCount + * cdef RFC_FIELD_DESC fieldDesc + * RfcGetFieldCount(typeDesc, &fieldCount, NULL) # <<<<<<<<<<<<<< + * result = {} + * for i in range(fieldCount): + */ + (void)(RfcGetFieldCount(__pyx_v_typeDesc, (&__pyx_v_fieldCount), NULL)); + + /* "pyrfc/_cyrfc.pyx":2813 + * cdef RFC_FIELD_DESC fieldDesc + * RfcGetFieldCount(typeDesc, &fieldCount, NULL) + * result = {} # <<<<<<<<<<<<<< + * for i in range(fieldCount): + * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.debug.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2814 + * RfcGetFieldCount(typeDesc, &fieldCount, NULL) + * result = {} + * for i in range(fieldCount): # <<<<<<<<<<<<<< + * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) + * result[wrapString(fieldDesc.name)] = wrapVariable( + */ + __pyx_t_2 = __pyx_v_fieldCount; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_6Server_5debug_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_5debug_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + /* "pyrfc/_cyrfc.pyx":2815 + * result = {} + * for i in range(fieldCount): + * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) # <<<<<<<<<<<<<< + * result[wrapString(fieldDesc.name)] = wrapVariable( + * fieldDesc.type, + */ + (void)(RfcGetFieldDescByIndex(__pyx_v_typeDesc, __pyx_v_i, (&__pyx_v_fieldDesc), NULL)); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2816 + * for i in range(fieldCount): + * RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) + * result[wrapString(fieldDesc.name)] = wrapVariable( # <<<<<<<<<<<<<< + * fieldDesc.type, + * container, + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapVariable(__pyx_v_fieldDesc.type, __pyx_v_container, __pyx_v_fieldDesc.name, __pyx_v_fieldDesc.nucLength, __pyx_v_fieldDesc.typeDescHandle, __pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_fieldDesc.name, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2816, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(PyObject_SetItem(__pyx_v_result, __pyx_t_5, __pyx_t_1) < 0)) __PYX_ERR(0, 2816, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } -static int __pyx_pf_5pyrfc_6_cyrfc_6Server_5debug_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 275, __pyx_L1_error) - __pyx_v_self->debug = __pyx_t_1; + /* "pyrfc/_cyrfc.pyx":2824 + * config + * ) + * if len(result) == 1: # <<<<<<<<<<<<<< + * if '' in result: + * result = result[''] + */ + __pyx_t_6 = PyObject_Length(__pyx_v_result); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2824, __pyx_L1_error) + __pyx_t_7 = ((__pyx_t_6 == 1) != 0); + if (__pyx_t_7) { - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Server.debug.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2825 + * ) + * if len(result) == 1: + * if '' in result: # <<<<<<<<<<<<<< + * result = result[''] + * return result + */ + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__5, __pyx_v_result, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2825, __pyx_L1_error) + __pyx_t_8 = (__pyx_t_7 != 0); + if (__pyx_t_8) { -/* "src/pyrfc/server.pyx":276 - * """ - * cdef public bint debug - * cdef public bint rstrip # <<<<<<<<<<<<<< - * cdef Connection _client_connection - * cdef ServerConnection _server_connection + /* "pyrfc/_cyrfc.pyx":2826 + * if len(result) == 1: + * if '' in result: + * result = result[''] # <<<<<<<<<<<<<< + * return result + * */ + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_result, __pyx_kp_s__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2826, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); + __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); + /* "pyrfc/_cyrfc.pyx":2825 + * ) + * if len(result) == 1: + * if '' in result: # <<<<<<<<<<<<<< + * result = result[''] + * return result + */ + } - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2824 + * config + * ) + * if len(result) == 1: # <<<<<<<<<<<<<< + * if '' in result: + * result = result[''] + */ + } -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + /* "pyrfc/_cyrfc.pyx":2827 + * if '' in result: + * result = result[''] + * return result # <<<<<<<<<<<<<< + * + * # # Used for debugging tables, cf. wrapTable() + */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; goto __pyx_L0; + /* "pyrfc/_cyrfc.pyx":2809 + * return unit_attributes + * + * cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): # <<<<<<<<<<<<<< + * cdef unsigned i, fieldCount + * cdef RFC_FIELD_DESC fieldDesc + */ + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.rstrip.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_6Server_6rstrip_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip_2__set__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_6Server_6rstrip_2__set__(struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(5, 276, __pyx_L1_error) - __pyx_v_self->rstrip = __pyx_t_1; - - /* function exit code */ + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapStructure", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Server.rstrip.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): +/* "pyrfc/_cyrfc.pyx":2840 + * # return wrapStructure(self.typeDesc, self.container) + * + * cdef wrapTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, config): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef unsigned rowCount */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_21__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_20__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_20__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapTable(RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, RFC_TABLE_HANDLE __pyx_v_container, PyObject *__pyx_v_config) { + RFC_ERROR_INFO __pyx_v_errorInfo; + unsigned int __pyx_v_rowCount; + PyObject *__pyx_v_table = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("wrapTable", 0); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "pyrfc/_cyrfc.pyx":2848 + * # tc.container = container + * # return tc + * RfcGetRowCount(container, &rowCount, &errorInfo) # <<<<<<<<<<<<<< + * table = [None] * rowCount + * while rowCount > 0: + */ + (void)(RfcGetRowCount(__pyx_v_container, (&__pyx_v_rowCount), (&__pyx_v_errorInfo))); + + /* "pyrfc/_cyrfc.pyx":2849 + * # return tc + * RfcGetRowCount(container, &rowCount, &errorInfo) + * table = [None] * rowCount # <<<<<<<<<<<<<< + * while rowCount > 0: + * rowCount -= 1 */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error) + __pyx_t_1 = PyList_New(1 * (__pyx_v_rowCount)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 2, __pyx_L1_error) + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_rowCount; __pyx_temp++) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyList_SET_ITEM(__pyx_t_1, __pyx_temp, Py_None); + } + } + __pyx_v_table = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "pyrfc/_cyrfc.pyx":2850 + * RfcGetRowCount(container, &rowCount, &errorInfo) + * table = [None] * rowCount + * while rowCount > 0: # <<<<<<<<<<<<<< + * rowCount -= 1 + * RfcMoveTo(container, rowCount, &errorInfo) */ + while (1) { + __pyx_t_2 = ((__pyx_v_rowCount > 0) != 0); + if (!__pyx_t_2) break; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2851 + * table = [None] * rowCount + * while rowCount > 0: + * rowCount -= 1 # <<<<<<<<<<<<<< + * RfcMoveTo(container, rowCount, &errorInfo) + * table[rowCount] = wrapStructure(typeDesc, container, config) + */ + __pyx_v_rowCount = (__pyx_v_rowCount - 1); -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "pyrfc/_cyrfc.pyx":2852 + * while rowCount > 0: + * rowCount -= 1 + * RfcMoveTo(container, rowCount, &errorInfo) # <<<<<<<<<<<<<< + * table[rowCount] = wrapStructure(typeDesc, container, config) + * RfcDeleteCurrentRow(container, &errorInfo) */ + (void)(RfcMoveTo(__pyx_v_container, __pyx_v_rowCount, (&__pyx_v_errorInfo))); -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_6Server_23__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_6Server_22__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Server *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2853 + * rowCount -= 1 + * RfcMoveTo(container, rowCount, &errorInfo) + * table[rowCount] = wrapStructure(typeDesc, container, config) # <<<<<<<<<<<<<< + * RfcDeleteCurrentRow(container, &errorInfo) + * return table + */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapStructure(__pyx_v_typeDesc, __pyx_v_container, __pyx_v_config); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2853, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(__Pyx_SetItemInt(__pyx_v_table, __pyx_v_rowCount, __pyx_t_1, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 1) < 0)) __PYX_ERR(0, 2853, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_6Server_22__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Server *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); + /* "pyrfc/_cyrfc.pyx":2854 + * RfcMoveTo(container, rowCount, &errorInfo) + * table[rowCount] = wrapStructure(typeDesc, container, config) + * RfcDeleteCurrentRow(container, &errorInfo) # <<<<<<<<<<<<<< + * return table + * + */ + (void)(RfcDeleteCurrentRow(__pyx_v_container, (&__pyx_v_errorInfo))); + } - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2855 + * table[rowCount] = wrapStructure(typeDesc, container, config) + * RfcDeleteCurrentRow(container, &errorInfo) + * return table # <<<<<<<<<<<<<< + * + * cdef wrapVariable( */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 4, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_table); + __pyx_r = __pyx_v_table; + goto __pyx_L0; - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + /* "pyrfc/_cyrfc.pyx":2840 + * # return wrapStructure(self.typeDesc, self.container) + * + * cdef wrapTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, config): # <<<<<<<<<<<<<< + * cdef RFC_ERROR_INFO errorInfo + * cdef unsigned rowCount */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Server.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("pyrfc._cyrfc.wrapTable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_table); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/server.pyx":584 - * +/* "pyrfc/_cyrfc.pyx":2857 + * return table * - * cdef RFC_TYPE_DESC_HANDLE fillTypeDescription(type_desc): # <<<<<<<<<<<<<< - * """ - * :param type_desc: object of class TypeDescription + * cdef wrapVariable( # <<<<<<<<<<<<<< + * RFCTYPE typ, + * RFC_FUNCTION_HANDLE container, */ -static RFC_TYPE_DESC_HANDLE __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(PyObject *__pyx_v_type_desc) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapVariable(RFCTYPE __pyx_v_typ, RFC_FUNCTION_HANDLE __pyx_v_container, SAP_UC *__pyx_v_cName, unsigned int __pyx_v_cLen, RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc, PyObject *__pyx_v_config) { RFC_RC __pyx_v_rc; RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_TYPE_DESC_HANDLE __pyx_v_typeDesc; - RFC_FIELD_DESC __pyx_v_fieldDesc; - SAP_UC *__pyx_v_sapuc; - PyObject *__pyx_v_field_desc = NULL; - RFC_TYPE_DESC_HANDLE __pyx_r; + RFC_STRUCTURE_HANDLE __pyx_v_structure; + RFC_TABLE_HANDLE __pyx_v_table; + RFC_CHAR *__pyx_v_charValue; + SAP_UC *__pyx_v_stringValue; + RFC_NUM *__pyx_v_numValue; + SAP_RAW *__pyx_v_byteValue; + RFC_FLOAT __pyx_v_floatValue; + RFC_INT __pyx_v_intValue; + RFC_INT1 __pyx_v_int1Value; + RFC_INT2 __pyx_v_int2Value; + RFC_INT8 __pyx_v_int8Value; + RFC_DATE __pyx_v_dateValue; + RFC_TIME __pyx_v_timeValue; + unsigned int __pyx_v_resultLen; + unsigned int __pyx_v_strLen; + PyObject *__pyx_v_utcValue = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - SAP_UC *__pyx_t_2; - int __pyx_t_3; - unsigned int __pyx_t_4; - unsigned int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - Py_ssize_t __pyx_t_9; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + char const *__pyx_t_8; + PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; - RFCTYPE __pyx_t_12; - int __pyx_t_13; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + char const *__pyx_t_15; + char const *__pyx_t_16; + char const *__pyx_t_17; + char const *__pyx_t_18; + PyObject *__pyx_t_19 = NULL; + char const *__pyx_t_20; + char const *__pyx_t_21; + char const *__pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + PyObject *__pyx_t_25 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillTypeDescription", 0); + __Pyx_RefNannySetupContext("wrapVariable", 0); - /* "src/pyrfc/server.pyx":589 - * :return: Handle of RFC_TYPE_DESC_HANDLE - * """ - * cdef RFC_RC rc = RFC_OK # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_TYPE_DESC_HANDLE typeDesc + /* "pyrfc/_cyrfc.pyx":2881 + * cdef RFC_TIME timeValue + * cdef unsigned resultLen, strLen + * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< + * rc = RfcGetStructure(container, cName, &structure, &errorInfo) + * if rc != RFC_OK: */ - __pyx_v_rc = RFC_OK; + switch (__pyx_v_typ) { + case RFCTYPE_STRUCTURE: - /* "src/pyrfc/server.pyx":596 - * - * # Set name, nuc_length, and uc_length - * sapuc = fillString(type_desc.name) # <<<<<<<<<<<<<< - * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":2882 + * cdef unsigned resultLen, strLen + * if typ == RFCTYPE_STRUCTURE: + * rc = RfcGetStructure(container, cName, &structure, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 596, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(5, 596, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sapuc = __pyx_t_2; + __pyx_v_rc = RfcGetStructure(__pyx_v_container, __pyx_v_cName, (&__pyx_v_structure), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":597 - * # Set name, nuc_length, and uc_length - * sapuc = fillString(type_desc.name) - * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) # <<<<<<<<<<<<<< - * free(sapuc) - * if typeDesc == NULL: + /* "pyrfc/_cyrfc.pyx":2883 + * if typ == RFCTYPE_STRUCTURE: + * rc = RfcGetStructure(container, cName, &structure, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapStructure(typeDesc, structure, config) */ - __pyx_v_typeDesc = RfcCreateTypeDesc(__pyx_v_sapuc, (&__pyx_v_errorInfo)); + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":598 - * sapuc = fillString(type_desc.name) - * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) - * free(sapuc) # <<<<<<<<<<<<<< - * if typeDesc == NULL: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2884 + * rc = RfcGetStructure(container, cName, &structure, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return wrapStructure(typeDesc, structure, config) + * elif typ == RFCTYPE_TABLE: */ - free(__pyx_v_sapuc); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2884, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2884, __pyx_L1_error) - /* "src/pyrfc/server.pyx":599 - * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) - * free(sapuc) - * if typeDesc == NULL: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) + /* "pyrfc/_cyrfc.pyx":2883 + * if typ == RFCTYPE_STRUCTURE: + * rc = RfcGetStructure(container, cName, &structure, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapStructure(typeDesc, structure, config) */ - __pyx_t_3 = ((__pyx_v_typeDesc == NULL) != 0); - if (unlikely(__pyx_t_3)) { + } - /* "src/pyrfc/server.pyx":600 - * free(sapuc) - * if typeDesc == NULL: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2885 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return wrapStructure(typeDesc, structure, config) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_TABLE: + * rc = RfcGetTable(container, cName, &table, &errorInfo) */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 600, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(5, 600, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapStructure(__pyx_v_typeDesc, __pyx_v_structure, __pyx_v_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2885, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/pyrfc/server.pyx":599 - * typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) - * free(sapuc) - * if typeDesc == NULL: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) + /* "pyrfc/_cyrfc.pyx":2881 + * cdef RFC_TIME timeValue + * cdef unsigned resultLen, strLen + * if typ == RFCTYPE_STRUCTURE: # <<<<<<<<<<<<<< + * rc = RfcGetStructure(container, cName, &structure, &errorInfo) + * if rc != RFC_OK: */ - } + break; + case RFCTYPE_TABLE: - /* "src/pyrfc/server.pyx":601 - * if typeDesc == NULL: - * raise wrapError(&errorInfo) - * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * RfcDestroyTypeDesc(typeDesc, NULL) + /* "pyrfc/_cyrfc.pyx":2887 + * return wrapStructure(typeDesc, structure, config) + * elif typ == RFCTYPE_TABLE: + * rc = RfcGetTable(container, cName, &table, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 601, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 601, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 601, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_rc = RfcSetTypeLength(__pyx_v_typeDesc, __pyx_t_4, __pyx_t_5, (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetTable(__pyx_v_container, __pyx_v_cName, (&__pyx_v_table), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":602 - * raise wrapError(&errorInfo) - * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * RfcDestroyTypeDesc(typeDesc, NULL) - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2888 + * elif typ == RFCTYPE_TABLE: + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapTable(typeDesc, table, config) */ - __pyx_t_3 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_3)) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":603 - * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) - * if rc != RFC_OK: - * RfcDestroyTypeDesc(typeDesc, NULL) # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2889 + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return wrapTable(typeDesc, table, config) + * elif typ == RFCTYPE_CHAR: */ - (void)(RfcDestroyTypeDesc(__pyx_v_typeDesc, NULL)); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2889, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2889, __pyx_L1_error) - /* "src/pyrfc/server.pyx":604 - * if rc != RFC_OK: - * RfcDestroyTypeDesc(typeDesc, NULL) - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * - * for field_desc in type_desc.fields: + /* "pyrfc/_cyrfc.pyx":2888 + * elif typ == RFCTYPE_TABLE: + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapTable(typeDesc, table, config) */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 604, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(5, 604, __pyx_L1_error) + } - /* "src/pyrfc/server.pyx":602 - * raise wrapError(&errorInfo) - * rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * RfcDestroyTypeDesc(typeDesc, NULL) - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2890 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return wrapTable(typeDesc, table, config) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_CHAR: + * charValue = mallocU(cLen) */ - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapTable(__pyx_v_typeDesc, __pyx_v_table, __pyx_v_config); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "src/pyrfc/server.pyx":606 - * raise wrapError(&errorInfo) - * - * for field_desc in type_desc.fields: # <<<<<<<<<<<<<< - * # Set name - * sapuc = fillString(field_desc['name']) + /* "pyrfc/_cyrfc.pyx":2886 + * raise wrapError(&errorInfo) + * return wrapStructure(typeDesc, structure, config) + * elif typ == RFCTYPE_TABLE: # <<<<<<<<<<<<<< + * rc = RfcGetTable(container, cName, &table, &errorInfo) + * if rc != RFC_OK: + */ + break; + case RFCTYPE_CHAR: + + /* "pyrfc/_cyrfc.pyx":2892 + * return wrapTable(typeDesc, table, config) + * elif typ == RFCTYPE_CHAR: + * charValue = mallocU(cLen) # <<<<<<<<<<<<<< + * try: + * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) + */ + __pyx_v_charValue = mallocU(__pyx_v_cLen); + + /* "pyrfc/_cyrfc.pyx":2893 + * elif typ == RFCTYPE_CHAR: + * charValue = mallocU(cLen) + * try: # <<<<<<<<<<<<<< + * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) + * if rc != RFC_OK: + */ + /*try:*/ { + + /* "pyrfc/_cyrfc.pyx":2894 + * charValue = mallocU(cLen) + * try: + * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_v_rc = RfcGetChars(__pyx_v_container, __pyx_v_cName, __pyx_v_charValue, __pyx_v_cLen, (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2895 + * try: + * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapString(charValue, cLen, config & _MASK_RSTRIP) + */ + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pyrfc/_cyrfc.pyx":2896 + * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return wrapString(charValue, cLen, config & _MASK_RSTRIP) + * finally: + */ + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2896, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 2896, __pyx_L6_error) + + /* "pyrfc/_cyrfc.pyx":2895 + * try: + * rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapString(charValue, cLen, config & _MASK_RSTRIP) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_type_desc, __pyx_n_s_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 606, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(5, 606, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(5, 606, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_6); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(5, 606, __pyx_L1_error) + + /* "pyrfc/_cyrfc.pyx":2897 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return wrapString(charValue, cLen, config & _MASK_RSTRIP) # <<<<<<<<<<<<<< + * finally: + * free(charValue) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_cLen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2897, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2897, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_And(__pyx_v_config, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2897, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5.__pyx_n = 2; + __pyx_t_5.uclen = __pyx_t_2; + __pyx_t_5.rstrip = __pyx_t_4; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_charValue, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2897, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L5_return; + } + + /* "pyrfc/_cyrfc.pyx":2899 + * return wrapString(charValue, cLen, config & _MASK_RSTRIP) + * finally: + * free(charValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_STRING: + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + */ + /*finally:*/ { + __pyx_L6_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_8 = __pyx_filename; + { + free(__pyx_v_charValue); } - break; + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_8; + goto __pyx_L1_error; + } + __pyx_L5_return: { + __pyx_t_14 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_charValue); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; } - __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XDECREF_SET(__pyx_v_field_desc, __pyx_t_1); - __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":608 - * for field_desc in type_desc.fields: - * # Set name - * sapuc = fillString(field_desc['name']) # <<<<<<<<<<<<<< - * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":2891 + * raise wrapError(&errorInfo) + * return wrapTable(typeDesc, table, config) + * elif typ == RFCTYPE_CHAR: # <<<<<<<<<<<<<< + * charValue = mallocU(cLen) + * try: + */ + break; + case RFCTYPE_STRING: + + /* "pyrfc/_cyrfc.pyx":2901 + * free(charValue) + * elif typ == RFCTYPE_STRING: + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) # <<<<<<<<<<<<<< + * try: + * stringValue = mallocU(strLen+1) + */ + __pyx_v_rc = RfcGetStringLength(__pyx_v_container, __pyx_v_cName, (&__pyx_v_strLen), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":2902 + * elif typ == RFCTYPE_STRING: + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * try: # <<<<<<<<<<<<<< + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + */ + /*try:*/ { + + /* "pyrfc/_cyrfc.pyx":2903 + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * try: + * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 608, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(5, 608, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sapuc = __pyx_t_2; + __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); - /* "src/pyrfc/server.pyx":609 - * # Set name - * sapuc = fillString(field_desc['name']) - * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * fieldDesc.type = RfcFieldType[field_desc['field_type']].value + /* "pyrfc/_cyrfc.pyx":2904 + * try: + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(5, 609, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_fieldDesc.name, __pyx_v_sapuc, (__pyx_t_9 + 1)); + __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":610 - * sapuc = fillString(field_desc['name']) - * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * fieldDesc.type = RfcFieldType[field_desc['field_type']].value - * fieldDesc.nucLength = field_desc['nuc_length'] + /* "pyrfc/_cyrfc.pyx":2905 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapString(stringValue, resultLen) */ - free(__pyx_v_sapuc); + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":611 - * strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) - * free(sapuc) - * fieldDesc.type = RfcFieldType[field_desc['field_type']].value # <<<<<<<<<<<<<< - * fieldDesc.nucLength = field_desc['nuc_length'] - * fieldDesc.nucOffset = field_desc['nuc_offset'] + /* "pyrfc/_cyrfc.pyx":2906 + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return wrapString(stringValue, resultLen) + * finally: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_field_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(5, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 611, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_12 = ((RFCTYPE)__Pyx_PyInt_As_RFCTYPE(__pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 611, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_fieldDesc.type = __pyx_t_12; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2906, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2906, __pyx_L12_error) - /* "src/pyrfc/server.pyx":612 - * free(sapuc) - * fieldDesc.type = RfcFieldType[field_desc['field_type']].value - * fieldDesc.nucLength = field_desc['nuc_length'] # <<<<<<<<<<<<<< - * fieldDesc.nucOffset = field_desc['nuc_offset'] - * fieldDesc.ucLength = field_desc['uc_length'] + /* "pyrfc/_cyrfc.pyx":2905 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapString(stringValue, resultLen) */ - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 612, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 612, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_fieldDesc.nucLength = __pyx_t_5; + } - /* "src/pyrfc/server.pyx":613 - * fieldDesc.type = RfcFieldType[field_desc['field_type']].value - * fieldDesc.nucLength = field_desc['nuc_length'] - * fieldDesc.nucOffset = field_desc['nuc_offset'] # <<<<<<<<<<<<<< - * fieldDesc.ucLength = field_desc['uc_length'] - * fieldDesc.ucOffset = field_desc['uc_offset'] + /* "pyrfc/_cyrfc.pyx":2907 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return wrapString(stringValue, resultLen) # <<<<<<<<<<<<<< + * finally: + * free(stringValue) */ - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_nuc_offset); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 613, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_fieldDesc.nucOffset = __pyx_t_5; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_resultLen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2907, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.uclen = __pyx_t_3; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2907, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L11_return; + } - /* "src/pyrfc/server.pyx":614 - * fieldDesc.nucLength = field_desc['nuc_length'] - * fieldDesc.nucOffset = field_desc['nuc_offset'] - * fieldDesc.ucLength = field_desc['uc_length'] # <<<<<<<<<<<<<< - * fieldDesc.ucOffset = field_desc['uc_offset'] - * fieldDesc.decimals = field_desc['decimals'] + /* "pyrfc/_cyrfc.pyx":2909 + * return wrapString(stringValue, resultLen) + * finally: + * free(stringValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_NUM: + * numValue = mallocU(cLen) */ - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 614, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_fieldDesc.ucLength = __pyx_t_5; + /*finally:*/ { + __pyx_L12_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_15 = __pyx_filename; + { + free(__pyx_v_stringValue); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); + } + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_15; + goto __pyx_L1_error; + } + __pyx_L11_return: { + __pyx_t_9 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_stringValue); + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L0; + } + } - /* "src/pyrfc/server.pyx":615 - * fieldDesc.nucOffset = field_desc['nuc_offset'] - * fieldDesc.ucLength = field_desc['uc_length'] - * fieldDesc.ucOffset = field_desc['uc_offset'] # <<<<<<<<<<<<<< - * fieldDesc.decimals = field_desc['decimals'] - * if field_desc['type_description'] is not None: + /* "pyrfc/_cyrfc.pyx":2900 + * finally: + * free(charValue) + * elif typ == RFCTYPE_STRING: # <<<<<<<<<<<<<< + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * try: */ - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_uc_offset); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 615, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_fieldDesc.ucOffset = __pyx_t_5; + break; + case RFCTYPE_NUM: - /* "src/pyrfc/server.pyx":616 - * fieldDesc.ucLength = field_desc['uc_length'] - * fieldDesc.ucOffset = field_desc['uc_offset'] - * fieldDesc.decimals = field_desc['decimals'] # <<<<<<<<<<<<<< - * if field_desc['type_description'] is not None: - * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) + /* "pyrfc/_cyrfc.pyx":2911 + * free(stringValue) + * elif typ == RFCTYPE_NUM: + * numValue = mallocU(cLen) # <<<<<<<<<<<<<< + * try: + * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) */ - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_decimals); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_t_10); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 616, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_fieldDesc.decimals = __pyx_t_5; + __pyx_v_numValue = mallocU(__pyx_v_cLen); - /* "src/pyrfc/server.pyx":617 - * fieldDesc.ucOffset = field_desc['uc_offset'] - * fieldDesc.decimals = field_desc['decimals'] - * if field_desc['type_description'] is not None: # <<<<<<<<<<<<<< - * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) - * else: + /* "pyrfc/_cyrfc.pyx":2912 + * elif typ == RFCTYPE_NUM: + * numValue = mallocU(cLen) + * try: # <<<<<<<<<<<<<< + * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = (__pyx_t_10 != Py_None); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_13 = (__pyx_t_3 != 0); - if (__pyx_t_13) { + /*try:*/ { - /* "src/pyrfc/server.pyx":618 - * fieldDesc.decimals = field_desc['decimals'] - * if field_desc['type_description'] is not None: - * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) # <<<<<<<<<<<<<< - * else: - * fieldDesc.typeDescHandle = NULL + /* "pyrfc/_cyrfc.pyx":2913 + * numValue = mallocU(cLen) + * try: + * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_10 = __Pyx_PyObject_Dict_GetItem(__pyx_v_field_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_v_fieldDesc.typeDescHandle = __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_rc = RfcGetNum(__pyx_v_container, __pyx_v_cName, __pyx_v_numValue, __pyx_v_cLen, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":617 - * fieldDesc.ucOffset = field_desc['uc_offset'] - * fieldDesc.decimals = field_desc['decimals'] - * if field_desc['type_description'] is not None: # <<<<<<<<<<<<<< - * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) - * else: + /* "pyrfc/_cyrfc.pyx":2914 + * try: + * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapString(numValue, cLen) */ - goto __pyx_L7; - } + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":620 - * fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) - * else: - * fieldDesc.typeDescHandle = NULL # <<<<<<<<<<<<<< - * fieldDesc.extendedDescription = NULL - * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":2915 + * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return wrapString(numValue, cLen) + * finally: */ - /*else*/ { - __pyx_v_fieldDesc.typeDescHandle = NULL; - } - __pyx_L7:; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2915, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 2915, __pyx_L18_error) - /* "src/pyrfc/server.pyx":621 - * else: - * fieldDesc.typeDescHandle = NULL - * fieldDesc.extendedDescription = NULL # <<<<<<<<<<<<<< - * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2914 + * try: + * rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return wrapString(numValue, cLen) */ - __pyx_v_fieldDesc.extendedDescription = NULL; + } - /* "src/pyrfc/server.pyx":622 - * fieldDesc.typeDescHandle = NULL - * fieldDesc.extendedDescription = NULL - * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * RfcDestroyTypeDesc(typeDesc, NULL) + /* "pyrfc/_cyrfc.pyx":2916 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return wrapString(numValue, cLen) # <<<<<<<<<<<<<< + * finally: + * free(numValue) */ - __pyx_v_rc = RfcAddTypeField(__pyx_v_typeDesc, (&__pyx_v_fieldDesc), (&__pyx_v_errorInfo)); + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_cLen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2916, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.uclen = __pyx_t_4; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_numValue, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2916, __pyx_L18_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L17_return; + } - /* "src/pyrfc/server.pyx":623 - * fieldDesc.extendedDescription = NULL - * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * RfcDestroyTypeDesc(typeDesc, NULL) - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2918 + * return wrapString(numValue, cLen) + * finally: + * free(numValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_BYTE: + * byteValue = malloc(cLen) */ - __pyx_t_13 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_13)) { + /*finally:*/ { + __pyx_L18_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_16 = __pyx_filename; + { + free(__pyx_v_numValue); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_16; + goto __pyx_L1_error; + } + __pyx_L17_return: { + __pyx_t_14 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_numValue); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; + } + } - /* "src/pyrfc/server.pyx":624 - * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) - * if rc != RFC_OK: - * RfcDestroyTypeDesc(typeDesc, NULL) # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2910 + * finally: + * free(stringValue) + * elif typ == RFCTYPE_NUM: # <<<<<<<<<<<<<< + * numValue = mallocU(cLen) + * try: */ - (void)(RfcDestroyTypeDesc(__pyx_v_typeDesc, NULL)); + break; + case RFCTYPE_BYTE: - /* "src/pyrfc/server.pyx":625 - * if rc != RFC_OK: - * RfcDestroyTypeDesc(typeDesc, NULL) - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * - * return typeDesc + /* "pyrfc/_cyrfc.pyx":2920 + * free(numValue) + * elif typ == RFCTYPE_BYTE: + * byteValue = malloc(cLen) # <<<<<<<<<<<<<< + * try: + * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) */ - __pyx_t_10 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(5, 625, __pyx_L1_error) + __pyx_v_byteValue = ((SAP_RAW *)malloc(__pyx_v_cLen)); - /* "src/pyrfc/server.pyx":623 - * fieldDesc.extendedDescription = NULL - * rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * RfcDestroyTypeDesc(typeDesc, NULL) - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2921 + * elif typ == RFCTYPE_BYTE: + * byteValue = malloc(cLen) + * try: # <<<<<<<<<<<<<< + * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) + * if rc != RFC_OK: */ - } + /*try:*/ { - /* "src/pyrfc/server.pyx":606 - * raise wrapError(&errorInfo) - * - * for field_desc in type_desc.fields: # <<<<<<<<<<<<<< - * # Set name - * sapuc = fillString(field_desc['name']) + /* "pyrfc/_cyrfc.pyx":2922 + * byteValue = malloc(cLen) + * try: + * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_rc = RfcGetBytes(__pyx_v_container, __pyx_v_cName, __pyx_v_byteValue, __pyx_v_cLen, (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":627 - * raise wrapError(&errorInfo) - * - * return typeDesc # <<<<<<<<<<<<<< - * - * cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): + /* "pyrfc/_cyrfc.pyx":2923 + * try: + * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return byteValue[:cLen] */ - __pyx_r = __pyx_v_typeDesc; - goto __pyx_L0; + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":584 - * - * - * cdef RFC_TYPE_DESC_HANDLE fillTypeDescription(type_desc): # <<<<<<<<<<<<<< - * """ - * :param type_desc: object of class TypeDescription + /* "pyrfc/_cyrfc.pyx":2924 + * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return byteValue[:cLen] + * finally: */ + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2924, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2924, __pyx_L24_error) - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_WriteUnraisable("pyrfc._cyrfc.fillTypeDescription", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_field_desc); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":2923 + * try: + * rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return byteValue[:cLen] + */ + } -/* "src/pyrfc/server.pyx":629 - * return typeDesc - * - * cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): # <<<<<<<<<<<<<< - * """ - * :param func_desc: object of class FunctionDescription + /* "pyrfc/_cyrfc.pyx":2925 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return byteValue[:cLen] # <<<<<<<<<<<<<< + * finally: + * free(byteValue) */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_byteValue) + 0, __pyx_v_cLen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2925, __pyx_L24_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L23_return; + } -static RFC_FUNCTION_DESC_HANDLE __pyx_f_5pyrfc_6_cyrfc_fillFunctionDescription(PyObject *__pyx_v_func_desc) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_FUNCTION_DESC_HANDLE __pyx_v_funcDesc; - RFC_PARAMETER_DESC __pyx_v_paramDesc; - SAP_UC *__pyx_v_sapuc; - PyObject *__pyx_v_param_desc = NULL; - RFC_RC __pyx_v_rc; - RFC_FUNCTION_DESC_HANDLE __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - SAP_UC *__pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - Py_ssize_t __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - RFCTYPE __pyx_t_10; - RFC_DIRECTION __pyx_t_11; - unsigned int __pyx_t_12; - int __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillFunctionDescription", 0); + /* "pyrfc/_cyrfc.pyx":2927 + * return byteValue[:cLen] + * finally: + * free(byteValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_XSTRING: + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + */ + /*finally:*/ { + __pyx_L24_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_17 = __pyx_filename; + { + free(__pyx_v_byteValue); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); + } + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_17; + goto __pyx_L1_error; + } + __pyx_L23_return: { + __pyx_t_9 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_byteValue); + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L0; + } + } - /* "src/pyrfc/server.pyx":640 - * - * # Set name - * sapuc = fillString(func_desc.name) # <<<<<<<<<<<<<< - * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":2919 + * finally: + * free(numValue) + * elif typ == RFCTYPE_BYTE: # <<<<<<<<<<<<<< + * byteValue = malloc(cLen) + * try: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(5, 640, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sapuc = __pyx_t_2; + break; + case RFCTYPE_XSTRING: - /* "src/pyrfc/server.pyx":641 - * # Set name - * sapuc = fillString(func_desc.name) - * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) # <<<<<<<<<<<<<< - * free(sapuc) - * if funcDesc == NULL: + /* "pyrfc/_cyrfc.pyx":2929 + * free(byteValue) + * elif typ == RFCTYPE_XSTRING: + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) # <<<<<<<<<<<<<< + * try: + * byteValue = malloc(strLen+1) */ - __pyx_v_funcDesc = RfcCreateFunctionDesc(__pyx_v_sapuc, (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetStringLength(__pyx_v_container, __pyx_v_cName, (&__pyx_v_strLen), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":642 - * sapuc = fillString(func_desc.name) - * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) - * free(sapuc) # <<<<<<<<<<<<<< - * if funcDesc == NULL: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2930 + * elif typ == RFCTYPE_XSTRING: + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * try: # <<<<<<<<<<<<<< + * byteValue = malloc(strLen+1) + * byteValue[strLen] = 0 */ - free(__pyx_v_sapuc); + /*try:*/ { - /* "src/pyrfc/server.pyx":643 - * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) - * free(sapuc) - * if funcDesc == NULL: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2931 + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * try: + * byteValue = malloc(strLen+1) # <<<<<<<<<<<<<< + * byteValue[strLen] = 0 + * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) */ - __pyx_t_3 = ((__pyx_v_funcDesc == NULL) != 0); - if (unlikely(__pyx_t_3)) { + __pyx_v_byteValue = ((SAP_RAW *)malloc((__pyx_v_strLen + 1))); - /* "src/pyrfc/server.pyx":644 - * free(sapuc) - * if funcDesc == NULL: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * - * for param_desc in func_desc.parameters: + /* "pyrfc/_cyrfc.pyx":2932 + * try: + * byteValue = malloc(strLen+1) + * byteValue[strLen] = 0 # <<<<<<<<<<<<<< + * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 644, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(5, 644, __pyx_L1_error) + (__pyx_v_byteValue[__pyx_v_strLen]) = 0; - /* "src/pyrfc/server.pyx":643 - * funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) - * free(sapuc) - * if funcDesc == NULL: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2933 + * byteValue = malloc(strLen+1) + * byteValue[strLen] = 0 + * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - } + __pyx_v_rc = RfcGetXString(__pyx_v_container, __pyx_v_cName, __pyx_v_byteValue, __pyx_v_strLen, (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":646 - * raise wrapError(&errorInfo) - * - * for param_desc in func_desc.parameters: # <<<<<<<<<<<<<< - * sapuc = fillString(param_desc['name']) - * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + /* "pyrfc/_cyrfc.pyx":2934 + * byteValue[strLen] = 0 + * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return byteValue[:resultLen] */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_func_desc, __pyx_n_s_parameters); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 646, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 646, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 646, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(5, 646, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 646, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(5, 646, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 646, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_6(__pyx_t_4); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(5, 646, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_param_desc, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":647 - * - * for param_desc in func_desc.parameters: - * sapuc = fillString(param_desc['name']) # <<<<<<<<<<<<<< - * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":2935 + * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return byteValue[:resultLen] + * finally: */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 647, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(5, 647, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sapuc = __pyx_t_2; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2935, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2935, __pyx_L30_error) - /* "src/pyrfc/server.pyx":648 - * for param_desc in func_desc.parameters: - * sapuc = fillString(param_desc['name']) - * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value + /* "pyrfc/_cyrfc.pyx":2934 + * byteValue[strLen] = 0 + * rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return byteValue[:resultLen] */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(5, 648, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - strncpyU(__pyx_v_paramDesc.name, __pyx_v_sapuc, (__pyx_t_7 + 1)); + } - /* "src/pyrfc/server.pyx":649 - * sapuc = fillString(param_desc['name']) - * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value - * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value + /* "pyrfc/_cyrfc.pyx":2936 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return byteValue[:resultLen] # <<<<<<<<<<<<<< + * finally: + * free(byteValue) */ - free(__pyx_v_sapuc); + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_byteValue) + 0, __pyx_v_resultLen - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2936, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L29_return; + } - /* "src/pyrfc/server.pyx":650 - * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) - * free(sapuc) - * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value # <<<<<<<<<<<<<< - * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value - * paramDesc.nucLength = param_desc['nuc_length'] + /* "pyrfc/_cyrfc.pyx":2938 + * return byteValue[:resultLen] + * finally: + * free(byteValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_BCD: + * # An upper bound for the length of the _string representation_ */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RfcFieldType); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 650, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_parameter_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 650, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 650, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 650, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = ((RFCTYPE)__Pyx_PyInt_As_RFCTYPE(__pyx_t_8)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 650, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_paramDesc.type = __pyx_t_10; + /*finally:*/ { + __pyx_L30_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_18 = __pyx_filename; + { + free(__pyx_v_byteValue); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_18; + goto __pyx_L1_error; + } + __pyx_L29_return: { + __pyx_t_14 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_byteValue); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; + } + } - /* "src/pyrfc/server.pyx":651 - * free(sapuc) - * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value - * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value # <<<<<<<<<<<<<< - * paramDesc.nucLength = param_desc['nuc_length'] - * paramDesc.ucLength = param_desc['uc_length'] + /* "pyrfc/_cyrfc.pyx":2928 + * finally: + * free(byteValue) + * elif typ == RFCTYPE_XSTRING: # <<<<<<<<<<<<<< + * rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_RfcParameterDirection); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_direction); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 651, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_11 = ((RFC_DIRECTION)__Pyx_PyInt_As_RFC_DIRECTION(__pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(5, 651, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_paramDesc.direction = __pyx_t_11; + break; + case RFCTYPE_BCD: - /* "src/pyrfc/server.pyx":652 - * paramDesc.type = RfcFieldType[param_desc['parameter_type']].value - * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value - * paramDesc.nucLength = param_desc['nuc_length'] # <<<<<<<<<<<<<< - * paramDesc.ucLength = param_desc['uc_length'] - * paramDesc.decimals = param_desc['decimals'] + /* "pyrfc/_cyrfc.pyx":2945 + * # Furthermore, a sign char, a decimal separator char may be present + * # => (2*cLen)+1 + * strLen = 2*cLen + 1 # <<<<<<<<<<<<<< + * try: + * stringValue = mallocU(strLen+1) */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_nuc_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 652, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_9); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 652, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_paramDesc.nucLength = __pyx_t_12; + __pyx_v_strLen = ((2 * __pyx_v_cLen) + 1); - /* "src/pyrfc/server.pyx":653 - * paramDesc.direction = RfcParameterDirection[param_desc['direction']].value - * paramDesc.nucLength = param_desc['nuc_length'] - * paramDesc.ucLength = param_desc['uc_length'] # <<<<<<<<<<<<<< - * paramDesc.decimals = param_desc['decimals'] - * # defaultValue + /* "pyrfc/_cyrfc.pyx":2946 + * # => (2*cLen)+1 + * strLen = 2*cLen + 1 + * try: # <<<<<<<<<<<<<< + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_uc_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 653, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_9); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 653, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_paramDesc.ucLength = __pyx_t_12; + /*try:*/ { - /* "src/pyrfc/server.pyx":654 - * paramDesc.nucLength = param_desc['nuc_length'] - * paramDesc.ucLength = param_desc['uc_length'] - * paramDesc.decimals = param_desc['decimals'] # <<<<<<<<<<<<<< - * # defaultValue - * sapuc = fillString(param_desc['default_value']) + /* "pyrfc/_cyrfc.pyx":2947 + * strLen = 2*cLen + 1 + * try: + * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc == 23: # Buffer too small, use returned requried result length */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_decimals); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = __Pyx_PyInt_As_unsigned_int(__pyx_t_9); if (unlikely((__pyx_t_12 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(5, 654, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_paramDesc.decimals = __pyx_t_12; + __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); - /* "src/pyrfc/server.pyx":656 - * paramDesc.decimals = param_desc['decimals'] - * # defaultValue - * sapuc = fillString(param_desc['default_value']) # <<<<<<<<<<<<<< - * strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":2948 + * try: + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc == 23: # Buffer too small, use returned requried result length + * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_default_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_9); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(5, 656, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_sapuc = __pyx_t_2; + __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":657 - * # defaultValue - * sapuc = fillString(param_desc['default_value']) - * strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * # parameterText + /* "pyrfc/_cyrfc.pyx":2949 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< + * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " + * # "trying with {}".format(cLen, strLen, resultLen)) */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_default_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 657, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(5, 657, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - strncpyU(__pyx_v_paramDesc.defaultValue, __pyx_v_sapuc, (__pyx_t_7 + 1)); + __pyx_t_1 = ((__pyx_v_rc == 23) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/server.pyx":658 - * sapuc = fillString(param_desc['default_value']) - * strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * # parameterText - * sapuc = fillString(param_desc['parameter_text']) + /* "pyrfc/_cyrfc.pyx":2952 + * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " + * # "trying with {}".format(cLen, strLen, resultLen)) + * free(stringValue) # <<<<<<<<<<<<<< + * strLen = resultLen + * stringValue = mallocU(strLen+1) */ - free(__pyx_v_sapuc); + free(__pyx_v_stringValue); - /* "src/pyrfc/server.pyx":660 - * free(sapuc) - * # parameterText - * sapuc = fillString(param_desc['parameter_text']) # <<<<<<<<<<<<<< - * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) - * free(sapuc) + /* "pyrfc/_cyrfc.pyx":2953 + * # "trying with {}".format(cLen, strLen, resultLen)) + * free(stringValue) + * strLen = resultLen # <<<<<<<<<<<<<< + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_parameter_text); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_9); if (unlikely(__pyx_t_2 == ((SAP_UC *)NULL))) __PYX_ERR(5, 660, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_sapuc = __pyx_t_2; + __pyx_v_strLen = __pyx_v_resultLen; - /* "src/pyrfc/server.pyx":661 - * # parameterText - * sapuc = fillString(param_desc['parameter_text']) - * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * paramDesc.optional = param_desc['optional'] + /* "pyrfc/_cyrfc.pyx":2954 + * free(stringValue) + * strLen = resultLen + * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_parameter_text); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 661, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(5, 661, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - strncpyU(__pyx_v_paramDesc.parameterText, __pyx_v_sapuc, (__pyx_t_7 + 1)); + __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); - /* "src/pyrfc/server.pyx":662 - * sapuc = fillString(param_desc['parameter_text']) - * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * paramDesc.optional = param_desc['optional'] - * if param_desc['type_description'] is not None: + /* "pyrfc/_cyrfc.pyx":2955 + * strLen = resultLen + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - free(__pyx_v_sapuc); + __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":663 - * strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) - * free(sapuc) - * paramDesc.optional = param_desc['optional'] # <<<<<<<<<<<<<< - * if param_desc['type_description'] is not None: - * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) + /* "pyrfc/_cyrfc.pyx":2949 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< + * # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " + * # "trying with {}".format(cLen, strLen, resultLen)) */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_optional); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 663, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_paramDesc.optional = __pyx_t_3; + } - /* "src/pyrfc/server.pyx":664 - * free(sapuc) - * paramDesc.optional = param_desc['optional'] - * if param_desc['type_description'] is not None: # <<<<<<<<<<<<<< - * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) - * else: + /* "pyrfc/_cyrfc.pyx":2956 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 664, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_13 = (__pyx_t_3 != 0); - if (__pyx_t_13) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":665 - * paramDesc.optional = param_desc['optional'] - * if param_desc['type_description'] is not None: - * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) # <<<<<<<<<<<<<< - * else: - * paramDesc.typeDescHandle = NULL + /* "pyrfc/_cyrfc.pyx":2957 + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + * finally: */ - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param_desc, __pyx_n_s_type_description); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 665, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_v_paramDesc.typeDescHandle = __pyx_f_5pyrfc_6_cyrfc_fillTypeDescription(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2957, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2957, __pyx_L36_error) - /* "src/pyrfc/server.pyx":664 - * free(sapuc) - * paramDesc.optional = param_desc['optional'] - * if param_desc['type_description'] is not None: # <<<<<<<<<<<<<< - * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) - * else: + /* "pyrfc/_cyrfc.pyx":2956 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) */ - goto __pyx_L6; + } + + /* "pyrfc/_cyrfc.pyx":2958 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) # <<<<<<<<<<<<<< + * finally: + * free(stringValue) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2958, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2958, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_19 = PyNumber_And(__pyx_v_config, __pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2958, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5.__pyx_n = 2; + __pyx_t_5.uclen = __pyx_int_neg_1; + __pyx_t_5.rstrip = __pyx_t_19; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2958, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_19, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2958, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L35_return; } - /* "src/pyrfc/server.pyx":667 - * paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) - * else: - * paramDesc.typeDescHandle = NULL # <<<<<<<<<<<<<< - * paramDesc.extendedDescription = NULL - * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) + /* "pyrfc/_cyrfc.pyx":2960 + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + * finally: + * free(stringValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + * # An upper bound for the length of the _string representation_ */ - /*else*/ { - __pyx_v_paramDesc.typeDescHandle = NULL; + /*finally:*/ { + __pyx_L36_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_20 = __pyx_filename; + { + free(__pyx_v_stringValue); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); + } + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_20; + goto __pyx_L1_error; + } + __pyx_L35_return: { + __pyx_t_9 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_stringValue); + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L0; + } } - __pyx_L6:; - - /* "src/pyrfc/server.pyx":668 - * else: - * paramDesc.typeDescHandle = NULL - * paramDesc.extendedDescription = NULL # <<<<<<<<<<<<<< - * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) - * if rc != RFC_OK: - */ - __pyx_v_paramDesc.extendedDescription = NULL; - /* "src/pyrfc/server.pyx":669 - * paramDesc.typeDescHandle = NULL - * paramDesc.extendedDescription = NULL - * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * RfcDestroyFunctionDesc(funcDesc, NULL) + /* "pyrfc/_cyrfc.pyx":2939 + * finally: + * free(byteValue) + * elif typ == RFCTYPE_BCD: # <<<<<<<<<<<<<< + * # An upper bound for the length of the _string representation_ + * # of the BCD is given by (2*cLen)-1 (each digit is encoded in 4bit, */ - __pyx_v_rc = RfcAddParameter(__pyx_v_funcDesc, (&__pyx_v_paramDesc), (&__pyx_v_errorInfo)); + break; + case RFCTYPE_DECF16: - /* "src/pyrfc/server.pyx":670 - * paramDesc.extendedDescription = NULL - * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * RfcDestroyFunctionDesc(funcDesc, NULL) - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2961 + * finally: + * free(stringValue) + * elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< + * # An upper bound for the length of the _string representation_ + * # of the DECF is given by (2*cLen)-1 (each digit is encoded in 4bit, */ - __pyx_t_13 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_13)) { + case RFCTYPE_DECF34: - /* "src/pyrfc/server.pyx":671 - * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) - * if rc != RFC_OK: - * RfcDestroyFunctionDesc(funcDesc, NULL) # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":2969 + * # and exponent char, sign and exponent + * # => +9 + * strLen = 2*cLen + 10 # <<<<<<<<<<<<<< + * try: + * stringValue = mallocU(strLen+1) */ - (void)(RfcDestroyFunctionDesc(__pyx_v_funcDesc, NULL)); + __pyx_v_strLen = ((2 * __pyx_v_cLen) + 10); - /* "src/pyrfc/server.pyx":672 - * if rc != RFC_OK: - * RfcDestroyFunctionDesc(funcDesc, NULL) - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * - * return funcDesc + /* "pyrfc/_cyrfc.pyx":2970 + * # => +9 + * strLen = 2*cLen + 10 + * try: # <<<<<<<<<<<<<< + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) */ - __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 672, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_Raise(__pyx_t_9, 0, 0, 0); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __PYX_ERR(5, 672, __pyx_L1_error) + /*try:*/ { - /* "src/pyrfc/server.pyx":670 - * paramDesc.extendedDescription = NULL - * rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * RfcDestroyFunctionDesc(funcDesc, NULL) - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2971 + * strLen = 2*cLen + 10 + * try: + * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc == 23: # Buffer too small, use returned requried result length */ - } + __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); - /* "src/pyrfc/server.pyx":646 - * raise wrapError(&errorInfo) - * - * for param_desc in func_desc.parameters: # <<<<<<<<<<<<<< - * sapuc = fillString(param_desc['name']) - * strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + /* "pyrfc/_cyrfc.pyx":2972 + * try: + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc == 23: # Buffer too small, use returned requried result length + * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":674 - * raise wrapError(&errorInfo) - * - * return funcDesc # <<<<<<<<<<<<<< - * - * cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: + /* "pyrfc/_cyrfc.pyx":2973 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< + * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " + * # "trying with {}".format(cLen, strLen, resultLen)) */ - __pyx_r = __pyx_v_funcDesc; - goto __pyx_L0; + __pyx_t_1 = ((__pyx_v_rc == 23) != 0); + if (__pyx_t_1) { - /* "src/pyrfc/server.pyx":629 - * return typeDesc - * - * cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): # <<<<<<<<<<<<<< - * """ - * :param func_desc: object of class FunctionDescription + /* "pyrfc/_cyrfc.pyx":2976 + * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " + * # "trying with {}".format(cLen, strLen, resultLen)) + * free(stringValue) # <<<<<<<<<<<<<< + * strLen = resultLen + * stringValue = mallocU(strLen+1) */ + free(__pyx_v_stringValue); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_WriteUnraisable("pyrfc._cyrfc.fillFunctionDescription", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_param_desc); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/server.pyx":676 - * return funcDesc - * - * cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: # <<<<<<<<<<<<<< - * cdef RFC_UNIT_IDENTIFIER uIdentifier - * cdef SAP_UC* sapuc + /* "pyrfc/_cyrfc.pyx":2977 + * # "trying with {}".format(cLen, strLen, resultLen)) + * free(stringValue) + * strLen = resultLen # <<<<<<<<<<<<<< + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) */ + __pyx_v_strLen = __pyx_v_resultLen; -static RFC_UNIT_IDENTIFIER __pyx_f_5pyrfc_6_cyrfc_fillUnitIdentifier(PyObject *__pyx_v_unit) { - RFC_UNIT_IDENTIFIER __pyx_v_uIdentifier; - SAP_UC *__pyx_v_sapuc; - RFC_UNIT_IDENTIFIER __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - SAP_UC *__pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - Py_UCS4 __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("fillUnitIdentifier", 0); - - /* "src/pyrfc/server.pyx":679 - * cdef RFC_UNIT_IDENTIFIER uIdentifier - * cdef SAP_UC* sapuc - * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] # <<<<<<<<<<<<<< - * if len(unit['id']) != RFC_UNITID_LN: - * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") + /* "pyrfc/_cyrfc.pyx":2978 + * free(stringValue) + * strLen = resultLen + * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_queued); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 679, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(5, 679, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { - __Pyx_INCREF(__pyx_n_s_Q); - __pyx_t_1 = __pyx_n_s_Q; - } else { - __Pyx_INCREF(__pyx_n_s_T); - __pyx_t_1 = __pyx_n_s_T; - } - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(5, 679, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_uIdentifier.unitType = (__pyx_t_4[0]); + __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); - /* "src/pyrfc/server.pyx":680 - * cdef SAP_UC* sapuc - * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] - * if len(unit['id']) != RFC_UNITID_LN: # <<<<<<<<<<<<<< - * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") - * sapuc = fillString(unit['id']) + /* "pyrfc/_cyrfc.pyx":2979 + * strLen = resultLen + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(5, 680, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((__pyx_t_5 != RFC_UNITID_LN) != 0); - if (unlikely(__pyx_t_3)) { + __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); - /* "src/pyrfc/server.pyx":681 - * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] - * if len(unit['id']) != RFC_UNITID_LN: - * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") # <<<<<<<<<<<<<< - * sapuc = fillString(unit['id']) - * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) + /* "pyrfc/_cyrfc.pyx":2973 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc == 23: # Buffer too small, use returned requried result length # <<<<<<<<<<<<<< + * # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " + * # "trying with {}".format(cLen, strLen, resultLen)) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = 0; - __pyx_t_7 = 127; - __Pyx_INCREF(__pyx_kp_u_Invalid_length_of_unit_id_should); - __pyx_t_5 += 40; - __Pyx_GIVEREF(__pyx_kp_u_Invalid_length_of_unit_id_should); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_Invalid_length_of_unit_id_should); - __pyx_t_8 = __Pyx_PyUnicode_From_int(RFC_UNITID_LN, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_kp_u_but_found); - __pyx_t_5 += 12; - __Pyx_GIVEREF(__pyx_kp_u_but_found); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_but_found); - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_Length(__pyx_t_8); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_9, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_8); - __pyx_t_8 = 0; - __Pyx_INCREF(__pyx_kp_u__40); - __pyx_t_5 += 2; - __Pyx_GIVEREF(__pyx_kp_u__40); - PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_kp_u__40); - __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_6, 5, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 681, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(5, 681, __pyx_L1_error) - - /* "src/pyrfc/server.pyx":680 - * cdef SAP_UC* sapuc - * uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] - * if len(unit['id']) != RFC_UNITID_LN: # <<<<<<<<<<<<<< - * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") - * sapuc = fillString(unit['id']) - */ - } - - /* "src/pyrfc/server.pyx":682 - * if len(unit['id']) != RFC_UNITID_LN: - * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") - * sapuc = fillString(unit['id']) # <<<<<<<<<<<<<< - * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) - * free(sapuc) - */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_unit, __pyx_n_s_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 682, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_fillString(__pyx_t_1); if (unlikely(__pyx_t_4 == ((SAP_UC *)NULL))) __PYX_ERR(5, 682, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sapuc = __pyx_t_4; - /* "src/pyrfc/server.pyx":683 - * raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") - * sapuc = fillString(unit['id']) - * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) # <<<<<<<<<<<<<< - * free(sapuc) - * return uIdentifier + /* "pyrfc/_cyrfc.pyx":2980 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) */ - strncpyU(__pyx_v_uIdentifier.unitID, __pyx_v_sapuc, (RFC_UNITID_LN + 1)); + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/server.pyx":684 - * sapuc = fillString(unit['id']) - * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) - * free(sapuc) # <<<<<<<<<<<<<< - * return uIdentifier + /* "pyrfc/_cyrfc.pyx":2981 + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + * finally: */ - free(__pyx_v_sapuc); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2981, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2981, __pyx_L43_error) - /* "src/pyrfc/server.pyx":685 - * strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) - * free(sapuc) - * return uIdentifier # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2980 + * stringValue = mallocU(strLen+1) + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) */ - __pyx_r = __pyx_v_uIdentifier; - goto __pyx_L0; + } - /* "src/pyrfc/server.pyx":676 - * return funcDesc - * - * cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: # <<<<<<<<<<<<<< - * cdef RFC_UNIT_IDENTIFIER uIdentifier - * cdef SAP_UC* sapuc + /* "pyrfc/_cyrfc.pyx":2982 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) # <<<<<<<<<<<<<< + * finally: + * free(stringValue) */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2982, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MASK_RSTRIP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2982, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_19 = PyNumber_And(__pyx_v_config, __pyx_t_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 2982, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5.__pyx_n = 2; + __pyx_t_5.uclen = __pyx_int_neg_1; + __pyx_t_5.rstrip = __pyx_t_19; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2982, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_19, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2982, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L42_return; + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyrfc._cyrfc.fillUnitIdentifier", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":12 - * cdef _connections - * - * def __init__(self, connections = None): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * self._throughput_handle = NULL + /* "pyrfc/_cyrfc.pyx":2984 + * return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + * finally: + * free(stringValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_FLOAT: + * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) */ - -/* Python wrapper */ -static int __pyx_pw_5pyrfc_6_cyrfc_10Throughput_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_5pyrfc_6_cyrfc_10Throughput_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_connections = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_connections,0}; - PyObject* values[1] = {0}; - values[0] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connections); - if (value) { values[0] = value; kw_args--; } + /*finally:*/ { + __pyx_L43_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __pyx_t_6 = __pyx_lineno; __pyx_t_7 = __pyx_clineno; __pyx_t_21 = __pyx_filename; + { + free(__pyx_v_stringValue); } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ErrRestore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_7; __pyx_filename = __pyx_t_21; + goto __pyx_L1_error; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 12, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; + __pyx_L42_return: { + __pyx_t_14 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_stringValue); + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; } } - __pyx_v_connections = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 12, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput___init__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), __pyx_v_connections); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_5pyrfc_6_cyrfc_10Throughput___init__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, PyObject *__pyx_v_connections) { - RFC_ERROR_INFO __pyx_v_errorInfo; - PyObject *__pyx_v_conn = NULL; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - __Pyx_INCREF(__pyx_v_connections); - - /* "src/pyrfc/throughput.pyx":14 - * def __init__(self, connections = None): - * cdef RFC_ERROR_INFO errorInfo - * self._throughput_handle = NULL # <<<<<<<<<<<<<< - * self._connections = set() - * self._throughput_handle = RfcCreateThroughput(&errorInfo) - */ - __pyx_v_self->_throughput_handle = NULL; - /* "src/pyrfc/throughput.pyx":15 - * cdef RFC_ERROR_INFO errorInfo - * self._throughput_handle = NULL - * self._connections = set() # <<<<<<<<<<<<<< - * self._throughput_handle = RfcCreateThroughput(&errorInfo) - * if errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2961 + * finally: + * free(stringValue) + * elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: # <<<<<<<<<<<<<< + * # An upper bound for the length of the _string representation_ + * # of the DECF is given by (2*cLen)-1 (each digit is encoded in 4bit, */ - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->_connections); - __Pyx_DECREF(__pyx_v_self->_connections); - __pyx_v_self->_connections = __pyx_t_1; - __pyx_t_1 = 0; + break; + case RFCTYPE_FLOAT: - /* "src/pyrfc/throughput.pyx":16 - * self._throughput_handle = NULL - * self._connections = set() - * self._throughput_handle = RfcCreateThroughput(&errorInfo) # <<<<<<<<<<<<<< - * if errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2986 + * free(stringValue) + * elif typ == RFCTYPE_FLOAT: + * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: * raise wrapError(&errorInfo) */ - __pyx_v_self->_throughput_handle = RfcCreateThroughput((&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetFloat(__pyx_v_container, __pyx_v_cName, (&__pyx_v_floatValue), (&__pyx_v_errorInfo)); - /* "src/pyrfc/throughput.pyx":17 - * self._connections = set() - * self._throughput_handle = RfcCreateThroughput(&errorInfo) - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2987 + * elif typ == RFCTYPE_FLOAT: + * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * Throughput._registry.append(self) + * return floatValue */ - __pyx_t_2 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/throughput.pyx":18 - * self._throughput_handle = RfcCreateThroughput(&errorInfo) - * if errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2988 + * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) + * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * Throughput._registry.append(self) - * connections = connections or [] + * return floatValue + * elif typ == RFCTYPE_INT: */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 18, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2988, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2988, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":17 - * self._connections = set() - * self._throughput_handle = RfcCreateThroughput(&errorInfo) - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":2987 + * elif typ == RFCTYPE_FLOAT: + * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * Throughput._registry.append(self) + * return floatValue */ - } + } - /* "src/pyrfc/throughput.pyx":19 - * if errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":2989 + * if rc != RFC_OK: * raise wrapError(&errorInfo) - * Throughput._registry.append(self) # <<<<<<<<<<<<<< - * connections = connections or [] - * if type(connections) is not list: + * return floatValue # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_INT: + * rc = RfcGetInt(container, cName, &intValue, &errorInfo) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput), __pyx_n_s_registry); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_t_1, ((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_floatValue); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2989, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":20 - * raise wrapError(&errorInfo) - * Throughput._registry.append(self) - * connections = connections or [] # <<<<<<<<<<<<<< - * if type(connections) is not list: - * connections = [connections] + /* "pyrfc/_cyrfc.pyx":2985 + * finally: + * free(stringValue) + * elif typ == RFCTYPE_FLOAT: # <<<<<<<<<<<<<< + * rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_connections); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 20, __pyx_L1_error) - if (!__pyx_t_2) { - } else { - __Pyx_INCREF(__pyx_v_connections); - __pyx_t_1 = __pyx_v_connections; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_4); - __pyx_t_1 = __pyx_t_4; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_L4_bool_binop_done:; - __Pyx_DECREF_SET(__pyx_v_connections, __pyx_t_1); - __pyx_t_1 = 0; + break; + case RFCTYPE_INT: - /* "src/pyrfc/throughput.pyx":21 - * Throughput._registry.append(self) - * connections = connections or [] - * if type(connections) is not list: # <<<<<<<<<<<<<< - * connections = [connections] - * for conn in connections: + /* "pyrfc/_cyrfc.pyx":2991 + * return floatValue + * elif typ == RFCTYPE_INT: + * rc = RfcGetInt(container, cName, &intValue, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - __pyx_t_2 = (((PyObject *)Py_TYPE(__pyx_v_connections)) != ((PyObject *)(&PyList_Type))); - __pyx_t_5 = (__pyx_t_2 != 0); - if (__pyx_t_5) { + __pyx_v_rc = RfcGetInt(__pyx_v_container, __pyx_v_cName, (&__pyx_v_intValue), (&__pyx_v_errorInfo)); - /* "src/pyrfc/throughput.pyx":22 - * connections = connections or [] - * if type(connections) is not list: - * connections = [connections] # <<<<<<<<<<<<<< - * for conn in connections: - * if not isinstance(conn, Connection): + /* "pyrfc/_cyrfc.pyx":2992 + * elif typ == RFCTYPE_INT: + * rc = RfcGetInt(container, cName, &intValue, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return intValue */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_connections); - __Pyx_GIVEREF(__pyx_v_connections); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_connections); - __Pyx_DECREF_SET(__pyx_v_connections, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/throughput.pyx":21 - * Throughput._registry.append(self) - * connections = connections or [] - * if type(connections) is not list: # <<<<<<<<<<<<<< - * connections = [connections] - * for conn in connections: + /* "pyrfc/_cyrfc.pyx":2993 + * rc = RfcGetInt(container, cName, &intValue, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return intValue + * elif typ == RFCTYPE_INT1: */ - } + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2993, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2993, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":23 - * if type(connections) is not list: - * connections = [connections] - * for conn in connections: # <<<<<<<<<<<<<< - * if not isinstance(conn, Connection): - * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + /* "pyrfc/_cyrfc.pyx":2992 + * elif typ == RFCTYPE_INT: + * rc = RfcGetInt(container, cName, &intValue, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return intValue */ - if (likely(PyList_CheckExact(__pyx_v_connections)) || PyTuple_CheckExact(__pyx_v_connections)) { - __pyx_t_1 = __pyx_v_connections; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_connections); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 23, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 23, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(1, 23, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_7(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 23, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF_SET(__pyx_v_conn, __pyx_t_4); - __pyx_t_4 = 0; - /* "src/pyrfc/throughput.pyx":24 - * connections = [connections] - * for conn in connections: - * if not isinstance(conn, Connection): # <<<<<<<<<<<<<< - * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) - * self.setOnConnection(conn) + /* "pyrfc/_cyrfc.pyx":2994 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return intValue # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_INT1: + * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) */ - __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_conn, __pyx_ptype_5pyrfc_6_cyrfc_Connection); - __pyx_t_2 = ((!(__pyx_t_5 != 0)) != 0); - if (unlikely(__pyx_t_2)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_RFC_INT(__pyx_v_intValue); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2994, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":25 - * for conn in connections: - * if not isinstance(conn, Connection): - * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) # <<<<<<<<<<<<<< - * self.setOnConnection(conn) - * + /* "pyrfc/_cyrfc.pyx":2990 + * raise wrapError(&errorInfo) + * return floatValue + * elif typ == RFCTYPE_INT: # <<<<<<<<<<<<<< + * rc = RfcGetInt(container, cName, &intValue, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_kp_s_Connection_object_required_recei); - __Pyx_GIVEREF(__pyx_kp_s_Connection_object_required_recei); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_Connection_object_required_recei); - __Pyx_INCREF(__pyx_v_conn); - __Pyx_GIVEREF(__pyx_v_conn); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_conn); - __Pyx_INCREF(__pyx_kp_s_of_type); - __Pyx_GIVEREF(__pyx_kp_s_of_type); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_s_of_type); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_conn))); - __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_conn))); - PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)Py_TYPE(__pyx_v_conn))); - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 25, __pyx_L1_error) + break; + case RFCTYPE_INT1: - /* "src/pyrfc/throughput.pyx":24 - * connections = [connections] - * for conn in connections: - * if not isinstance(conn, Connection): # <<<<<<<<<<<<<< - * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) - * self.setOnConnection(conn) + /* "pyrfc/_cyrfc.pyx":2996 + * return intValue + * elif typ == RFCTYPE_INT1: + * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ - } + __pyx_v_rc = RfcGetInt1(__pyx_v_container, __pyx_v_cName, (&__pyx_v_int1Value), (&__pyx_v_errorInfo)); - /* "src/pyrfc/throughput.pyx":26 - * if not isinstance(conn, Connection): - * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) - * self.setOnConnection(conn) # <<<<<<<<<<<<<< - * - * @property + /* "pyrfc/_cyrfc.pyx":2997 + * elif typ == RFCTYPE_INT1: + * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return int1Value */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_setOnConnection); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_9, __pyx_v_conn) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_conn); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/throughput.pyx":23 - * if type(connections) is not list: - * connections = [connections] - * for conn in connections: # <<<<<<<<<<<<<< - * if not isinstance(conn, Connection): - * raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + /* "pyrfc/_cyrfc.pyx":2998 + * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return int1Value + * elif typ == RFCTYPE_INT2: */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2998, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 2998, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":12 - * cdef _connections - * - * def __init__(self, connections = None): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * self._throughput_handle = NULL + /* "pyrfc/_cyrfc.pyx":2997 + * elif typ == RFCTYPE_INT1: + * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return int1Value */ + } - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_conn); - __Pyx_XDECREF(__pyx_v_connections); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":29 - * - * @property - * def connections(self): # <<<<<<<<<<<<<< - * """Get connections attached to throughput monitoring - * + /* "pyrfc/_cyrfc.pyx":2999 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return int1Value # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_INT2: + * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_SAP_RAW(__pyx_v_int1Value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2999, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11connections_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11connections_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_11connections___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_11connections___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "src/pyrfc/throughput.pyx":35 - * :type: set of Connection - * """ - * return self._connections # <<<<<<<<<<<<<< - * - * @property + /* "pyrfc/_cyrfc.pyx":2995 + * raise wrapError(&errorInfo) + * return intValue + * elif typ == RFCTYPE_INT1: # <<<<<<<<<<<<<< + * rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) + * if rc != RFC_OK: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->_connections); - __pyx_r = __pyx_v_self->_connections; - goto __pyx_L0; + break; + case RFCTYPE_INT2: - /* "src/pyrfc/throughput.pyx":29 - * - * @property - * def connections(self): # <<<<<<<<<<<<<< - * """Get connections attached to throughput monitoring - * + /* "pyrfc/_cyrfc.pyx":3001 + * return int1Value + * elif typ == RFCTYPE_INT2: + * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) */ + __pyx_v_rc = RfcGetInt2(__pyx_v_container, __pyx_v_cName, (&__pyx_v_int2Value), (&__pyx_v_errorInfo)); - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":38 - * - * @property - * def _handle(self): # <<<<<<<<<<<<<< - * """Get throughput object handle - * + /* "pyrfc/_cyrfc.pyx":3002 + * elif typ == RFCTYPE_INT2: + * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return int2Value */ + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7_handle_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7_handle_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_7_handle___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_7_handle___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "src/pyrfc/throughput.pyx":44 - * :type: uintptr_t - * """ - * return self._throughput_handle # <<<<<<<<<<<<<< - * - * def setOnConnection(self, Connection connection): + /* "pyrfc/_cyrfc.pyx":3003 + * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * return int2Value + * elif typ == RFCTYPE_INT8: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->_throughput_handle)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 3003, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":38 - * - * @property - * def _handle(self): # <<<<<<<<<<<<<< - * """Get throughput object handle - * + /* "pyrfc/_cyrfc.pyx":3002 + * elif typ == RFCTYPE_INT2: + * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * return int2Value */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput._handle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":46 - * return self._throughput_handle - * - * def setOnConnection(self, Connection connection): # <<<<<<<<<<<<<< - * """Attaches a throughput object to a connection to be monitored by the throughput object. - * Once attached to a connection, the throughput object collects the data statistics of + /* "pyrfc/_cyrfc.pyx":3004 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * return int2Value # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_INT8: + * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_RFC_INT2(__pyx_v_int2Value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_3setOnConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_2setOnConnection[] = "Attaches a throughput object to a connection to be monitored by the throughput object.\n Once attached to a connection, the throughput object collects the data statistics of\n function calls invoked via this connection.\n\n For more info search for the ``RfcSetThroughputOnConnection`` method in\n `SAP NetWeaver RFC SDK Doxygen Documentation `_\n\n :param connection: Connection instance to be attached to throughput monitoring\n :type connection: Connection\n\n :return: nothing, raises an error\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_3setOnConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("setOnConnection (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_connection), __pyx_ptype_5pyrfc_6_cyrfc_Connection, 1, "connection", 0))) __PYX_ERR(1, 46, __pyx_L1_error) - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_2setOnConnection(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_connection)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_2setOnConnection(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("setOnConnection", 0); + /* "pyrfc/_cyrfc.pyx":3000 + * raise wrapError(&errorInfo) + * return int1Value + * elif typ == RFCTYPE_INT2: # <<<<<<<<<<<<<< + * rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) + * if rc != RFC_OK: + */ + break; + case RFCTYPE_INT8: - /* "src/pyrfc/throughput.pyx":60 - * """ - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":3006 + * return int2Value + * elif typ == RFCTYPE_INT8: + * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) # <<<<<<<<<<<<<< * if rc != RFC_OK: * raise wrapError(&errorInfo) */ - __pyx_v_rc = RfcSetThroughputOnConnection(__pyx_v_connection->_handle, __pyx_v_self->_throughput_handle, (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetInt8(__pyx_v_container, __pyx_v_cName, (&__pyx_v_int8Value), (&__pyx_v_errorInfo)); - /* "src/pyrfc/throughput.pyx":61 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3007 + * elif typ == RFCTYPE_INT8: + * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * self._connections.add(connection) + * return int8Value */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/throughput.pyx":62 - * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3008 + * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * self._connections.add(connection) - * + * return int8Value + * elif typ == RFCTYPE_UTCLONG: */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 62, __pyx_L1_error) + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3008, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 3008, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":61 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3007 + * elif typ == RFCTYPE_INT8: + * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * self._connections.add(connection) + * return int8Value */ - } + } - /* "src/pyrfc/throughput.pyx":63 + /* "pyrfc/_cyrfc.pyx":3009 * if rc != RFC_OK: * raise wrapError(&errorInfo) - * self._connections.add(connection) # <<<<<<<<<<<<<< - * - * @staticmethod + * return int8Value # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_UTCLONG: + * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_connections, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_connection)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_connection)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyInt_From_RFC_INT8(__pyx_v_int8Value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3009, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":46 - * return self._throughput_handle - * - * def setOnConnection(self, Connection connection): # <<<<<<<<<<<<<< - * """Attaches a throughput object to a connection to be monitored by the throughput object. - * Once attached to a connection, the throughput object collects the data statistics of + /* "pyrfc/_cyrfc.pyx":3005 + * raise wrapError(&errorInfo) + * return int2Value + * elif typ == RFCTYPE_INT8: # <<<<<<<<<<<<<< + * rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) + * if rc != RFC_OK: */ + break; + case RFCTYPE_UTCLONG: - /* 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_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.setOnConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":3012 + * elif typ == RFCTYPE_UTCLONG: + * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * strLen = 27 # is fixed # <<<<<<<<<<<<<< + * try: + * stringValue = mallocU(strLen+1) + */ + __pyx_v_strLen = 27; -/* "src/pyrfc/throughput.pyx":66 - * - * @staticmethod - * def getFromConnection(Connection connection): # <<<<<<<<<<<<<< - * """Returns the currently attached throughput object from a connection, if any. - * + /* "pyrfc/_cyrfc.pyx":3013 + * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * strLen = 27 # is fixed + * try: # <<<<<<<<<<<<<< + * stringValue = mallocU(strLen+1) + * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds */ + /*try:*/ { -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_4getFromConnection[] = "Returns the currently attached throughput object from a connection, if any.\n\n For more info search for the ``RfcGetThroughputFromConnection`` method in\n `SAP NetWeaver RFC SDK Doxygen Documentation `_\n\n :param connection: Connection instance\n :type connection: Connection\n\n :returns: Throughput object the connection is attached to, if any\n :rtype: Throughput\n\n :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error\n "; -static PyMethodDef __pyx_mdef_5pyrfc_6_cyrfc_10Throughput_5getFromConnection = {"getFromConnection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_4getFromConnection}; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getFromConnection (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_connection,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; + /* "pyrfc/_cyrfc.pyx":3014 + * strLen = 27 # is fixed + * try: + * stringValue = mallocU(strLen+1) # <<<<<<<<<<<<<< + * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + */ + __pyx_v_stringValue = mallocU((__pyx_v_strLen + 1)); + + /* "pyrfc/_cyrfc.pyx":3016 + * stringValue = mallocU(strLen+1) + * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + */ + __pyx_v_rc = RfcGetString(__pyx_v_container, __pyx_v_cName, __pyx_v_stringValue, (__pyx_v_strLen + 1), (&__pyx_v_resultLen), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":3017 + * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * utcValue = wrapString(stringValue, resultLen) + */ + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { + + /* "pyrfc/_cyrfc.pyx":3018 + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: + * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< + * utcValue = wrapString(stringValue, resultLen) + * # replace the "," separator with "." + */ + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3018, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 3018, __pyx_L55_error) + + /* "pyrfc/_cyrfc.pyx":3017 + * # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds + * rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * raise wrapError(&errorInfo) + * utcValue = wrapString(stringValue, resultLen) + */ } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_connection)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; + + /* "pyrfc/_cyrfc.pyx":3019 + * if rc != RFC_OK: + * raise wrapError(&errorInfo) + * utcValue = wrapString(stringValue, resultLen) # <<<<<<<<<<<<<< + * # replace the "," separator with "." + * return utcValue[:19]+'.'+utcValue[20:] + */ + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_resultLen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3019, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.uclen = __pyx_t_3; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_stringValue, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3019, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_utcValue = __pyx_t_4; + __pyx_t_4 = 0; + + /* "pyrfc/_cyrfc.pyx":3021 + * utcValue = wrapString(stringValue, resultLen) + * # replace the "," separator with "." + * return utcValue[:19]+'.'+utcValue[20:] # <<<<<<<<<<<<<< + * finally: + * free(stringValue) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_utcValue, 0, 19, NULL, NULL, &__pyx_slice__46, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3021, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__20); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3021, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_utcValue, 20, 0, NULL, NULL, &__pyx_slice__47, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3021, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3021, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L54_return; + } + + /* "pyrfc/_cyrfc.pyx":3023 + * return utcValue[:19]+'.'+utcValue[20:] + * finally: + * free(stringValue) # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_DATE: + * rc = RfcGetDate(container, cName, dateValue, &errorInfo) + */ + /*finally:*/ { + __pyx_L55_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_9); + __pyx_t_7 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_22 = __pyx_filename; + { + free(__pyx_v_stringValue); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9); + } + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ErrRestore(__pyx_t_14, __pyx_t_13, __pyx_t_12); + __pyx_t_14 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; __pyx_t_11 = 0; __pyx_t_10 = 0; __pyx_t_9 = 0; + __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_22; + goto __pyx_L1_error; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getFromConnection") < 0)) __PYX_ERR(1, 66, __pyx_L3_error) + __pyx_L54_return: { + __pyx_t_9 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_stringValue); + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; + goto __pyx_L0; } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_connection = ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getFromConnection", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 66, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.getFromConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_connection), __pyx_ptype_5pyrfc_6_cyrfc_Connection, 1, "connection", 0))) __PYX_ERR(1, 66, __pyx_L1_error) - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_4getFromConnection(__pyx_v_connection); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_4getFromConnection(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_THROUGHPUT_HANDLE __pyx_v_throughput; - PyObject *__pyx_v_t = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("getFromConnection", 0); + /* "pyrfc/_cyrfc.pyx":3010 + * raise wrapError(&errorInfo) + * return int8Value + * elif typ == RFCTYPE_UTCLONG: # <<<<<<<<<<<<<< + * # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + * strLen = 27 # is fixed + */ + break; + case RFCTYPE_DATE: - /* "src/pyrfc/throughput.pyx":81 - * """ - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) # <<<<<<<<<<<<<< - * if errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":3025 + * free(stringValue) + * elif typ == RFCTYPE_DATE: + * rc = RfcGetDate(container, cName, dateValue, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: * raise wrapError(&errorInfo) */ - __pyx_v_throughput = RfcGetThroughputFromConnection(__pyx_v_connection->_handle, (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetDate(__pyx_v_container, __pyx_v_cName, __pyx_v_dateValue, (&__pyx_v_errorInfo)); - /* "src/pyrfc/throughput.pyx":82 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":3026 + * elif typ == RFCTYPE_DATE: + * rc = RfcGetDate(container, cName, dateValue, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * for t in Throughput._registry: + * value = wrapString(dateValue, 8) */ - __pyx_t_1 = ((__pyx_v_errorInfo.code != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/throughput.pyx":83 - * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) - * if errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":3027 + * rc = RfcGetDate(container, cName, dateValue, &errorInfo) + * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * for t in Throughput._registry: - * if t._handle == throughput: + * value = wrapString(dateValue, 8) + * # return date or None */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 83, __pyx_L1_error) + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3027, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 3027, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":82 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) - * if errorInfo.code != RFC_OK: # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":3026 + * elif typ == RFCTYPE_DATE: + * rc = RfcGetDate(container, cName, dateValue, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * for t in Throughput._registry: + * value = wrapString(dateValue, 8) */ - } + } - /* "src/pyrfc/throughput.pyx":84 - * if errorInfo.code != RFC_OK: + /* "pyrfc/_cyrfc.pyx":3028 + * if rc != RFC_OK: * raise wrapError(&errorInfo) - * for t in Throughput._registry: # <<<<<<<<<<<<<< - * if t._handle == throughput: - * return t + * value = wrapString(dateValue, 8) # <<<<<<<<<<<<<< + * # return date or None + * if config & _MASK_DTIME: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput), __pyx_n_s_registry); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 84, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.uclen = __pyx_int_8; + __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_dateValue, &__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3028, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":3030 + * value = wrapString(dateValue, 8) + * # return date or None + * if config & _MASK_DTIME: # <<<<<<<<<<<<<< + * if (value == '00000000') or not value: + * return None + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MASK_DTIME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3030, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyNumber_And(__pyx_v_config, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3030, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3030, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_1) { + + /* "pyrfc/_cyrfc.pyx":3031 + * # return date or None + * if config & _MASK_DTIME: + * if (value == '00000000') or not value: # <<<<<<<<<<<<<< + * return None + * return datetime.strptime(value, '%Y%m%d').date() + */ + __pyx_t_23 = (__Pyx_PyString_Equals(__pyx_v_value, __pyx_kp_s_00000000, Py_EQ)); if (unlikely(__pyx_t_23 < 0)) __PYX_ERR(0, 3031, __pyx_L1_error) + if (!__pyx_t_23) { } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(1, 84, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 84, __pyx_L1_error) + __pyx_t_1 = __pyx_t_23; + goto __pyx_L63_bool_binop_done; + } + __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_23 < 0)) __PYX_ERR(0, 3031, __pyx_L1_error) + __pyx_t_24 = ((!__pyx_t_23) != 0); + __pyx_t_1 = __pyx_t_24; + __pyx_L63_bool_binop_done:; + if (__pyx_t_1) { + + /* "pyrfc/_cyrfc.pyx":3032 + * if config & _MASK_DTIME: + * if (value == '00000000') or not value: + * return None # <<<<<<<<<<<<<< + * return datetime.strptime(value, '%Y%m%d').date() + * # return date string or '' + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":3031 + * # return date or None + * if config & _MASK_DTIME: + * if (value == '00000000') or not value: # <<<<<<<<<<<<<< + * return None + * return datetime.strptime(value, '%Y%m%d').date() + */ + } + + /* "pyrfc/_cyrfc.pyx":3033 + * if (value == '00000000') or not value: + * return None + * return datetime.strptime(value, '%Y%m%d').date() # <<<<<<<<<<<<<< + * # return date string or '' + * if (value == '00000000') or not value: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_strptime); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_value, __pyx_kp_s_Y_m_d}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); - #endif + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) { + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_value, __pyx_kp_s_Y_m_d}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_25 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_6, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_Y_m_d); + __Pyx_GIVEREF(__pyx_kp_s_Y_m_d); + PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_6, __pyx_kp_s_Y_m_d); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; } - } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_date); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_19); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_19, function); } - break; } - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3033, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "pyrfc/_cyrfc.pyx":3030 + * value = wrapString(dateValue, 8) + * # return date or None + * if config & _MASK_DTIME: # <<<<<<<<<<<<<< + * if (value == '00000000') or not value: + * return None + */ } - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_2); - __pyx_t_2 = 0; - /* "src/pyrfc/throughput.pyx":85 - * raise wrapError(&errorInfo) - * for t in Throughput._registry: - * if t._handle == throughput: # <<<<<<<<<<<<<< - * return t - * return None + /* "pyrfc/_cyrfc.pyx":3035 + * return datetime.strptime(value, '%Y%m%d').date() + * # return date string or '' + * if (value == '00000000') or not value: # <<<<<<<<<<<<<< + * return '' + * return value */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_t, __pyx_n_s_handle_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_throughput)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_24 = (__Pyx_PyString_Equals(__pyx_v_value, __pyx_kp_s_00000000, Py_EQ)); if (unlikely(__pyx_t_24 < 0)) __PYX_ERR(0, 3035, __pyx_L1_error) + if (!__pyx_t_24) { + } else { + __pyx_t_1 = __pyx_t_24; + goto __pyx_L66_bool_binop_done; + } + __pyx_t_24 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_24 < 0)) __PYX_ERR(0, 3035, __pyx_L1_error) + __pyx_t_23 = ((!__pyx_t_24) != 0); + __pyx_t_1 = __pyx_t_23; + __pyx_L66_bool_binop_done:; if (__pyx_t_1) { - /* "src/pyrfc/throughput.pyx":86 - * for t in Throughput._registry: - * if t._handle == throughput: - * return t # <<<<<<<<<<<<<< - * return None - * + /* "pyrfc/_cyrfc.pyx":3036 + * # return date string or '' + * if (value == '00000000') or not value: + * return '' # <<<<<<<<<<<<<< + * return value + * elif typ == RFCTYPE_TIME: */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_t); - __pyx_r = __pyx_v_t; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(__pyx_kp_s__5); + __pyx_r = __pyx_kp_s__5; goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":85 - * raise wrapError(&errorInfo) - * for t in Throughput._registry: - * if t._handle == throughput: # <<<<<<<<<<<<<< - * return t - * return None + /* "pyrfc/_cyrfc.pyx":3035 + * return datetime.strptime(value, '%Y%m%d').date() + * # return date string or '' + * if (value == '00000000') or not value: # <<<<<<<<<<<<<< + * return '' + * return value */ } - /* "src/pyrfc/throughput.pyx":84 - * if errorInfo.code != RFC_OK: - * raise wrapError(&errorInfo) - * for t in Throughput._registry: # <<<<<<<<<<<<<< - * if t._handle == throughput: - * return t - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "src/pyrfc/throughput.pyx":87 - * if t._handle == throughput: - * return t - * return None # <<<<<<<<<<<<<< - * - * def removeFromConnection(self, Connection connection): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "src/pyrfc/throughput.pyx":66 - * - * @staticmethod - * def getFromConnection(Connection connection): # <<<<<<<<<<<<<< - * """Returns the currently attached throughput object from a connection, if any. - * + /* "pyrfc/_cyrfc.pyx":3037 + * if (value == '00000000') or not value: + * return '' + * return value # <<<<<<<<<<<<<< + * elif typ == RFCTYPE_TIME: + * rc = RfcGetTime(container, cName, timeValue, &errorInfo) */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_value); + __pyx_r = __pyx_v_value; + goto __pyx_L0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.getFromConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_t); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":89 - * return None - * - * def removeFromConnection(self, Connection connection): # <<<<<<<<<<<<<< - * """Removes the throughput object from a connection. - * The connection will no longer be monitored. + /* "pyrfc/_cyrfc.pyx":3024 + * finally: + * free(stringValue) + * elif typ == RFCTYPE_DATE: # <<<<<<<<<<<<<< + * rc = RfcGetDate(container, cName, dateValue, &errorInfo) + * if rc != RFC_OK: */ + break; + case RFCTYPE_TIME: -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7removeFromConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection[] = "Removes the throughput object from a connection.\n The connection will no longer be monitored.\n\n :param connection: Connection instance\n :type connection: Connection\n :returns: Nothing\n :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7removeFromConnection(PyObject *__pyx_v_self, PyObject *__pyx_v_connection) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("removeFromConnection (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_connection), __pyx_ptype_5pyrfc_6_cyrfc_Connection, 1, "connection", 0))) __PYX_ERR(1, 89, __pyx_L1_error) - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), ((struct __pyx_obj_5pyrfc_6_cyrfc_Connection *)__pyx_v_connection)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, struct __pyx_obj_5pyrfc_6_cyrfc_Connection *__pyx_v_connection) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("removeFromConnection", 0); - - /* "src/pyrfc/throughput.pyx":99 - * """ - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":3039 + * return value + * elif typ == RFCTYPE_TIME: + * rc = RfcGetTime(container, cName, timeValue, &errorInfo) # <<<<<<<<<<<<<< * if rc != RFC_OK: * raise wrapError(&errorInfo) */ - __pyx_v_rc = RfcRemoveThroughputFromConnection(__pyx_v_connection->_handle, (&__pyx_v_errorInfo)); + __pyx_v_rc = RfcGetTime(__pyx_v_container, __pyx_v_cName, __pyx_v_timeValue, (&__pyx_v_errorInfo)); - /* "src/pyrfc/throughput.pyx":100 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3040 + * elif typ == RFCTYPE_TIME: + * rc = RfcGetTime(container, cName, timeValue, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * self._connections.remove(connection) + * value = wrapString(timeValue, 6) */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); + if (unlikely(__pyx_t_1)) { - /* "src/pyrfc/throughput.pyx":101 - * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3041 + * rc = RfcGetTime(container, cName, timeValue, &errorInfo) * if rc != RFC_OK: * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * self._connections.remove(connection) - * + * value = wrapString(timeValue, 6) + * # return time or None */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 101, __pyx_L1_error) + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 3041, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":100 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3040 + * elif typ == RFCTYPE_TIME: + * rc = RfcGetTime(container, cName, timeValue, &errorInfo) * if rc != RFC_OK: # <<<<<<<<<<<<<< * raise wrapError(&errorInfo) - * self._connections.remove(connection) + * value = wrapString(timeValue, 6) */ - } + } - /* "src/pyrfc/throughput.pyx":102 + /* "pyrfc/_cyrfc.pyx":3042 * if rc != RFC_OK: * raise wrapError(&errorInfo) - * self._connections.remove(connection) # <<<<<<<<<<<<<< - * - * def reset(self): + * value = wrapString(timeValue, 6) # <<<<<<<<<<<<<< + * # return time or None + * if config & _MASK_DTIME: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_connections, __pyx_n_s_remove); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_connection)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_connection)); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.uclen = __pyx_int_6; + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_timeValue, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3042, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_v_value = __pyx_t_4; + __pyx_t_4 = 0; - /* "src/pyrfc/throughput.pyx":89 - * return None - * - * def removeFromConnection(self, Connection connection): # <<<<<<<<<<<<<< - * """Removes the throughput object from a connection. - * The connection will no longer be monitored. + /* "pyrfc/_cyrfc.pyx":3044 + * value = wrapString(timeValue, 6) + * # return time or None + * if config & _MASK_DTIME: # <<<<<<<<<<<<<< + * if not value: + * return None */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MASK_DTIME); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_19 = PyNumber_And(__pyx_v_config, __pyx_t_4); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 3044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_19); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3044, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + if (__pyx_t_1) { - /* 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_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.removeFromConnection", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":104 - * self._connections.remove(connection) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Resets the data so far collected and aggregated by the throughput object. - * + /* "pyrfc/_cyrfc.pyx":3045 + * # return time or None + * if config & _MASK_DTIME: + * if not value: # <<<<<<<<<<<<<< + * return None + * return datetime.strptime(value, '%H%M%S').time() */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3045, __pyx_L1_error) + __pyx_t_23 = ((!__pyx_t_1) != 0); + if (__pyx_t_23) { -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_9reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_5pyrfc_6_cyrfc_10Throughput_8reset[] = "Resets the data so far collected and aggregated by the throughput object.\n\n :returns: Nothing\n :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error\n "; -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_9reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_8reset(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_8reset(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("reset", 0); - - /* "src/pyrfc/throughput.pyx":111 - * """ - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":3046 + * if config & _MASK_DTIME: + * if not value: + * return None # <<<<<<<<<<<<<< + * return datetime.strptime(value, '%H%M%S').time() + * # return time string or '' */ - __pyx_v_rc = RfcResetThroughput(__pyx_v_self->_throughput_handle, (&__pyx_v_errorInfo)); + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":112 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":3045 + * # return time or None + * if config & _MASK_DTIME: + * if not value: # <<<<<<<<<<<<<< + * return None + * return datetime.strptime(value, '%H%M%S').time() */ - __pyx_t_1 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_1)) { + } - /* "src/pyrfc/throughput.pyx":113 - * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * - * cdef _destroy(self): + /* "pyrfc/_cyrfc.pyx":3047 + * if not value: + * return None + * return datetime.strptime(value, '%H%M%S').time() # <<<<<<<<<<<<<< + * # return time string or '' + * if not value: */ - __pyx_t_2 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(1, 113, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_strptime); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_25))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_25); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_25, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_25)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_value, __pyx_kp_s_H_M_S}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_25)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_value, __pyx_kp_s_H_M_S}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_25, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + { + __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__pyx_t_2) { + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; + } + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_value); + __Pyx_INCREF(__pyx_kp_s_H_M_S); + __Pyx_GIVEREF(__pyx_kp_s_H_M_S); + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_kp_s_H_M_S); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_25, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_25))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_25); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_25, function); + } + } + __pyx_t_19 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_25, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_25); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 3047, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __pyx_r = __pyx_t_19; + __pyx_t_19 = 0; + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":112 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * + /* "pyrfc/_cyrfc.pyx":3044 + * value = wrapString(timeValue, 6) + * # return time or None + * if config & _MASK_DTIME: # <<<<<<<<<<<<<< + * if not value: + * return None */ - } + } - /* "src/pyrfc/throughput.pyx":104 - * self._connections.remove(connection) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Resets the data so far collected and aggregated by the throughput object. - * + /* "pyrfc/_cyrfc.pyx":3049 + * return datetime.strptime(value, '%H%M%S').time() + * # return time string or '' + * if not value: # <<<<<<<<<<<<<< + * return '' + * return value */ + __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_23 < 0)) __PYX_ERR(0, 3049, __pyx_L1_error) + __pyx_t_1 = ((!__pyx_t_23) != 0); + if (__pyx_t_1) { - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":115 - * raise wrapError(&errorInfo) - * - * cdef _destroy(self): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc + /* "pyrfc/_cyrfc.pyx":3050 + * # return time string or '' + * if not value: + * return '' # <<<<<<<<<<<<<< + * return value + * else: */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_s__5); + __pyx_r = __pyx_kp_s__5; + goto __pyx_L0; -static PyObject *__pyx_f_5pyrfc_6_cyrfc_10Throughput__destroy(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { - RFC_ERROR_INFO __pyx_v_errorInfo; - RFC_RC __pyx_v_rc; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_destroy", 0); - - /* "src/pyrfc/throughput.pyx":118 - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc - * self._registry.clear() # <<<<<<<<<<<<<< - * self._connections = None - * if self._throughput_handle != NULL: + /* "pyrfc/_cyrfc.pyx":3049 + * return datetime.strptime(value, '%H%M%S').time() + * # return time string or '' + * if not value: # <<<<<<<<<<<<<< + * return '' + * return value */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_registry); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); } - } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/throughput.pyx":119 - * cdef RFC_RC rc - * self._registry.clear() - * self._connections = None # <<<<<<<<<<<<<< - * if self._throughput_handle != NULL: - * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->_connections); - __Pyx_DECREF(__pyx_v_self->_connections); - __pyx_v_self->_connections = Py_None; - - /* "src/pyrfc/throughput.pyx":120 - * self._registry.clear() - * self._connections = None - * if self._throughput_handle != NULL: # <<<<<<<<<<<<<< - * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) - * self._throughput_handle = NULL - */ - __pyx_t_4 = ((__pyx_v_self->_throughput_handle != NULL) != 0); - if (__pyx_t_4) { - /* "src/pyrfc/throughput.pyx":121 - * self._connections = None - * if self._throughput_handle != NULL: - * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) # <<<<<<<<<<<<<< - * self._throughput_handle = NULL - * if rc != RFC_OK: + /* "pyrfc/_cyrfc.pyx":3051 + * if not value: + * return '' + * return value # <<<<<<<<<<<<<< + * else: + * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) */ - __pyx_v_rc = RfcDestroyThroughput(__pyx_v_self->_throughput_handle, (&__pyx_v_errorInfo)); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_value); + __pyx_r = __pyx_v_value; + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":122 - * if self._throughput_handle != NULL: - * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) - * self._throughput_handle = NULL # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * # is ok + /* "pyrfc/_cyrfc.pyx":3038 + * return '' + * return value + * elif typ == RFCTYPE_TIME: # <<<<<<<<<<<<<< + * rc = RfcGetTime(container, cName, timeValue, &errorInfo) + * if rc != RFC_OK: */ - __pyx_v_self->_throughput_handle = NULL; + break; + default: - /* "src/pyrfc/throughput.pyx":123 - * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) - * self._throughput_handle = NULL - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * # is ok - * pass + /* "pyrfc/_cyrfc.pyx":3053 + * return value + * else: + * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) # <<<<<<<<<<<<<< + * + * cdef wrapError(RFC_ERROR_INFO* errorInfo): */ - __pyx_t_4 = ((__pyx_v_rc != RFC_OK) != 0); - if (__pyx_t_4) { + __Pyx_GetModuleGlobalName(__pyx_t_25, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 3053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_25); + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(__pyx_v_typ); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_cName, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_RFC_type_d_when_wrapping, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_25))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_25); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_25, function); + } } - - /* "src/pyrfc/throughput.pyx":120 - * self._registry.clear() - * self._connections = None - * if self._throughput_handle != NULL: # <<<<<<<<<<<<<< - * rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) - * self._throughput_handle = NULL - */ + __pyx_t_19 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_25, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_25, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 3053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; + __Pyx_Raise(__pyx_t_19, 0, 0, 0); + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __PYX_ERR(0, 3053, __pyx_L1_error) + break; } - /* "src/pyrfc/throughput.pyx":115 - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":2857 + * return table * - * cdef _destroy(self): # <<<<<<<<<<<<<< - * cdef RFC_ERROR_INFO errorInfo - * cdef RFC_RC rc + * cdef wrapVariable( # <<<<<<<<<<<<<< + * RFCTYPE typ, + * RFC_FUNCTION_HANDLE container, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput._destroy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_XDECREF(__pyx_t_25); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapVariable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_utcValue); + __Pyx_XDECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/throughput.pyx":127 - * pass - * - * def __del__(self): # <<<<<<<<<<<<<< - * self.destroy() +/* "pyrfc/_cyrfc.pyx":3055 + * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) * + * cdef wrapError(RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * group2error = { + * ABAP_APPLICATION_FAILURE: ABAPApplicationError, */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_10__del__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_10__del__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapError(RFC_ERROR_INFO *__pyx_v_errorInfo) { + PyObject *__pyx_v_group2error = NULL; + PyObject *__pyx_v_error = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__del__", 0); + __Pyx_RefNannySetupContext("wrapError", 0); - /* "src/pyrfc/throughput.pyx":128 - * - * def __del__(self): - * self.destroy() # <<<<<<<<<<<<<< - * - * def __exit__(self, type, value, traceback): + /* "pyrfc/_cyrfc.pyx":3057 + * cdef wrapError(RFC_ERROR_INFO* errorInfo): + * group2error = { + * ABAP_APPLICATION_FAILURE: ABAPApplicationError, # <<<<<<<<<<<<<< + * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, + * LOGON_FAILURE: LogonError, */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_destroy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 128, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3057, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_APPLICATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ABAPApplicationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 3057, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/throughput.pyx":127 - * pass - * - * def __del__(self): # <<<<<<<<<<<<<< - * self.destroy() - * + /* "pyrfc/_cyrfc.pyx":3058 + * group2error = { + * ABAP_APPLICATION_FAILURE: ABAPApplicationError, + * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, # <<<<<<<<<<<<<< + * LOGON_FAILURE: LogonError, + * COMMUNICATION_FAILURE: CommunicationError, */ + __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(ABAP_RUNTIME_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3058, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ABAPRuntimeError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3058, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":3059 + * ABAP_APPLICATION_FAILURE: ABAPApplicationError, + * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, + * LOGON_FAILURE: LogonError, # <<<<<<<<<<<<<< + * COMMUNICATION_FAILURE: CommunicationError, + * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, + */ + __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(LOGON_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3059, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_LogonError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3059, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; -/* "src/pyrfc/throughput.pyx":130 - * self.destroy() - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self._destroy() - * + /* "pyrfc/_cyrfc.pyx":3060 + * ABAP_RUNTIME_FAILURE: ABAPRuntimeError, + * LOGON_FAILURE: LogonError, + * COMMUNICATION_FAILURE: CommunicationError, # <<<<<<<<<<<<<< + * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, + * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, */ + __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(COMMUNICATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CommunicationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_13__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_13__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_type = 0; - CYTHON_UNUSED PyObject *__pyx_v_value = 0; - CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; - PyObject* values[3] = {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 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_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_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(1, 130, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(1, 130, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(1, 130, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - 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); - } - __pyx_v_type = values[0]; - __pyx_v_value = values[1]; - __pyx_v_traceback = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 130, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_12__exit__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + /* "pyrfc/_cyrfc.pyx":3061 + * LOGON_FAILURE: LogonError, + * COMMUNICATION_FAILURE: CommunicationError, + * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, # <<<<<<<<<<<<<< + * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, + * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError + */ + __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_RUNTIME_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ExternalRuntimeError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3061, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":3062 + * COMMUNICATION_FAILURE: CommunicationError, + * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, + * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, # <<<<<<<<<<<<<< + * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError + * } + */ + __pyx_t_3 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_APPLICATION_FAILURE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExternalApplicationError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3062, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_12__exit__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__exit__", 0); + /* "pyrfc/_cyrfc.pyx":3063 + * EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, + * EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, + * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError # <<<<<<<<<<<<<< + * } + * error = group2error[errorInfo.group] + */ + __pyx_t_2 = __Pyx_PyInt_From_RFC_ERROR_GROUP(EXTERNAL_AUTHORIZATION_FAILURE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ExternalAuthorizationError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_t_3) < 0) __PYX_ERR(0, 3057, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_group2error = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/throughput.pyx":131 - * - * def __exit__(self, type, value, traceback): - * self._destroy() # <<<<<<<<<<<<<< - * - * def __enter__(self): + /* "pyrfc/_cyrfc.pyx":3065 + * EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError + * } + * error = group2error[errorInfo.group] # <<<<<<<<<<<<<< + * return error( + * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self->__pyx_vtab)->_destroy(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 131, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_RFC_ERROR_GROUP(__pyx_v_errorInfo->group); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_group2error, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_error = __pyx_t_3; + __pyx_t_3 = 0; - /* "src/pyrfc/throughput.pyx":130 - * self.destroy() - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * self._destroy() - * + /* "pyrfc/_cyrfc.pyx":3066 + * } + * error = group2error[errorInfo.group] + * return error( # <<<<<<<<<<<<<< + * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), + * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), */ + __Pyx_XDECREF(__pyx_r); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "src/pyrfc/throughput.pyx":133 - * self._destroy() - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self - * + /* "pyrfc/_cyrfc.pyx":3067 + * error = group2error[errorInfo.group] + * return error( + * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), # <<<<<<<<<<<<<< + * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), + * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), */ + __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->message, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3067, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_RFC_RC(__pyx_v_errorInfo->code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3067, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3067, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_15__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_14__enter__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyrfc/_cyrfc.pyx":3068 + * return error( + * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), + * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), # <<<<<<<<<<<<<< + * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), + * wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) + */ + __pyx_t_5 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgClass, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3068, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgType, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3068, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgNumber, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3068, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_14__enter__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); + /* "pyrfc/_cyrfc.pyx":3069 + * wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), + * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), + * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), # <<<<<<<<<<<<<< + * wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) + * ) + */ + __pyx_t_8 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); - /* "src/pyrfc/throughput.pyx":134 - * - * def __enter__(self): - * return self # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":3070 + * wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), + * wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), + * wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) # <<<<<<<<<<<<<< + * ) * - * @property */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); + __pyx_t_10 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3070, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __pyx_f_5pyrfc_6_cyrfc_wrapString(__pyx_v_errorInfo->abapMsgV4, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 3070, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_v_error); + __pyx_t_12 = __pyx_v_error; __pyx_t_13 = NULL; + __pyx_t_14 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_12, function); + __pyx_t_14 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_12)) { + PyObject *__pyx_temp[11] = {__pyx_t_13, __pyx_t_1, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 10+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { + PyObject *__pyx_temp[11] = {__pyx_t_13, __pyx_t_1, __pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_14, 10+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } else + #endif + { + __pyx_t_15 = PyTuple_New(10+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_14, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_15, 5+__pyx_t_14, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_15, 6+__pyx_t_14, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_15, 7+__pyx_t_14, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_15, 8+__pyx_t_14, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_15, 9+__pyx_t_14, __pyx_t_11); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3066, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":133 - * self._destroy() - * - * def __enter__(self): # <<<<<<<<<<<<<< - * return self + /* "pyrfc/_cyrfc.pyx":3055 + * raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) * + * cdef wrapError(RFC_ERROR_INFO* errorInfo): # <<<<<<<<<<<<<< + * group2error = { + * ABAP_APPLICATION_FAILURE: ABAPApplicationError, */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapError", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_group2error); + __Pyx_XDECREF(__pyx_v_error); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "src/pyrfc/throughput.pyx":137 - * - * @property - * def stats(self): # <<<<<<<<<<<<<< - * """Get throughput monitor statistics +/* "pyrfc/_cyrfc.pyx":3073 + * ) * + * cdef wrapString(const SAP_UC* uc, uclen=-1, rstrip=False): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5stats_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5stats_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_5stats___get__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_5stats___get__(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { - RFC_ERROR_INFO __pyx_v_errorInfo; +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapString(SAP_UC const *__pyx_v_uc, struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString *__pyx_optional_args) { + PyObject *__pyx_v_uclen = ((PyObject *)__pyx_int_neg_1); + PyObject *__pyx_v_rstrip = ((PyObject *)Py_False); RFC_RC __pyx_v_rc; - SAP_ULLONG __pyx_v_numberOfCalls; - SAP_ULLONG __pyx_v_sentBytes; - SAP_ULLONG __pyx_v_receivedBytes; - SAP_ULLONG __pyx_v_applicationTime; - SAP_ULLONG __pyx_v_totalTime; - SAP_ULLONG __pyx_v_serializationTime; - SAP_ULLONG __pyx_v_deserializationTime; - PyObject *__pyx_v__stats = NULL; + RFC_ERROR_INFO __pyx_v_errorInfo; + unsigned int __pyx_v_utf8_size; + char *__pyx_v_utf8; + unsigned int __pyx_v_result_len; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + unsigned int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + char const *__pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("wrapString", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_uclen = __pyx_optional_args->uclen; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_rstrip = __pyx_optional_args->rstrip; + } + } + } + __Pyx_INCREF(__pyx_v_uclen); - /* "src/pyrfc/throughput.pyx":161 - * cdef SAP_ULLONG deserializationTime - * - * _stats = {} # <<<<<<<<<<<<<< - * - * if self._throughput_handle == NULL: + /* "pyrfc/_cyrfc.pyx":3076 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if uclen == -1: # <<<<<<<<<<<<<< + * uclen = strlenU(uc) + * if uclen == 0: */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 161, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v__stats = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "src/pyrfc/throughput.pyx":163 - * _stats = {} - * - * if self._throughput_handle == NULL: # <<<<<<<<<<<<<< - * raise RFCError('No connections assigned') - * - */ - __pyx_t_2 = ((__pyx_v_self->_throughput_handle == NULL) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3076, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "src/pyrfc/throughput.pyx":164 - * - * if self._throughput_handle == NULL: - * raise RFCError('No connections assigned') # <<<<<<<<<<<<<< - * - * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3077 + * cdef RFC_ERROR_INFO errorInfo + * if uclen == -1: + * uclen = strlenU(uc) # <<<<<<<<<<<<<< + * if uclen == 0: + * return '' */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_No_connections_assigned) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_No_connections_assigned); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 164, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(strlenU(__pyx_v_uc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3077, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 164, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_uclen, __pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/throughput.pyx":163 - * _stats = {} - * - * if self._throughput_handle == NULL: # <<<<<<<<<<<<<< - * raise RFCError('No connections assigned') - * + /* "pyrfc/_cyrfc.pyx":3076 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if uclen == -1: # <<<<<<<<<<<<<< + * uclen = strlenU(uc) + * if uclen == 0: */ } - /* "src/pyrfc/throughput.pyx":166 - * raise RFCError('No connections assigned') - * - * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetNumberOfCalls(__pyx_v_self->_throughput_handle, (&__pyx_v_numberOfCalls), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/throughput.pyx":167 - * - * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['numberOfCalls'] = numberOfCalls + /* "pyrfc/_cyrfc.pyx":3078 + * if uclen == -1: + * uclen = strlenU(uc) + * if uclen == 0: # <<<<<<<<<<<<<< + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3078, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3078, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "src/pyrfc/throughput.pyx":168 - * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _stats['numberOfCalls'] = numberOfCalls - * + /* "pyrfc/_cyrfc.pyx":3079 + * uclen = strlenU(uc) + * if uclen == 0: + * return '' # <<<<<<<<<<<<<< + * cdef unsigned utf8_size = uclen * 5 + 1 + * cdef char *utf8 = malloc(utf8_size) */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 168, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 168, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_s__5); + __pyx_r = __pyx_kp_s__5; + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":167 - * - * rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['numberOfCalls'] = numberOfCalls + /* "pyrfc/_cyrfc.pyx":3078 + * if uclen == -1: + * uclen = strlenU(uc) + * if uclen == 0: # <<<<<<<<<<<<<< + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 */ } - /* "src/pyrfc/throughput.pyx":169 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * _stats['numberOfCalls'] = numberOfCalls # <<<<<<<<<<<<<< - * - * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3080 + * if uclen == 0: + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 # <<<<<<<<<<<<<< + * cdef char *utf8 = malloc(utf8_size) + * utf8[0] = 0 */ - __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_numberOfCalls); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 169, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_v_uclen, __pyx_int_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3080, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_numberOfCalls, __pyx_t_1) < 0)) __PYX_ERR(1, 169, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3080, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3080, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_utf8_size = __pyx_t_4; - /* "src/pyrfc/throughput.pyx":171 - * _stats['numberOfCalls'] = numberOfCalls - * - * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":3081 + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 + * cdef char *utf8 = malloc(utf8_size) # <<<<<<<<<<<<<< + * utf8[0] = 0 + * cdef unsigned result_len = 0 */ - __pyx_v_rc = RfcGetSentBytes(__pyx_v_self->_throughput_handle, (&__pyx_v_sentBytes), (&__pyx_v_errorInfo)); + __pyx_v_utf8 = ((char *)malloc(__pyx_v_utf8_size)); - /* "src/pyrfc/throughput.pyx":172 - * - * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['sentBytes'] = sentBytes + /* "pyrfc/_cyrfc.pyx":3082 + * cdef unsigned utf8_size = uclen * 5 + 1 + * cdef char *utf8 = malloc(utf8_size) + * utf8[0] = 0 # <<<<<<<<<<<<<< + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + */ + (__pyx_v_utf8[0]) = 0; + + /* "pyrfc/_cyrfc.pyx":3083 + * cdef char *utf8 = malloc(utf8_size) + * utf8[0] = 0 + * cdef unsigned result_len = 0 # <<<<<<<<<<<<<< + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + * if rc != RFC_OK: + */ + __pyx_v_result_len = 0; + + /* "pyrfc/_cyrfc.pyx":3084 + * utf8[0] = 0 + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * # raise wrapError(&errorInfo) + */ + __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_v_uclen); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3084, __pyx_L1_error) + __pyx_v_rc = RfcSAPUCToUTF8(__pyx_v_uc, __pyx_t_4, ((RFC_BYTE *)__pyx_v_utf8), (&__pyx_v_utf8_size), (&__pyx_v_result_len), (&__pyx_v_errorInfo)); + + /* "pyrfc/_cyrfc.pyx":3085 + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) */ __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/throughput.pyx":173 - * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _stats['sentBytes'] = sentBytes - * + /* "pyrfc/_cyrfc.pyx":3087 + * if rc != RFC_OK: + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) # <<<<<<<<<<<<<< + * utf8[result_len] = 0 + * try: */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 173, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3087, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_utf8_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_uclen); + __Pyx_GIVEREF(__pyx_v_uclen); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_uclen); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_wrapString_uclen_u_utf8_size_u, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3087, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 173, __pyx_L1_error) + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 3087, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":172 - * - * rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['sentBytes'] = sentBytes + /* "pyrfc/_cyrfc.pyx":3085 + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) */ } - /* "src/pyrfc/throughput.pyx":174 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * _stats['sentBytes'] = sentBytes # <<<<<<<<<<<<<< - * - * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3088 + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + * utf8[result_len] = 0 # <<<<<<<<<<<<<< + * try: + * if rstrip: */ - __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_sentBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 174, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_sentBytes, __pyx_t_1) < 0)) __PYX_ERR(1, 174, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + (__pyx_v_utf8[__pyx_v_result_len]) = 0; - /* "src/pyrfc/throughput.pyx":176 - * _stats['sentBytes'] = sentBytes - * - * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":3089 + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + * utf8[result_len] = 0 + * try: # <<<<<<<<<<<<<< + * if rstrip: + * return utf8[:result_len].rstrip().decode() */ - __pyx_v_rc = RfcGetReceivedBytes(__pyx_v_self->_throughput_handle, (&__pyx_v_receivedBytes), (&__pyx_v_errorInfo)); + /*try:*/ { + + /* "pyrfc/_cyrfc.pyx":3090 + * utf8[result_len] = 0 + * try: + * if rstrip: # <<<<<<<<<<<<<< + * return utf8[:result_len].rstrip().decode() + * else: + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rstrip); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3090, __pyx_L7_error) + if (__pyx_t_2) { + + /* "pyrfc/_cyrfc.pyx":3091 + * try: + * if rstrip: + * return utf8[:result_len].rstrip().decode() # <<<<<<<<<<<<<< + * else: + * return utf8[:result_len].decode() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_utf8 + 0, __pyx_v_result_len - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3091, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3091, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3091, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3091, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3091, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L6_return; + + /* "pyrfc/_cyrfc.pyx":3090 + * utf8[result_len] = 0 + * try: + * if rstrip: # <<<<<<<<<<<<<< + * return utf8[:result_len].rstrip().decode() + * else: + */ + } + + /* "pyrfc/_cyrfc.pyx":3093 + * return utf8[:result_len].rstrip().decode() + * else: + * return utf8[:result_len].decode() # <<<<<<<<<<<<<< + * finally: + * free(utf8) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_utf8, 0, __pyx_v_result_len, NULL, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3093, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L6_return; + } + } - /* "src/pyrfc/throughput.pyx":177 + /* "pyrfc/_cyrfc.pyx":3095 + * return utf8[:result_len].decode() + * finally: + * free(utf8) # <<<<<<<<<<<<<< * - * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['receivedBytes'] = receivedBytes + * cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { + /*finally:*/ { + __pyx_L7_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_15); + __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename; + { + free(__pyx_v_utf8); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9; + goto __pyx_L1_error; + } + __pyx_L6_return: { + __pyx_t_15 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_utf8); + __pyx_r = __pyx_t_15; + __pyx_t_15 = 0; + goto __pyx_L0; + } + } - /* "src/pyrfc/throughput.pyx":178 - * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _stats['receivedBytes'] = receivedBytes + /* "pyrfc/_cyrfc.pyx":3073 + * ) * + * cdef wrapString(const SAP_UC* uc, uclen=-1, rstrip=False): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 178, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 178, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":177 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_uclen); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyrfc/_cyrfc.pyx":3097 + * free(utf8) * - * rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['receivedBytes'] = receivedBytes + * cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ + +static PyObject *__pyx_f_5pyrfc_6_cyrfc_wrapString(SAP_UC *__pyx_v_uc, struct __pyx_opt_args_5pyrfc_6_cyrfc_wrapString *__pyx_optional_args) { + PyObject *__pyx_v_uclen = ((PyObject *)__pyx_int_neg_1); + PyObject *__pyx_v_rstrip = ((PyObject *)Py_True); + RFC_RC __pyx_v_rc; + RFC_ERROR_INFO __pyx_v_errorInfo; + unsigned int __pyx_v_utf8_size; + char *__pyx_v_utf8; + unsigned int __pyx_v_result_len; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + char const *__pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("wrapString", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_uclen = __pyx_optional_args->uclen; + if (__pyx_optional_args->__pyx_n > 1) { + __pyx_v_rstrip = __pyx_optional_args->rstrip; + } + } } + __Pyx_INCREF(__pyx_v_uclen); - /* "src/pyrfc/throughput.pyx":179 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * _stats['receivedBytes'] = receivedBytes # <<<<<<<<<<<<<< - * - * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3100 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if uclen == -1: # <<<<<<<<<<<<<< + * uclen = strlenU(uc) + * if uclen == 0: */ - __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_receivedBytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 179, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_receivedBytes, __pyx_t_1) < 0)) __PYX_ERR(1, 179, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "src/pyrfc/throughput.pyx":181 - * _stats['receivedBytes'] = receivedBytes - * - * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetApplicationTime(__pyx_v_self->_throughput_handle, (&__pyx_v_applicationTime), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/throughput.pyx":182 - * - * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['applicationTime'] = applicationTime - */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { - - /* "src/pyrfc/throughput.pyx":183 - * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _stats['applicationTime'] = applicationTime - * + /* "pyrfc/_cyrfc.pyx":3101 + * cdef RFC_ERROR_INFO errorInfo + * if uclen == -1: + * uclen = strlenU(uc) # <<<<<<<<<<<<<< + * if uclen == 0: + * return '' */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 183, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(strlenU(__pyx_v_uc)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 183, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_uclen, __pyx_t_1); + __pyx_t_1 = 0; - /* "src/pyrfc/throughput.pyx":182 - * - * rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['applicationTime'] = applicationTime + /* "pyrfc/_cyrfc.pyx":3100 + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo + * if uclen == -1: # <<<<<<<<<<<<<< + * uclen = strlenU(uc) + * if uclen == 0: */ } - /* "src/pyrfc/throughput.pyx":184 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * _stats['applicationTime'] = applicationTime # <<<<<<<<<<<<<< - * - * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3102 + * if uclen == -1: + * uclen = strlenU(uc) + * if uclen == 0: # <<<<<<<<<<<<<< + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 */ - __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_applicationTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 184, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_uclen, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_applicationTime, __pyx_t_1) < 0)) __PYX_ERR(1, 184, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "src/pyrfc/throughput.pyx":186 - * _stats['applicationTime'] = applicationTime - * - * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetTotalTime(__pyx_v_self->_throughput_handle, (&__pyx_v_totalTime), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/throughput.pyx":187 - * - * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['totalTime'] = totalTime - */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { - - /* "src/pyrfc/throughput.pyx":188 - * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _stats['totalTime'] = totalTime - * + /* "pyrfc/_cyrfc.pyx":3103 + * uclen = strlenU(uc) + * if uclen == 0: + * return '' # <<<<<<<<<<<<<< + * cdef unsigned utf8_size = uclen * 5 + 1 + * cdef char *utf8 = malloc(utf8_size) */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 188, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_s__5); + __pyx_r = __pyx_kp_s__5; + goto __pyx_L0; - /* "src/pyrfc/throughput.pyx":187 - * - * rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['totalTime'] = totalTime + /* "pyrfc/_cyrfc.pyx":3102 + * if uclen == -1: + * uclen = strlenU(uc) + * if uclen == 0: # <<<<<<<<<<<<<< + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 */ } - /* "src/pyrfc/throughput.pyx":189 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * _stats['totalTime'] = totalTime # <<<<<<<<<<<<<< - * - * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3104 + * if uclen == 0: + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 # <<<<<<<<<<<<<< + * cdef char *utf8 = malloc(utf8_size) + * utf8[0] = 0 */ - __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_totalTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 189, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_v_uclen, __pyx_int_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_totalTime, __pyx_t_1) < 0)) __PYX_ERR(1, 189, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_utf8_size = __pyx_t_4; - /* "src/pyrfc/throughput.pyx":191 - * _stats['totalTime'] = totalTime - * - * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - */ - __pyx_v_rc = RfcGetSerializationTime(__pyx_v_self->_throughput_handle, (&__pyx_v_serializationTime), (&__pyx_v_errorInfo)); - - /* "src/pyrfc/throughput.pyx":192 - * - * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['serializationTime'] = serializationTime - */ - __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); - if (unlikely(__pyx_t_2)) { - - /* "src/pyrfc/throughput.pyx":193 - * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _stats['serializationTime'] = serializationTime - * + /* "pyrfc/_cyrfc.pyx":3105 + * return '' + * cdef unsigned utf8_size = uclen * 5 + 1 + * cdef char *utf8 = malloc(utf8_size) # <<<<<<<<<<<<<< + * utf8[0] = 0 + * cdef unsigned result_len = 0 */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 193, __pyx_L1_error) + __pyx_v_utf8 = ((char *)malloc(__pyx_v_utf8_size)); - /* "src/pyrfc/throughput.pyx":192 - * - * rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['serializationTime'] = serializationTime + /* "pyrfc/_cyrfc.pyx":3106 + * cdef unsigned utf8_size = uclen * 5 + 1 + * cdef char *utf8 = malloc(utf8_size) + * utf8[0] = 0 # <<<<<<<<<<<<<< + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) */ - } + (__pyx_v_utf8[0]) = 0; - /* "src/pyrfc/throughput.pyx":194 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * _stats['serializationTime'] = serializationTime # <<<<<<<<<<<<<< - * - * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) + /* "pyrfc/_cyrfc.pyx":3107 + * cdef char *utf8 = malloc(utf8_size) + * utf8[0] = 0 + * cdef unsigned result_len = 0 # <<<<<<<<<<<<<< + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + * if rc != RFC_OK: */ - __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_serializationTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_serializationTime, __pyx_t_1) < 0)) __PYX_ERR(1, 194, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_result_len = 0; - /* "src/pyrfc/throughput.pyx":196 - * _stats['serializationTime'] = serializationTime - * - * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) # <<<<<<<<<<<<<< - * if rc != RFC_OK: - * raise wrapError(&errorInfo) + /* "pyrfc/_cyrfc.pyx":3108 + * utf8[0] = 0 + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) # <<<<<<<<<<<<<< + * if rc != RFC_OK: + * # raise wrapError(&errorInfo) */ - __pyx_v_rc = RfcGetDeserializationTime(__pyx_v_self->_throughput_handle, (&__pyx_v_deserializationTime), (&__pyx_v_errorInfo)); + __pyx_t_4 = __Pyx_PyInt_As_unsigned_int(__pyx_v_uclen); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3108, __pyx_L1_error) + __pyx_v_rc = RfcSAPUCToUTF8(__pyx_v_uc, __pyx_t_4, ((RFC_BYTE *)__pyx_v_utf8), (&__pyx_v_utf8_size), (&__pyx_v_result_len), (&__pyx_v_errorInfo)); - /* "src/pyrfc/throughput.pyx":197 - * - * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['deserializationTime'] = deserializationTime + /* "pyrfc/_cyrfc.pyx":3109 + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) */ __pyx_t_2 = ((__pyx_v_rc != RFC_OK) != 0); if (unlikely(__pyx_t_2)) { - /* "src/pyrfc/throughput.pyx":198 - * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) - * if rc != RFC_OK: - * raise wrapError(&errorInfo) # <<<<<<<<<<<<<< - * _stats['deserializationTime'] = deserializationTime - * + /* "pyrfc/_cyrfc.pyx":3111 + * if rc != RFC_OK: + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) # <<<<<<<<<<<<<< + * utf8[result_len] = 0 + * try: */ - __pyx_t_1 = __pyx_f_5pyrfc_6_cyrfc_wrapError((&__pyx_v_errorInfo)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 198, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_RFCError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_utf8_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_uclen); + __Pyx_GIVEREF(__pyx_v_uclen); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_uclen); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_wrapString_uclen_u_utf8_size_u, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 198, __pyx_L1_error) + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 3111, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":197 - * - * rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) - * if rc != RFC_OK: # <<<<<<<<<<<<<< - * raise wrapError(&errorInfo) - * _stats['deserializationTime'] = deserializationTime + /* "pyrfc/_cyrfc.pyx":3109 + * cdef unsigned result_len = 0 + * rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + * if rc != RFC_OK: # <<<<<<<<<<<<<< + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) */ } - /* "src/pyrfc/throughput.pyx":199 - * if rc != RFC_OK: - * raise wrapError(&errorInfo) - * _stats['deserializationTime'] = deserializationTime # <<<<<<<<<<<<<< - * - * return _stats - */ - __pyx_t_1 = __Pyx_PyInt_From_SAP_ULLONG(__pyx_v_deserializationTime); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v__stats, __pyx_n_s_deserializationTime, __pyx_t_1) < 0)) __PYX_ERR(1, 199, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/throughput.pyx":201 - * _stats['deserializationTime'] = deserializationTime - * - * return _stats # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":3112 + * # raise wrapError(&errorInfo) + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + * utf8[result_len] = 0 # <<<<<<<<<<<<<< + * try: + * if rstrip: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v__stats); - __pyx_r = __pyx_v__stats; - goto __pyx_L0; + (__pyx_v_utf8[__pyx_v_result_len]) = 0; - /* "src/pyrfc/throughput.pyx":137 - * - * @property - * def stats(self): # <<<<<<<<<<<<<< - * """Get throughput monitor statistics - * + /* "pyrfc/_cyrfc.pyx":3113 + * raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + * utf8[result_len] = 0 + * try: # <<<<<<<<<<<<<< + * if rstrip: + * return utf8[:result_len].rstrip().decode() */ + /*try:*/ { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.stats.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v__stats); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): + /* "pyrfc/_cyrfc.pyx":3114 + * utf8[result_len] = 0 + * try: + * if rstrip: # <<<<<<<<<<<<<< + * return utf8[:result_len].rstrip().decode() + * else: */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_rstrip); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3114, __pyx_L7_error) + if (__pyx_t_2) { -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_16__reduce_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce_cython__", 0); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + /* "pyrfc/_cyrfc.pyx":3115 + * try: + * if rstrip: + * return utf8[:result_len].rstrip().decode() # <<<<<<<<<<<<<< + * else: + * return utf8[:result_len].decode() */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 2, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_utf8 + 0, __pyx_v_result_len - 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3115, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3115, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3115, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3115, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3115, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L6_return; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): + /* "pyrfc/_cyrfc.pyx":3114 + * utf8[result_len] = 0 + * try: + * if rstrip: # <<<<<<<<<<<<<< + * return utf8[:result_len].rstrip().decode() + * else: */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + /* "pyrfc/_cyrfc.pyx":3117 + * return utf8[:result_len].rstrip().decode() + * else: + * return utf8[:result_len].decode() # <<<<<<<<<<<<<< + * finally: + * free(utf8) */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_utf8, 0, __pyx_v_result_len, NULL, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3117, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L6_return; + } + } -/* Python wrapper */ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_5pyrfc_6_cyrfc_10Throughput_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_5pyrfc_6_cyrfc_10Throughput_18__setstate_cython__(((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_5pyrfc_6_cyrfc_10Throughput_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":3119 + * return utf8[:result_len].decode() + * finally: + * free(utf8) # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(3, 4, __pyx_L1_error) + /*finally:*/ { + __pyx_L7_error:; + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_13); + __Pyx_XGOTREF(__pyx_t_14); + __Pyx_XGOTREF(__pyx_t_15); + __pyx_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename; + { + free(__pyx_v_utf8); + } + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_14); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15); + } + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12); + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; + __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9; + goto __pyx_L1_error; + } + __pyx_L6_return: { + __pyx_t_15 = __pyx_r; + __pyx_r = 0; + free(__pyx_v_utf8); + __pyx_r = __pyx_t_15; + __pyx_t_15 = 0; + goto __pyx_L0; + } + } - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") + /* "pyrfc/_cyrfc.pyx":3097 + * free(utf8) + * + * cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): # <<<<<<<<<<<<<< + * cdef RFC_RC rc + * cdef RFC_ERROR_INFO errorInfo */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyrfc._cyrfc.Throughput.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("pyrfc._cyrfc.wrapString", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_uclen); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -41968,7 +40210,7 @@ static PyObject *__pyx_pf_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_client_connection); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 67, __pyx_L1_error) + __pyx_t_1 = __pyx_cur_scope->__pyx_v_f(__pyx_v_client_connection); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -42015,7 +40257,7 @@ static PyObject *__Pyx_CFunc_object____object___to_py(PyObject *(*__pyx_v_f)(PyO if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj___pyx_scope_struct____Pyx_CFunc_object____object___to_py *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(3, 64, __pyx_L1_error) + __PYX_ERR(1, 64, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } @@ -42028,7 +40270,7 @@ static PyObject *__Pyx_CFunc_object____object___to_py(PyObject *(*__pyx_v_f)(PyO * """wrap(client_connection)""" * return f(client_connection) */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_object____object___t, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 65, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11cfunc_dot_to_py_36__Pyx_CFunc_object____object___to_py_1wrap, 0, __pyx_n_s_Pyx_CFunc_object____object___t, ((PyObject*)__pyx_cur_scope), __pyx_n_s_cfunc_to_py, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_wrap = __pyx_t_1; __pyx_t_1 = 0; @@ -42853,553 +41095,91 @@ static PyTypeObject __pyx_type_5pyrfc_6_cyrfc_Server = { 0, /*tp_pypy_flags*/ #endif }; -static struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Throughput __pyx_vtable_5pyrfc_6_cyrfc_Throughput; - -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc_Throughput(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o); - p->__pyx_vtab = __pyx_vtabptr_5pyrfc_6_cyrfc_Throughput; - p->_connections = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_5pyrfc_6_cyrfc_Throughput(PyObject *o) { - struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p = (struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o; - #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->_connections); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_5pyrfc_6_cyrfc_Throughput(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p = (struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o; - if (p->_connections) { - e = (*v)(p->_connections, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5pyrfc_6_cyrfc_Throughput(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p = (struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o; - tmp = ((PyObject*)p->_connections); - p->_connections = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_5pyrfc_6_cyrfc_10Throughput_connections(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5pyrfc_6_cyrfc_10Throughput_11connections_1__get__(o); -} - -static PyObject *__pyx_getprop_5pyrfc_6_cyrfc_10Throughput__handle(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5pyrfc_6_cyrfc_10Throughput_7_handle_1__get__(o); -} - -static PyObject *__pyx_getprop_5pyrfc_6_cyrfc_10Throughput_stats(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_5pyrfc_6_cyrfc_10Throughput_5stats_1__get__(o); -} - -static PyMethodDef __pyx_methods_5pyrfc_6_cyrfc_Throughput[] = { - {"setOnConnection", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_3setOnConnection, METH_O, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_2setOnConnection}, - {"getFromConnection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_4getFromConnection}, - {"removeFromConnection", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7removeFromConnection, METH_O, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection}, - {"reset", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_9reset, METH_NOARGS, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_8reset}, - {"__del__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11__del__, METH_NOARGS, 0}, - {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_13__exit__, METH_VARARGS|METH_KEYWORDS, 0}, - {"__enter__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_15__enter__, METH_NOARGS, 0}, - {"__reduce_cython__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_17__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_19__setstate_cython__, METH_O, 0}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_5pyrfc_6_cyrfc_Throughput[] = { - {(char *)"connections", __pyx_getprop_5pyrfc_6_cyrfc_10Throughput_connections, 0, (char *)"Get connections attached to throughput monitoring\n\n :getter: Connections' instances\n :type: set of Connection\n ", 0}, - {(char *)"_handle", __pyx_getprop_5pyrfc_6_cyrfc_10Throughput__handle, 0, (char *)"Get throughput object handle\n\n :getter: Throughput object handle\n :type: uintptr_t\n ", 0}, - {(char *)"stats", __pyx_getprop_5pyrfc_6_cyrfc_10Throughput_stats, 0, (char *)"Get throughput monitor statistics\n\n :getter: Throughput monitor counters\n :type: dict(str,int)\n\n * numberOfCalls\n * sentBytes\n * receivedBytes\n * applicationTime\n * totalTime\n * serializationTime\n * deserializationTime\n ", 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_5pyrfc_6_cyrfc_Throughput = { - PyVarObject_HEAD_INIT(0, 0) - "pyrfc._cyrfc.Throughput", /*tp_name*/ - sizeof(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5pyrfc_6_cyrfc_Throughput, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5pyrfc_6_cyrfc_Throughput, /*tp_traverse*/ - __pyx_tp_clear_5pyrfc_6_cyrfc_Throughput, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_5pyrfc_6_cyrfc_Throughput, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_5pyrfc_6_cyrfc_Throughput, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_5pyrfc_6_cyrfc_10Throughput_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5pyrfc_6_cyrfc_Throughput, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names[8]; -static int __pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names = 0; - -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names)))) { - o = (PyObject*)__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names[--__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names]; - memset(o, 0, sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names(PyObject *o) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_enum_obj); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names)))) { - __pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names[__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names++] = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *)o; - if (p->__pyx_v_enum_obj) { - e = (*v)(p->__pyx_v_enum_obj, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names *)o; - tmp = ((PyObject*)p->__pyx_v_enum_obj); - p->__pyx_v_enum_obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names = { - PyVarObject_HEAD_INIT(0, 0) - "pyrfc._cyrfc.__pyx_scope_struct__enum_names", /*tp_name*/ - sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names, /*tp_traverse*/ - __pyx_tp_clear_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr[8]; -static int __pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr = 0; - -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr)))) { - o = (PyObject*)__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr[--__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr(PyObject *o) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_e); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr)))) { - __pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr[__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_e) { - e = (*v)(p->__pyx_v_e, a); if (e) return e; - } - return 0; -} - -static PyTypeObject __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr = { - PyVarObject_HEAD_INIT(0, 0) - "pyrfc._cyrfc.__pyx_scope_struct_1_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values[8]; -static int __pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values = 0; - -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values)))) { - o = (PyObject*)__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values[--__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values]; - memset(o, 0, sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - return o; -} - -static void __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values(PyObject *o) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_enum_obj); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values)))) { - __pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values[__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values++] = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } -} - -static int __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *)o; - if (p->__pyx_v_enum_obj) { - e = (*v)(p->__pyx_v_enum_obj, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values *)o; - tmp = ((PyObject*)p->__pyx_v_enum_obj); - p->__pyx_v_enum_obj = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values = { - PyVarObject_HEAD_INIT(0, 0) - "pyrfc._cyrfc.__pyx_scope_struct_2_enum_values", /*tp_name*/ - sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values, /*tp_traverse*/ - __pyx_tp_clear_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, /*tp_vectorcall*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, /*tp_print*/ - #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, /*tp_pypy_flags*/ - #endif -}; - -static struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr[8]; -static int __pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr = 0; +static struct __pyx_vtabstruct_5pyrfc_6_cyrfc_Throughput __pyx_vtable_5pyrfc_6_cyrfc_Throughput; -static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { +static PyObject *__pyx_tp_new_5pyrfc_6_cyrfc_Throughput(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p; PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr)))) { - o = (PyObject*)__pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr[--__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr]; - memset(o, 0, sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr)); - (void) PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o); + p->__pyx_vtab = __pyx_vtabptr_5pyrfc_6_cyrfc_Throughput; + p->_connections = Py_None; Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr(PyObject *o) { - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_outer_scope); - Py_CLEAR(p->__pyx_v_e); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr)))) { - __pyx_freelist_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr[__pyx_freecount_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); +static void __pyx_tp_dealloc_5pyrfc_6_cyrfc_Throughput(PyObject *o) { + struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p = (struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->_connections); + (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_5pyrfc_6_cyrfc_Throughput(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr *)o; - if (p->__pyx_outer_scope) { - e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e; - } - if (p->__pyx_v_e) { - e = (*v)(p->__pyx_v_e, a); if (e) return e; + struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p = (struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o; + if (p->_connections) { + e = (*v)(p->_connections, a); if (e) return e; } return 0; } -static PyTypeObject __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr = { +static int __pyx_tp_clear_5pyrfc_6_cyrfc_Throughput(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *p = (struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *)o; + tmp = ((PyObject*)p->_connections); + p->_connections = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_5pyrfc_6_cyrfc_10Throughput_connections(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5pyrfc_6_cyrfc_10Throughput_11connections_1__get__(o); +} + +static PyObject *__pyx_getprop_5pyrfc_6_cyrfc_10Throughput__handle(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5pyrfc_6_cyrfc_10Throughput_7_handle_1__get__(o); +} + +static PyObject *__pyx_getprop_5pyrfc_6_cyrfc_10Throughput_stats(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_5pyrfc_6_cyrfc_10Throughput_5stats_1__get__(o); +} + +static PyMethodDef __pyx_methods_5pyrfc_6_cyrfc_Throughput[] = { + {"setOnConnection", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_3setOnConnection, METH_O, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_2setOnConnection}, + {"getFromConnection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_5getFromConnection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_4getFromConnection}, + {"removeFromConnection", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_7removeFromConnection, METH_O, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_6removeFromConnection}, + {"reset", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_9reset, METH_NOARGS, __pyx_doc_5pyrfc_6_cyrfc_10Throughput_8reset}, + {"__del__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_11__del__, METH_NOARGS, 0}, + {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_13__exit__, METH_VARARGS|METH_KEYWORDS, 0}, + {"__enter__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_15__enter__, METH_NOARGS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_17__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_5pyrfc_6_cyrfc_10Throughput_19__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_5pyrfc_6_cyrfc_Throughput[] = { + {(char *)"connections", __pyx_getprop_5pyrfc_6_cyrfc_10Throughput_connections, 0, (char *)"Get connections attached to throughput monitoring\n\n :getter: Connections' instances\n :type: set of Connection\n ", 0}, + {(char *)"_handle", __pyx_getprop_5pyrfc_6_cyrfc_10Throughput__handle, 0, (char *)"Get throughput object handle\n\n :getter: Throughput object handle\n :type: uintptr_t\n ", 0}, + {(char *)"stats", __pyx_getprop_5pyrfc_6_cyrfc_10Throughput_stats, 0, (char *)"Get throughput monitor statistics\n\n :getter: Throughput monitor counters\n :type: dict(str,int)\n\n * numberOfCalls\n * sentBytes\n * receivedBytes\n * applicationTime\n * totalTime\n * serializationTime\n * deserializationTime\n ", 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_5pyrfc_6_cyrfc_Throughput = { PyVarObject_HEAD_INIT(0, 0) - "pyrfc._cyrfc.__pyx_scope_struct_3_genexpr", /*tp_name*/ - sizeof(struct __pyx_obj_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr), /*tp_basicsize*/ + "pyrfc._cyrfc.Throughput", /*tp_name*/ + sizeof(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr, /*tp_dealloc*/ + __pyx_tp_dealloc_5pyrfc_6_cyrfc_Throughput, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif @@ -43424,25 +41204,25 @@ static PyTypeObject __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_5pyrfc_6_cyrfc_Throughput, /*tp_traverse*/ + __pyx_tp_clear_5pyrfc_6_cyrfc_Throughput, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - 0, /*tp_methods*/ + __pyx_methods_5pyrfc_6_cyrfc_Throughput, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_5pyrfc_6_cyrfc_Throughput, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_5pyrfc_6_cyrfc_10Throughput_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr, /*tp_new*/ + __pyx_tp_new_5pyrfc_6_cyrfc_Throughput, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -43645,11 +41425,7 @@ static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) { "__pyx_ctuple_unsigned__space_int", "__pyx_ctuple_unsigned__space_int_struct", "__pyx_opt_args_5pyrfc_6_cyrfc_wrapString", - "__pyx_scope_struct_1_genexpr", - "__pyx_scope_struct_2_enum_values", - "__pyx_scope_struct_3_genexpr", "__pyx_scope_struct____Pyx_CFunc_object____object___to_py", - "__pyx_scope_struct__enum_names", "const_SAP_UC_ptr", "uintptr_t", 0 @@ -43861,7 +41637,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_FunctionDescription___init, __pyx_k_FunctionDescription___init, sizeof(__pyx_k_FunctionDescription___init), 0, 0, 1, 1}, {&__pyx_n_s_FunctionDescription___repr, __pyx_k_FunctionDescription___repr, sizeof(__pyx_k_FunctionDescription___repr), 0, 0, 1, 1}, {&__pyx_n_s_FunctionDescription_add_paramete, __pyx_k_FunctionDescription_add_paramete, sizeof(__pyx_k_FunctionDescription_add_paramete), 0, 0, 1, 1}, - {&__pyx_n_s_HIGHEST_PROTOCOL, __pyx_k_HIGHEST_PROTOCOL, sizeof(__pyx_k_HIGHEST_PROTOCOL), 0, 0, 1, 1}, {&__pyx_kp_s_H_M_S, __pyx_k_H_M_S, sizeof(__pyx_k_H_M_S), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_connection_handle, __pyx_k_Invalid_connection_handle, sizeof(__pyx_k_Invalid_connection_handle), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_exception_raised_by_call, __pyx_k_Invalid_exception_raised_by_call, sizeof(__pyx_k_Invalid_exception_raised_by_call), 0, 0, 1, 0}, @@ -43959,17 +41734,17 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_Values, __pyx_k_Values, sizeof(__pyx_k_Values), 0, 1, 0, 0}, {&__pyx_kp_s_Y_m_d, __pyx_k_Y_m_d, sizeof(__pyx_k_Y_m_d), 0, 0, 1, 0}, {&__pyx_kp_s__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 0, 1, 0}, + {&__pyx_kp_u__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 1, 0, 0}, + {&__pyx_kp_u__23, __pyx_k__23, sizeof(__pyx_k__23), 0, 1, 0, 0}, + {&__pyx_kp_u__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 1, 0, 0}, + {&__pyx_kp_u__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 1, 0, 0}, + {&__pyx_kp_u__28, __pyx_k__28, sizeof(__pyx_k__28), 0, 1, 0, 0}, {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0}, - {&__pyx_kp_u__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 1, 0, 0}, - {&__pyx_kp_u__36, __pyx_k__36, sizeof(__pyx_k__36), 0, 1, 0, 0}, - {&__pyx_kp_u__39, __pyx_k__39, sizeof(__pyx_k__39), 0, 1, 0, 0}, {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, - {&__pyx_kp_u__40, __pyx_k__40, sizeof(__pyx_k__40), 0, 1, 0, 0}, + {&__pyx_kp_s__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 0, 1, 0}, {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0}, {&__pyx_n_s__50, __pyx_k__50, sizeof(__pyx_k__50), 0, 0, 1, 1}, {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, - {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0}, - {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0}, {&__pyx_kp_s_a_decimal_value_required_receive, __pyx_k_a_decimal_value_required_receive, sizeof(__pyx_k_a_decimal_value_required_receive), 0, 0, 1, 0}, {&__pyx_kp_s_a_numeric_string_is_required_rec, __pyx_k_a_numeric_string_is_required_rec, sizeof(__pyx_k_a_numeric_string_is_required_rec), 0, 0, 1, 0}, {&__pyx_n_s_active_unit, __pyx_k_active_unit, sizeof(__pyx_k_active_unit), 0, 0, 1, 1}, @@ -44052,15 +41827,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_direction_string, __pyx_k_direction_string, sizeof(__pyx_k_direction_string), 0, 1, 0, 0}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_dtime, __pyx_k_dtime, sizeof(__pyx_k_dtime), 0, 0, 1, 1}, - {&__pyx_n_s_dumps, __pyx_k_dumps, sizeof(__pyx_k_dumps), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1}, {&__pyx_n_s_enum_names, __pyx_k_enum_names, sizeof(__pyx_k_enum_names), 0, 0, 1, 1}, - {&__pyx_n_s_enum_names_locals_genexpr, __pyx_k_enum_names_locals_genexpr, sizeof(__pyx_k_enum_names_locals_genexpr), 0, 0, 1, 1}, - {&__pyx_n_s_enum_obj, __pyx_k_enum_obj, sizeof(__pyx_k_enum_obj), 0, 0, 1, 1}, {&__pyx_n_s_enum_values, __pyx_k_enum_values, sizeof(__pyx_k_enum_values), 0, 0, 1, 1}, - {&__pyx_n_s_enum_values_locals_genexpr, __pyx_k_enum_values_locals_genexpr, sizeof(__pyx_k_enum_values_locals_genexpr), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_errorInfo, __pyx_k_errorInfo, sizeof(__pyx_k_errorInfo), 0, 0, 1, 1}, {&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1}, @@ -44080,7 +41851,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_func_name, __pyx_k_func_name, sizeof(__pyx_k_func_name), 0, 0, 1, 1}, {&__pyx_n_s_function_name, __pyx_k_function_name, sizeof(__pyx_k_function_name), 0, 0, 1, 1}, {&__pyx_n_s_genericHandler, __pyx_k_genericHandler, sizeof(__pyx_k_genericHandler), 0, 0, 1, 1}, - {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1}, {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, {&__pyx_n_s_getFromConnection, __pyx_k_getFromConnection, sizeof(__pyx_k_getFromConnection), 0, 0, 1, 1}, {&__pyx_n_s_getState, __pyx_k_getState, sizeof(__pyx_k_getState), 0, 0, 1, 1}, @@ -44128,7 +41898,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_launched, __pyx_k_launched, sizeof(__pyx_k_launched), 0, 1, 0, 0}, {&__pyx_kp_u_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 1, 0, 0}, {&__pyx_kp_s_list_required_for_table_paramete, __pyx_k_list_required_for_table_paramete, sizeof(__pyx_k_list_required_for_table_paramete), 0, 0, 1, 0}, - {&__pyx_n_s_loads, __pyx_k_loads, sizeof(__pyx_k_loads), 0, 0, 1, 1}, {&__pyx_n_s_locale, __pyx_k_locale, sizeof(__pyx_k_locale), 0, 0, 1, 1}, {&__pyx_n_s_localeconv, __pyx_k_localeconv, sizeof(__pyx_k_localeconv), 0, 0, 1, 1}, {&__pyx_n_s_lock, __pyx_k_lock, sizeof(__pyx_k_lock), 0, 0, 1, 1}, @@ -44163,9 +41932,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_nuc_length, __pyx_k_nuc_length, sizeof(__pyx_k_nuc_length), 0, 0, 1, 1}, {&__pyx_n_s_nuc_offset, __pyx_k_nuc_offset, sizeof(__pyx_k_nuc_offset), 0, 0, 1, 1}, {&__pyx_n_s_numberOfCalls, __pyx_k_numberOfCalls, sizeof(__pyx_k_numberOfCalls), 0, 0, 1, 1}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_objstr, __pyx_k_objstr, sizeof(__pyx_k_objstr), 0, 0, 1, 1}, {&__pyx_kp_s_of_type, __pyx_k_of_type, sizeof(__pyx_k_of_type), 0, 0, 1, 0}, {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, {&__pyx_n_s_optional, __pyx_k_optional, sizeof(__pyx_k_optional), 0, 0, 1, 1}, @@ -44192,7 +41959,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_pathName, __pyx_k_pathName, sizeof(__pyx_k_pathName), 0, 0, 1, 1}, {&__pyx_n_s_path_name, __pyx_k_path_name, sizeof(__pyx_k_path_name), 0, 0, 1, 1}, {&__pyx_n_s_peakBusyCount, __pyx_k_peakBusyCount, sizeof(__pyx_k_peakBusyCount), 0, 0, 1, 1}, - {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, {&__pyx_n_s_platform, __pyx_k_platform, sizeof(__pyx_k_platform), 0, 0, 1, 1}, {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1}, {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, @@ -44200,7 +41966,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_progName, __pyx_k_progName, sizeof(__pyx_k_progName), 0, 0, 1, 1}, {&__pyx_n_s_program, __pyx_k_program, sizeof(__pyx_k_program), 0, 0, 1, 1}, {&__pyx_n_s_protocolType, __pyx_k_protocolType, sizeof(__pyx_k_protocolType), 0, 0, 1, 1}, - {&__pyx_n_s_py_to_string, __pyx_k_py_to_string, sizeof(__pyx_k_py_to_string), 0, 0, 1, 1}, {&__pyx_n_s_pyrfc__cyrfc, __pyx_k_pyrfc__cyrfc, sizeof(__pyx_k_pyrfc__cyrfc), 0, 0, 1, 1}, {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, @@ -44241,7 +42006,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_self__handle_cannot_be_converted, __pyx_k_self__handle_cannot_be_converted, sizeof(__pyx_k_self__handle_cannot_be_converted), 0, 0, 1, 0}, {&__pyx_kp_s_self__handle_self__tHandle_self, __pyx_k_self__handle_self__tHandle_self, sizeof(__pyx_k_self__handle_self__tHandle_self), 0, 0, 1, 0}, {&__pyx_kp_s_self__throughput_handle_cannot_b, __pyx_k_self__throughput_handle_cannot_b, sizeof(__pyx_k_self__throughput_handle_cannot_b), 0, 0, 1, 0}, - {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, {&__pyx_n_s_sending_date, __pyx_k_sending_date, sizeof(__pyx_k_sending_date), 0, 0, 1, 1}, {&__pyx_n_s_sending_time, __pyx_k_sending_time, sizeof(__pyx_k_sending_time), 0, 0, 1, 1}, {&__pyx_n_s_sentBytes, __pyx_k_sentBytes, sizeof(__pyx_k_sentBytes), 0, 0, 1, 1}, @@ -44263,14 +42027,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_should_be_from_1_30_chars, __pyx_k_should_be_from_1_30_chars, sizeof(__pyx_k_should_be_from_1_30_chars), 0, 1, 0, 0}, {&__pyx_kp_u_should_be_from_1_30_chars_2, __pyx_k_should_be_from_1_30_chars_2, sizeof(__pyx_k_should_be_from_1_30_chars_2), 0, 1, 0, 0}, {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1}, - {&__pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_k_src_pyrfc_nwrfcsdk_pyx, sizeof(__pyx_k_src_pyrfc_nwrfcsdk_pyx), 0, 0, 1, 0}, - {&__pyx_kp_s_src_pyrfc_server_pyx, __pyx_k_src_pyrfc_server_pyx, sizeof(__pyx_k_src_pyrfc_server_pyx), 0, 0, 1, 0}, - {&__pyx_kp_s_src_pyrfc_throughput_pyx, __pyx_k_src_pyrfc_throughput_pyx, sizeof(__pyx_k_src_pyrfc_throughput_pyx), 0, 0, 1, 0}, + {&__pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_k_src_pyrfc__cyrfc_pyx, sizeof(__pyx_k_src_pyrfc__cyrfc_pyx), 0, 0, 1, 0}, {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1}, {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, - {&__pyx_n_s_string_to_py, __pyx_k_string_to_py, sizeof(__pyx_k_string_to_py), 0, 0, 1, 1}, {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, {&__pyx_n_s_strptime, __pyx_k_strptime, sizeof(__pyx_k_strptime), 0, 0, 1, 1}, {&__pyx_n_s_synchronous, __pyx_k_synchronous, sizeof(__pyx_k_synchronous), 0, 0, 1, 1}, @@ -44284,7 +42045,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1}, {&__pyx_n_s_throughput, __pyx_k_throughput, sizeof(__pyx_k_throughput), 0, 0, 1, 1}, - {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1}, {&__pyx_kp_s_time_value_required_received, __pyx_k_time_value_required_received, sizeof(__pyx_k_time_value_required_received), 0, 0, 1, 0}, {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1}, @@ -44309,6 +42069,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, {&__pyx_n_s_user, __pyx_k_user, sizeof(__pyx_k_user), 0, 0, 1, 1}, {&__pyx_n_s_utcnow, __pyx_k_utcnow, sizeof(__pyx_k_utcnow), 0, 0, 1, 1}, + {&__pyx_n_s_utils, __pyx_k_utils, sizeof(__pyx_k_utils), 0, 0, 1, 1}, {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, {&__pyx_kp_u_when_getting_server_context_for, __pyx_k_when_getting_server_context_for, sizeof(__pyx_k_when_getting_server_context_for), 0, 1, 0, 0}, {&__pyx_kp_u_with, __pyx_k_with, sizeof(__pyx_k_with), 0, 1, 0, 0}, @@ -44318,11 +42079,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 228, __pyx_L1_error) - __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 32, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 217, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 672, __pyx_L1_error) + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 312, __pyx_L1_error) + __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 2231, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 301, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 1145, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -44338,7 +42099,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(3, 2, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); @@ -44347,241 +42108,152 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(3, 4, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "src/pyrfc/nwrfcsdk.pyx":376 + /* "pyrfc/_cyrfc.pyx":460 * raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") * if len(parameter_text)>79: * raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") # <<<<<<<<<<<<<< * self.parameters.append({ * 'name': name, */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_parameter_text_string_parameter); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 376, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_parameter_text_string_parameter); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "src/pyrfc/data_container.pyx":146 - * else: - * if len(value.rstrip()) > 0: - * date(int(value[:4]), int(value[4:6]), int(value[6:8])) # <<<<<<<<<<<<<< - * cValue = fillString(value) - * except Exception as ex: - */ - __pyx_slice__9 = PySlice_New(Py_None, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__9)) __PYX_ERR(4, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__9); - __Pyx_GIVEREF(__pyx_slice__9); - __pyx_slice__10 = PySlice_New(__pyx_int_4, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice__10)) __PYX_ERR(4, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__10); - __Pyx_GIVEREF(__pyx_slice__10); - __pyx_slice__11 = PySlice_New(__pyx_int_6, __pyx_int_8, Py_None); if (unlikely(!__pyx_slice__11)) __PYX_ERR(4, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__11); - __Pyx_GIVEREF(__pyx_slice__11); - - /* "src/pyrfc/data_container.pyx":167 - * else: - * if len(value.rstrip()) > 0: - * time(int(value[:2]), int(value[2:4]), int(value[4:6])) # <<<<<<<<<<<<<< - * cValue = fillString(value) - * except Exception as ex: - */ - __pyx_slice__12 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__12)) __PYX_ERR(4, 167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__12); - __Pyx_GIVEREF(__pyx_slice__12); - __pyx_slice__13 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__13)) __PYX_ERR(4, 167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__13); - __Pyx_GIVEREF(__pyx_slice__13); - - /* "src/pyrfc/data_container.pyx":212 - * if exception.message: # fixed length, exactly 512 chars - * # str = exception.message[0:512].ljust(512) - * str = exception.message[0:512] # <<<<<<<<<<<<<< - * sapuc = fillString(str) - * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) - */ - __pyx_slice__14 = PySlice_New(__pyx_int_0, __pyx_int_512, Py_None); if (unlikely(!__pyx_slice__14)) __PYX_ERR(4, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__14); - __Pyx_GIVEREF(__pyx_slice__14); - - /* "src/pyrfc/data_container.pyx":218 - * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR - * if exception.key: # fixed length, exactly 128 chars - * str = exception.key[0:128] # <<<<<<<<<<<<<< - * sapuc = fillString(str) - * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) - */ - __pyx_slice__15 = PySlice_New(__pyx_int_0, __pyx_int_128, Py_None); if (unlikely(!__pyx_slice__15)) __PYX_ERR(4, 218, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__15); - __Pyx_GIVEREF(__pyx_slice__15); - - /* "src/pyrfc/data_container.pyx":223 - * free(sapuc) - * if exception.msg_class: - * sapuc = fillString(exception.msg_class[0:20]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) - * free(sapuc) - */ - __pyx_slice__16 = PySlice_New(__pyx_int_0, __pyx_int_20, Py_None); if (unlikely(!__pyx_slice__16)) __PYX_ERR(4, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__16); - __Pyx_GIVEREF(__pyx_slice__16); - - /* "src/pyrfc/data_container.pyx":227 - * free(sapuc) - * if exception.msg_type: - * sapuc = fillString(exception.msg_type[0:1]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) - * free(sapuc) - */ - __pyx_slice__17 = PySlice_New(__pyx_int_0, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__17)) __PYX_ERR(4, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__17); - __Pyx_GIVEREF(__pyx_slice__17); - - /* "src/pyrfc/data_container.pyx":231 - * free(sapuc) - * if exception.msg_number: - * sapuc = fillString(exception.msg_number[0:3]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) - * free(sapuc) - */ - __pyx_slice__18 = PySlice_New(__pyx_int_0, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(4, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__18); - __Pyx_GIVEREF(__pyx_slice__18); - - /* "src/pyrfc/data_container.pyx":235 - * free(sapuc) - * if exception.msg_v1: - * sapuc = fillString(exception.msg_v1[0:50]) # <<<<<<<<<<<<<< - * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) - * free(sapuc) - */ - __pyx_slice__19 = PySlice_New(__pyx_int_0, __pyx_int_50, Py_None); if (unlikely(!__pyx_slice__19)) __PYX_ERR(4, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__19); - __Pyx_GIVEREF(__pyx_slice__19); - - /* "src/pyrfc/data_container.pyx":655 - * utcValue = wrapString(stringValue, resultLen) - * # replace the "," separator with "." - * return utcValue[:19]+'.'+utcValue[20:] # <<<<<<<<<<<<<< - * finally: - * free(stringValue) - */ - __pyx_slice__21 = PySlice_New(Py_None, __pyx_int_19, Py_None); if (unlikely(!__pyx_slice__21)) __PYX_ERR(4, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__21); - __Pyx_GIVEREF(__pyx_slice__21); - __pyx_slice__22 = PySlice_New(__pyx_int_20, Py_None, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(4, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__22); - __Pyx_GIVEREF(__pyx_slice__22); - - /* "src/pyrfc/client.pyx":126 + /* "pyrfc/_cyrfc.pyx":599 * raise RFCError(f"Connection configuration option '{k}' is not supported") * self.__config = {} * self.__config['dtime'] = config.get('dtime', False) # <<<<<<<<<<<<<< * self.__config['return_import_params'] = config.get('return_import_params', False) * self.__config['rstrip'] = config.get('rstrip', True) */ - __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_dtime, Py_False); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_tuple__8 = PyTuple_Pack(2, __pyx_n_s_dtime, Py_False); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "src/pyrfc/client.pyx":127 + /* "pyrfc/_cyrfc.pyx":600 * self.__config = {} * self.__config['dtime'] = config.get('dtime', False) * self.__config['return_import_params'] = config.get('return_import_params', False) # <<<<<<<<<<<<<< * self.__config['rstrip'] = config.get('rstrip', True) * self.__config['timeout'] = config.get('timeout', None) */ - __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_return_import_params, Py_False); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_return_import_params, Py_False); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 600, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "src/pyrfc/client.pyx":128 + /* "pyrfc/_cyrfc.pyx":601 * self.__config['dtime'] = config.get('dtime', False) * self.__config['return_import_params'] = config.get('return_import_params', False) * self.__config['rstrip'] = config.get('rstrip', True) # <<<<<<<<<<<<<< * self.__config['timeout'] = config.get('timeout', None) * */ - __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_rstrip, Py_True); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_rstrip, Py_True); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "src/pyrfc/client.pyx":129 + /* "pyrfc/_cyrfc.pyx":602 * self.__config['return_import_params'] = config.get('return_import_params', False) * self.__config['rstrip'] = config.get('rstrip', True) * self.__config['timeout'] = config.get('timeout', None) # <<<<<<<<<<<<<< * * # set internal configuration */ - __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_timeout, Py_None); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_timeout, Py_None); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); - /* "src/pyrfc/client.pyx":717 + /* "pyrfc/_cyrfc.pyx":1190 * if 'user' in attributes and attributes['user'] is not None: * # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. * sapuc = fillString(attributes['user'][0:12]) # <<<<<<<<<<<<<< * strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) * free(sapuc) */ - __pyx_slice__27 = PySlice_New(__pyx_int_0, __pyx_int_12, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(2, 717, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); + __pyx_slice__12 = PySlice_New(__pyx_int_0, __pyx_int_12, Py_None); if (unlikely(!__pyx_slice__12)) __PYX_ERR(0, 1190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__12); + __Pyx_GIVEREF(__pyx_slice__12); + + /* "pyrfc/_cyrfc.pyx":1195 + * if 'client' in attributes: + * # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". + * sapuc = fillString(attributes['client'][0:3]) # <<<<<<<<<<<<<< + * strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) + * free(sapuc) + */ + __pyx_slice__13 = PySlice_New(__pyx_int_0, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__13)) __PYX_ERR(0, 1195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__13); + __Pyx_GIVEREF(__pyx_slice__13); + + /* "pyrfc/_cyrfc.pyx":1200 + * if 't_code' in attributes: + * # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + * sapuc = fillString(attributes['t_code'][0:20]) # <<<<<<<<<<<<<< + * strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) + * free(sapuc) + */ + __pyx_slice__14 = PySlice_New(__pyx_int_0, __pyx_int_20, Py_None); if (unlikely(!__pyx_slice__14)) __PYX_ERR(0, 1200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__14); + __Pyx_GIVEREF(__pyx_slice__14); - /* "src/pyrfc/client.pyx":732 + /* "pyrfc/_cyrfc.pyx":1205 * if 'program' in attributes and attributes['program'] is not None: * # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. * sapuc = fillString(attributes['program'][0:40]) # <<<<<<<<<<<<<< * strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) * free(sapuc) */ - __pyx_slice__28 = PySlice_New(__pyx_int_0, __pyx_int_40, Py_None); if (unlikely(!__pyx_slice__28)) __PYX_ERR(2, 732, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__28); - __Pyx_GIVEREF(__pyx_slice__28); + __pyx_slice__15 = PySlice_New(__pyx_int_0, __pyx_int_40, Py_None); if (unlikely(!__pyx_slice__15)) __PYX_ERR(0, 1205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__15); + __Pyx_GIVEREF(__pyx_slice__15); - /* "src/pyrfc/client.pyx":915 + /* "pyrfc/_cyrfc.pyx":1388 * * if type(unit) is not dict or 'id' not in unit or 'background' not in unit: * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") # <<<<<<<<<<<<<< * if not isinstance(calls, Iterable): * raise TypeError("Parameter 'calls' must be iterable.") */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_Parameter_unit_not_valid_Please); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 915, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Parameter_unit_not_valid_Please); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 1388, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "src/pyrfc/client.pyx":917 + /* "pyrfc/_cyrfc.pyx":1390 * raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") * if not isinstance(calls, Iterable): * raise TypeError("Parameter 'calls' must be iterable.") # <<<<<<<<<<<<<< * if len(calls)==0: * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_Parameter_calls_must_be_iterable); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 917, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Parameter_calls_must_be_iterable); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 1390, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "src/pyrfc/client.pyx":919 + /* "pyrfc/_cyrfc.pyx":1392 * raise TypeError("Parameter 'calls' must be iterable.") * if len(calls)==0: * raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") # <<<<<<<<<<<<<< * for func_name, params in calls: * if type(func_name) is not str or type(params) is not dict: */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Parameter_calls_must_contain_at); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 919, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Parameter_calls_must_contain_at); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 1392, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "src/pyrfc/client.pyx":922 + /* "pyrfc/_cyrfc.pyx":1395 * for func_name, params in calls: * if type(func_name) is not str or type(params) is not dict: * raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") # <<<<<<<<<<<<<< * if self.active_unit: * raise RFCError("There is an active unit for this connection. " */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_Parameter_calls_must_contain_val); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 922, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Parameter_calls_must_contain_val); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 1395, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -44589,18 +42261,18 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_self__handle_self__tHandle_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(3, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_self__handle_self__tHandle_self); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); /* "(tree fragment)":4 * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self._handle,self._tHandle,self._uHandle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_self__handle_self__tHandle_self); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_self__handle_self__tHandle_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -44608,51 +42280,62 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("self._handle cannot be converted to a Python object for pickling") */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_self__handle_cannot_be_converted); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(3, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_self__handle_cannot_be_converted); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); /* "(tree fragment)":4 * raise TypeError("self._handle cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self._handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_self__handle_cannot_be_converted); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_self__handle_cannot_be_converted); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); - /* "src/pyrfc/server.pyx":292 + /* "pyrfc/_cyrfc.pyx":1705 + * return RFC_ABAP_EXCEPTION + * except Exception as ex: + * exctype, value = exc_info()[:2] # <<<<<<<<<<<<<< + * _server_log( + * "genericHandler", + */ + __pyx_slice__29 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__29)) __PYX_ERR(0, 1705, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__29); + __Pyx_GIVEREF(__pyx_slice__29); + + /* "pyrfc/_cyrfc.pyx":1772 * # config parsing * config = config or {} * self.debug = config.get('debug', False) # <<<<<<<<<<<<<< * self.rstrip = config.get('rstrip', True) * server_context["server_log"] = config.get("server_log", False) */ - __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_debug, Py_False); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(5, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_debug, Py_False); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 1772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); - /* "src/pyrfc/server.pyx":294 + /* "pyrfc/_cyrfc.pyx":1774 * self.debug = config.get('debug', False) * self.rstrip = config.get('rstrip', True) * server_context["server_log"] = config.get("server_log", False) # <<<<<<<<<<<<<< * server_context["auth_check"] = config.get("auth_check", default_auth_check) * server_context["port"] = config.get("port", 8080) */ - __pyx_tuple__42 = PyTuple_Pack(2, __pyx_n_s_server_log_2, Py_False); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(5, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_server_log_2, Py_False); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); - /* "src/pyrfc/server.pyx":296 + /* "pyrfc/_cyrfc.pyx":1776 * server_context["server_log"] = config.get("server_log", False) * server_context["auth_check"] = config.get("auth_check", default_auth_check) * server_context["port"] = config.get("port", 8080) # <<<<<<<<<<<<<< * * self._client_connection = Connection(**client_params) */ - __pyx_tuple__43 = PyTuple_Pack(2, __pyx_n_s_port, __pyx_int_8080); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(5, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_tuple__32 = PyTuple_Pack(2, __pyx_n_s_port, __pyx_int_8080); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -44660,18 +42343,18 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(3, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -44679,18 +42362,104 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") */ - __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_self__throughput_handle_cannot_b); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(3, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_self__throughput_handle_cannot_b); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); /* "(tree fragment)":4 * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self._throughput_handle cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ - __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_self__throughput_handle_cannot_b); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(3, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_self__throughput_handle_cannot_b); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + + /* "pyrfc/_cyrfc.pyx":2512 + * else: + * if len(value.rstrip()) > 0: + * date(int(value[:4]), int(value[4:6]), int(value[6:8])) # <<<<<<<<<<<<<< + * cValue = fillString(value) + * except Exception as ex: + */ + __pyx_slice__37 = PySlice_New(Py_None, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__37)) __PYX_ERR(0, 2512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__37); + __Pyx_GIVEREF(__pyx_slice__37); + __pyx_slice__38 = PySlice_New(__pyx_int_4, __pyx_int_6, Py_None); if (unlikely(!__pyx_slice__38)) __PYX_ERR(0, 2512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__38); + __Pyx_GIVEREF(__pyx_slice__38); + __pyx_slice__39 = PySlice_New(__pyx_int_6, __pyx_int_8, Py_None); if (unlikely(!__pyx_slice__39)) __PYX_ERR(0, 2512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__39); + __Pyx_GIVEREF(__pyx_slice__39); + + /* "pyrfc/_cyrfc.pyx":2533 + * else: + * if len(value.rstrip()) > 0: + * time(int(value[:2]), int(value[2:4]), int(value[4:6])) # <<<<<<<<<<<<<< + * cValue = fillString(value) + * except Exception as ex: + */ + __pyx_slice__40 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__40)) __PYX_ERR(0, 2533, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__40); + __Pyx_GIVEREF(__pyx_slice__40); + + /* "pyrfc/_cyrfc.pyx":2578 + * if exception.message: # fixed length, exactly 512 chars + * # str = exception.message[0:512].ljust(512) + * str = exception.message[0:512] # <<<<<<<<<<<<<< + * sapuc = fillString(str) + * strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) + */ + __pyx_slice__41 = PySlice_New(__pyx_int_0, __pyx_int_512, Py_None); if (unlikely(!__pyx_slice__41)) __PYX_ERR(0, 2578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__41); + __Pyx_GIVEREF(__pyx_slice__41); + + /* "pyrfc/_cyrfc.pyx":2584 + * errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + * if exception.key: # fixed length, exactly 128 chars + * str = exception.key[0:128] # <<<<<<<<<<<<<< + * sapuc = fillString(str) + * strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + */ + __pyx_slice__42 = PySlice_New(__pyx_int_0, __pyx_int_128, Py_None); if (unlikely(!__pyx_slice__42)) __PYX_ERR(0, 2584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__42); + __Pyx_GIVEREF(__pyx_slice__42); + + /* "pyrfc/_cyrfc.pyx":2593 + * free(sapuc) + * if exception.msg_type: + * sapuc = fillString(exception.msg_type[0:1]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + * free(sapuc) + */ + __pyx_slice__43 = PySlice_New(__pyx_int_0, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__43)) __PYX_ERR(0, 2593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__43); + __Pyx_GIVEREF(__pyx_slice__43); + + /* "pyrfc/_cyrfc.pyx":2601 + * free(sapuc) + * if exception.msg_v1: + * sapuc = fillString(exception.msg_v1[0:50]) # <<<<<<<<<<<<<< + * strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + * free(sapuc) + */ + __pyx_slice__44 = PySlice_New(__pyx_int_0, __pyx_int_50, Py_None); if (unlikely(!__pyx_slice__44)) __PYX_ERR(0, 2601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__44); + __Pyx_GIVEREF(__pyx_slice__44); + + /* "pyrfc/_cyrfc.pyx":3021 + * utcValue = wrapString(stringValue, resultLen) + * # replace the "," separator with "." + * return utcValue[:19]+'.'+utcValue[20:] # <<<<<<<<<<<<<< + * finally: + * free(stringValue) + */ + __pyx_slice__46 = PySlice_New(Py_None, __pyx_int_19, Py_None); if (unlikely(!__pyx_slice__46)) __PYX_ERR(0, 3021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__46); + __Pyx_GIVEREF(__pyx_slice__46); + __pyx_slice__47 = PySlice_New(__pyx_int_20, Py_None, Py_None); if (unlikely(!__pyx_slice__47)) __PYX_ERR(0, 3021, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__47); + __Pyx_GIVEREF(__pyx_slice__47); /* "cfunc.to_py":65 * @cname("__Pyx_CFunc_object____object___to_py") @@ -44699,289 +42468,242 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * """wrap(client_connection)""" * return f(client_connection) */ - __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_client_connection); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(3, 65, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_client_connection); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__48); __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(3, 65, __pyx_L1_error) + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_wrap, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(1, 65, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":12 + /* "pyrfc/_cyrfc.pyx":112 * * * def get_nwrfclib_version(): # <<<<<<<<<<<<<< * """Get SAP NW RFC Lib version * :returns: tuple of major, minor and patch level and OS platform */ - __pyx_tuple__51 = PyTuple_Pack(3, __pyx_n_s_major, __pyx_n_s_minor, __pyx_n_s_patchlevel); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_tuple__51 = PyTuple_Pack(3, __pyx_n_s_major, __pyx_n_s_minor, __pyx_n_s_patchlevel); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__51); __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_get_nwrfclib_version, 12, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_get_nwrfclib_version, 112, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 112, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":23 + /* "pyrfc/_cyrfc.pyx":123 * * * def set_ini_file_directory(path_name): # <<<<<<<<<<<<<< * """Sets the directory in which to search for the sapnwrfc.ini file * */ - __pyx_tuple__53 = PyTuple_Pack(4, __pyx_n_s_path_name, __pyx_n_s_errorInfo, __pyx_n_s_pathName, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_tuple__53 = PyTuple_Pack(4, __pyx_n_s_path_name, __pyx_n_s_errorInfo, __pyx_n_s_pathName, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__53); __Pyx_GIVEREF(__pyx_tuple__53); - __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_set_ini_file_directory, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_set_ini_file_directory, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 123, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":43 + /* "pyrfc/_cyrfc.pyx":143 * * * def reload_ini_file(): # <<<<<<<<<<<<<< * """Reloads the contents of the sapnwrfc.ini file into memory. * */ - __pyx_tuple__55 = PyTuple_Pack(2, __pyx_n_s_errorInfo, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_tuple__55 = PyTuple_Pack(2, __pyx_n_s_errorInfo, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__55); __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_reload_ini_file, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_reload_ini_file, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 143, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":62 + /* "pyrfc/_cyrfc.pyx":162 * * * def language_iso_to_sap(lang_iso): # <<<<<<<<<<<<<< * """Language code conversion of ISO code to SAP code. * */ - __pyx_tuple__57 = PyTuple_Pack(5, __pyx_n_s_lang_iso, __pyx_n_s_uclang_iso, __pyx_n_s_uclang_sap, __pyx_n_s_errorInfo, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_tuple__57 = PyTuple_Pack(5, __pyx_n_s_lang_iso, __pyx_n_s_uclang_iso, __pyx_n_s_uclang_sap, __pyx_n_s_errorInfo, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__57); __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_language_iso_to_sap, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_language_iso_to_sap, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 162, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":83 + /* "pyrfc/_cyrfc.pyx":183 * * * def language_sap_to_iso(lang_sap): # <<<<<<<<<<<<<< * """Language code conversion of SAP code to ISO code. * */ - __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_lang_sap, __pyx_n_s_uclang_sap, __pyx_n_s_uclang_iso, __pyx_n_s_errorInfo, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_lang_sap, __pyx_n_s_uclang_sap, __pyx_n_s_uclang_iso, __pyx_n_s_errorInfo, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__59); __Pyx_GIVEREF(__pyx_tuple__59); - __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_language_sap_to_iso, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_language_sap_to_iso, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 183, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":104 + /* "pyrfc/_cyrfc.pyx":204 * * * def set_cryptolib_path(path_name): # <<<<<<<<<<<<<< * """Sets the absolute path to the sapcrypto library to enable TLS encryption via Websocket Rfc. * */ - __pyx_tuple__61 = PyTuple_Pack(4, __pyx_n_s_path_name, __pyx_n_s_errorInfo, __pyx_n_s_pathName, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_tuple__61 = PyTuple_Pack(4, __pyx_n_s_path_name, __pyx_n_s_errorInfo, __pyx_n_s_pathName, __pyx_n_s_rc); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__61); __Pyx_GIVEREF(__pyx_tuple__61); - __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_set_cryptolib_path, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_set_cryptolib_path, 204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 204, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":128 + /* "pyrfc/_cyrfc.pyx":228 * * * def set_locale_radix(value=None): # <<<<<<<<<<<<<< * """Sets the locale radix for decimal conversions. * */ - __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_value); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_value); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__63); __Pyx_GIVEREF(__pyx_tuple__63); - __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_set_locale_radix, 128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_set_locale_radix, 228, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 228, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":152 + /* "pyrfc/_cyrfc.pyx":252 * * * def cancel_connection(client_connection): # <<<<<<<<<<<<<< * """Immediately cancels the RFC call which is currently being called over the given RFC connection * and closes the connection. Can be used only on an RFC client connection. */ - __pyx_tuple__65 = PyTuple_Pack(1, __pyx_n_s_client_connection); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_tuple__65 = PyTuple_Pack(1, __pyx_n_s_client_connection); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__65); __Pyx_GIVEREF(__pyx_tuple__65); - __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_cancel_connection, 152, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_cancel_connection, 252, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 252, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":169 - * - * - * def enum_names(enum_obj): # <<<<<<<<<<<<<< - * return set(e.name for e in enum_obj) - * - */ - __pyx_tuple__67 = PyTuple_Pack(3, __pyx_n_s_enum_obj, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__67); - __Pyx_GIVEREF(__pyx_tuple__67); - __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_enum_names, 169, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 169, __pyx_L1_error) - - /* "src/pyrfc/nwrfcsdk.pyx":173 - * - * - * def enum_values(enum_obj): # <<<<<<<<<<<<<< - * return set(e.value for e in enum_obj) - * - */ - __pyx_tuple__69 = PyTuple_Pack(3, __pyx_n_s_enum_obj, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__69); - __Pyx_GIVEREF(__pyx_tuple__69); - __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_enum_values, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 173, __pyx_L1_error) - - /* "src/pyrfc/nwrfcsdk.pyx":177 - * - * - * def py_to_string(obj): # <<<<<<<<<<<<<< - * return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) - * - */ - __pyx_tuple__71 = PyTuple_Pack(1, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__71); - __Pyx_GIVEREF(__pyx_tuple__71); - __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_py_to_string, 177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 177, __pyx_L1_error) - - /* "src/pyrfc/nwrfcsdk.pyx":181 - * - * - * def string_to_py(objstr): # <<<<<<<<<<<<<< - * return pickle.loads(objstr) - * - */ - __pyx_tuple__73 = PyTuple_Pack(1, __pyx_n_s_objstr); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__73); - __Pyx_GIVEREF(__pyx_tuple__73); - __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_string_to_py, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 181, __pyx_L1_error) - - /* "src/pyrfc/nwrfcsdk.pyx":228 + /* "pyrfc/_cyrfc.pyx":312 * * * class TypeDescription(object): # <<<<<<<<<<<<<< * """ A type description * */ - __pyx_tuple__75 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__75); - __Pyx_GIVEREF(__pyx_tuple__75); + __pyx_tuple__67 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__67); + __Pyx_GIVEREF(__pyx_tuple__67); - /* "src/pyrfc/nwrfcsdk.pyx":253 + /* "pyrfc/_cyrfc.pyx":337 * * """ * def __init__(self, name, nuc_length, uc_length): # <<<<<<<<<<<<<< * self.fields = [] * if len(name)<1 or len(name)>30: */ - __pyx_tuple__76 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_nuc_length, __pyx_n_s_uc_length, __pyx_n_s_int_field); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__76); - __Pyx_GIVEREF(__pyx_tuple__76); - __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_init, 253, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_tuple__68 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_nuc_length, __pyx_n_s_uc_length, __pyx_n_s_int_field); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 337, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__68); + __Pyx_GIVEREF(__pyx_tuple__68); + __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_init, 337, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 337, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":264 + /* "pyrfc/_cyrfc.pyx":348 * self.uc_length = uc_length * * def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, # <<<<<<<<<<<<<< * uc_offset, decimals=0, type_description=None): * """ Adds a field to the type description. */ - __pyx_tuple__78 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_field_type, __pyx_n_s_nuc_length, __pyx_n_s_uc_length, __pyx_n_s_nuc_offset, __pyx_n_s_uc_offset, __pyx_n_s_decimals, __pyx_n_s_type_description, __pyx_n_s_int_field); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 264, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__78); - __Pyx_GIVEREF(__pyx_tuple__78); - __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(9, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_add_field, 264, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 264, __pyx_L1_error) - __pyx_tuple__80 = PyTuple_Pack(2, ((PyObject *)__pyx_int_0), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 264, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__80); - __Pyx_GIVEREF(__pyx_tuple__80); + __pyx_tuple__70 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_field_type, __pyx_n_s_nuc_length, __pyx_n_s_uc_length, __pyx_n_s_nuc_offset, __pyx_n_s_uc_offset, __pyx_n_s_decimals, __pyx_n_s_type_description, __pyx_n_s_int_field); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__70); + __Pyx_GIVEREF(__pyx_tuple__70); + __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(9, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_add_field, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_tuple__72 = PyTuple_Pack(2, ((PyObject *)__pyx_int_0), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__72); + __Pyx_GIVEREF(__pyx_tuple__72); - /* "src/pyrfc/nwrfcsdk.pyx":305 + /* "pyrfc/_cyrfc.pyx":389 * }) * * def __repr__(self): # <<<<<<<<<<<<<< * return f"" */ - __pyx_tuple__81 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__81); - __Pyx_GIVEREF(__pyx_tuple__81); - __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_repr, 305, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 305, __pyx_L1_error) + __pyx_tuple__73 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__73); + __Pyx_GIVEREF(__pyx_tuple__73); + __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_repr, 389, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 389, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":314 + /* "pyrfc/_cyrfc.pyx":398 * * * class FunctionDescription(object): # <<<<<<<<<<<<<< * """ A function description * */ - __pyx_tuple__83 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 314, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__83); - __Pyx_GIVEREF(__pyx_tuple__83); + __pyx_tuple__75 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__75); + __Pyx_GIVEREF(__pyx_tuple__75); - /* "src/pyrfc/nwrfcsdk.pyx":337 + /* "pyrfc/_cyrfc.pyx":421 * * """ * def __init__(self, name): # <<<<<<<<<<<<<< * self.name = name * self.parameters = [] */ - __pyx_tuple__84 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_name); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 337, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__84); - __Pyx_GIVEREF(__pyx_tuple__84); - __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_init, 337, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_tuple__76 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_name); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__76); + __Pyx_GIVEREF(__pyx_tuple__76); + __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_init, 421, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 421, __pyx_L1_error) - /* "src/pyrfc/nwrfcsdk.pyx":341 + /* "pyrfc/_cyrfc.pyx":425 * self.parameters = [] * * def add_parameter(self, name, parameter_type, direction, nuc_length, # <<<<<<<<<<<<<< * uc_length, decimals=0, default_value="", parameter_text="", * optional=False, type_description=None): */ - __pyx_tuple__86 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_parameter_type, __pyx_n_s_direction, __pyx_n_s_nuc_length, __pyx_n_s_uc_length, __pyx_n_s_decimals, __pyx_n_s_default_value, __pyx_n_s_parameter_text, __pyx_n_s_optional, __pyx_n_s_type_description); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__86); - __Pyx_GIVEREF(__pyx_tuple__86); - __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(11, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_add_parameter, 341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 341, __pyx_L1_error) - __pyx_tuple__88 = PyTuple_Pack(5, ((PyObject *)__pyx_int_0), ((PyObject*)__pyx_kp_s__5), ((PyObject*)__pyx_kp_s__5), ((PyObject *)Py_False), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 341, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__88); - __Pyx_GIVEREF(__pyx_tuple__88); + __pyx_tuple__78 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_parameter_type, __pyx_n_s_direction, __pyx_n_s_nuc_length, __pyx_n_s_uc_length, __pyx_n_s_decimals, __pyx_n_s_default_value, __pyx_n_s_parameter_text, __pyx_n_s_optional, __pyx_n_s_type_description); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__78); + __Pyx_GIVEREF(__pyx_tuple__78); + __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(11, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_add_parameter, 425, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_tuple__80 = PyTuple_Pack(5, ((PyObject *)__pyx_int_0), ((PyObject*)__pyx_kp_s__5), ((PyObject*)__pyx_kp_s__5), ((PyObject *)Py_False), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__80); + __Pyx_GIVEREF(__pyx_tuple__80); - /* "src/pyrfc/nwrfcsdk.pyx":390 + /* "pyrfc/_cyrfc.pyx":474 * }) * * def __repr__(self): # <<<<<<<<<<<<<< * return f"" + * */ - __pyx_tuple__89 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__89); - __Pyx_GIVEREF(__pyx_tuple__89); - __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_nwrfcsdk_pyx, __pyx_n_s_repr, 390, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_tuple__81 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 474, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__81); + __Pyx_GIVEREF(__pyx_tuple__81); + __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_repr, 474, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 474, __pyx_L1_error) - /* "src/pyrfc/server.pyx":21 + /* "pyrfc/_cyrfc.pyx":1501 * * * def default_auth_check(func_name=False, request_context = None): # <<<<<<<<<<<<<< * request_context = request_context or {} * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) */ - __pyx_tuple__91 = PyTuple_Pack(2, __pyx_n_s_func_name, __pyx_n_s_request_context); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(5, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__91); - __Pyx_GIVEREF(__pyx_tuple__91); - __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_server_pyx, __pyx_n_s_default_auth_check, 21, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(5, 21, __pyx_L1_error) + __pyx_tuple__83 = PyTuple_Pack(2, __pyx_n_s_func_name, __pyx_n_s_request_context); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 1501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__83); + __Pyx_GIVEREF(__pyx_tuple__83); + __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_default_auth_check, 1501, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 1501, __pyx_L1_error) - /* "src/pyrfc/server.pyx":27 + /* "pyrfc/_cyrfc.pyx":1507 * * * def _server_log(origin, log_message): # <<<<<<<<<<<<<< * if server_context["server_log"]: * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") */ - __pyx_tuple__93 = PyTuple_Pack(2, __pyx_n_s_origin, __pyx_n_s_log_message); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(5, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__93); - __Pyx_GIVEREF(__pyx_tuple__93); - __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_server_pyx, __pyx_n_s_server_log, 27, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) __PYX_ERR(5, 27, __pyx_L1_error) + __pyx_tuple__85 = PyTuple_Pack(2, __pyx_n_s_origin, __pyx_n_s_log_message); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 1507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__85); + __Pyx_GIVEREF(__pyx_tuple__85); + __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_server_log, 1507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 1507, __pyx_L1_error) - /* "src/pyrfc/throughput.pyx":66 + /* "pyrfc/_cyrfc.pyx":2232 * * @staticmethod * def getFromConnection(Connection connection): # <<<<<<<<<<<<<< * """Returns the currently attached throughput object from a connection, if any. * */ - __pyx_tuple__95 = PyTuple_Pack(4, __pyx_n_s_connection, __pyx_n_s_errorInfo, __pyx_n_s_throughput, __pyx_n_s_t); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__95); - __Pyx_GIVEREF(__pyx_tuple__95); - __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc_throughput_pyx, __pyx_n_s_getFromConnection, 66, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) __PYX_ERR(1, 66, __pyx_L1_error) + __pyx_tuple__87 = PyTuple_Pack(4, __pyx_n_s_connection, __pyx_n_s_errorInfo, __pyx_n_s_throughput, __pyx_n_s_t); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 2232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__87); + __Pyx_GIVEREF(__pyx_tuple__87); + __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pyrfc__cyrfc_pyx, __pyx_n_s_getFromConnection, 2232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 2232, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -44991,29 +42713,29 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_19 = PyInt_FromLong(19); if (unlikely(!__pyx_int_19)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_45 = PyInt_FromLong(45); if (unlikely(!__pyx_int_45)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_8080 = PyInt_FromLong(8080); if (unlikely(!__pyx_int_8080)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(6, 1, __pyx_L1_error) + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_17 = PyInt_FromLong(17); if (unlikely(!__pyx_int_17)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_19 = PyInt_FromLong(19); if (unlikely(!__pyx_int_19)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_45 = PyInt_FromLong(45); if (unlikely(!__pyx_int_45)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_8080 = PyInt_FromLong(8080); if (unlikely(!__pyx_int_8080)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -45058,44 +42780,44 @@ static int __Pyx_modinit_type_init_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters) < 0) __PYX_ERR(0, 190, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters) < 0) __PYX_ERR(0, 274, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_5pyrfc_6_cyrfc_ConnectionParameters.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc_ConnectionParameters.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_5pyrfc_6_cyrfc_ConnectionParameters.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ConnectionParameters, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters) < 0) __PYX_ERR(0, 190, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters) < 0) __PYX_ERR(0, 190, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ConnectionParameters, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters) < 0) __PYX_ERR(0, 274, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters) < 0) __PYX_ERR(0, 274, __pyx_L1_error) __pyx_ptype_5pyrfc_6_cyrfc_ConnectionParameters = &__pyx_type_5pyrfc_6_cyrfc_ConnectionParameters; __pyx_vtabptr_5pyrfc_6_cyrfc_Connection = &__pyx_vtable_5pyrfc_6_cyrfc_Connection; __pyx_vtable_5pyrfc_6_cyrfc_Connection._reopen = (PyObject *(*)(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *))__pyx_f_5pyrfc_6_cyrfc_10Connection__reopen; __pyx_vtable_5pyrfc_6_cyrfc_Connection._open = (PyObject *(*)(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *))__pyx_f_5pyrfc_6_cyrfc_10Connection__open; __pyx_vtable_5pyrfc_6_cyrfc_Connection._error = (PyObject *(*)(struct __pyx_obj_5pyrfc_6_cyrfc_Connection *, RFC_ERROR_INFO *))__pyx_f_5pyrfc_6_cyrfc_10Connection__error; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(2, 25, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(0, 498, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_5pyrfc_6_cyrfc_Connection.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc_Connection.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc_Connection.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_5pyrfc_6_cyrfc_Connection.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_Connection.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(2, 25, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Connection, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(2, 25, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(2, 25, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_Connection.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(0, 498, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Connection, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(0, 498, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_Connection) < 0) __PYX_ERR(0, 498, __pyx_L1_error) __pyx_ptype_5pyrfc_6_cyrfc_Connection = &__pyx_type_5pyrfc_6_cyrfc_Connection; __pyx_vtabptr_5pyrfc_6_cyrfc_ServerConnection = &__pyx_vtable_5pyrfc_6_cyrfc_ServerConnection; __pyx_vtable_5pyrfc_6_cyrfc_ServerConnection._open = (PyObject *(*)(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *))__pyx_f_5pyrfc_6_cyrfc_16ServerConnection__open; __pyx_vtable_5pyrfc_6_cyrfc_ServerConnection._close = (PyObject *(*)(struct __pyx_obj_5pyrfc_6_cyrfc_ServerConnection *))__pyx_f_5pyrfc_6_cyrfc_16ServerConnection__close; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(5, 32, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(0, 1512, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_5pyrfc_6_cyrfc_ServerConnection.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc_ServerConnection.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc_ServerConnection.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_5pyrfc_6_cyrfc_ServerConnection.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_ServerConnection.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(5, 32, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerConnection, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(5, 32, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(5, 32, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_ServerConnection.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(0, 1512, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ServerConnection, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(0, 1512, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_ServerConnection) < 0) __PYX_ERR(0, 1512, __pyx_L1_error) __pyx_ptype_5pyrfc_6_cyrfc_ServerConnection = &__pyx_type_5pyrfc_6_cyrfc_ServerConnection; __pyx_vtabptr_5pyrfc_6_cyrfc_Server = &__pyx_vtable_5pyrfc_6_cyrfc_Server; __pyx_vtable_5pyrfc_6_cyrfc_Server.__pyx___onCheckFunction = (RFC_RC (*)(RFC_CONNECTION_HANDLE, RFC_UNIT_IDENTIFIER const *))__pyx_f_5pyrfc_6_cyrfc_6Server___onCheckFunction; @@ -45104,63 +42826,31 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_5pyrfc_6_cyrfc_Server.__pyx___onConfirmFunction = (RFC_RC (*)(RFC_CONNECTION_HANDLE, RFC_UNIT_IDENTIFIER const *))__pyx_f_5pyrfc_6_cyrfc_6Server___onConfirmFunction; __pyx_vtable_5pyrfc_6_cyrfc_Server.__pyx___onGetStateFunction = (RFC_RC (*)(RFC_CONNECTION_HANDLE, RFC_UNIT_IDENTIFIER const *, RFC_UNIT_STATE *))__pyx_f_5pyrfc_6_cyrfc_6Server___onGetStateFunction; __pyx_vtable_5pyrfc_6_cyrfc_Server._error = (PyObject *(*)(struct __pyx_obj_5pyrfc_6_cyrfc_Server *, RFC_ERROR_INFO *))__pyx_f_5pyrfc_6_cyrfc_6Server__error; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(5, 243, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(0, 1723, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_5pyrfc_6_cyrfc_Server.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc_Server.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc_Server.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_5pyrfc_6_cyrfc_Server.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_Server.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(5, 243, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Server, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(5, 243, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(5, 243, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_Server.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(0, 1723, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Server, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(0, 1723, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_Server) < 0) __PYX_ERR(0, 1723, __pyx_L1_error) __pyx_ptype_5pyrfc_6_cyrfc_Server = &__pyx_type_5pyrfc_6_cyrfc_Server; __pyx_vtabptr_5pyrfc_6_cyrfc_Throughput = &__pyx_vtable_5pyrfc_6_cyrfc_Throughput; __pyx_vtable_5pyrfc_6_cyrfc_Throughput._destroy = (PyObject *(*)(struct __pyx_obj_5pyrfc_6_cyrfc_Throughput *))__pyx_f_5pyrfc_6_cyrfc_10Throughput__destroy; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(1, 6, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(0, 2172, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_5pyrfc_6_cyrfc_Throughput.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc_Throughput.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc_Throughput.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_5pyrfc_6_cyrfc_Throughput.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_Throughput.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(1, 6, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Throughput, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(1, 6, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(1, 6, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_5pyrfc_6_cyrfc_Throughput.tp_dict, __pyx_vtabptr_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(0, 2172, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Throughput, (PyObject *)&__pyx_type_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(0, 2172, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5pyrfc_6_cyrfc_Throughput) < 0) __PYX_ERR(0, 2172, __pyx_L1_error) __pyx_ptype_5pyrfc_6_cyrfc_Throughput = &__pyx_type_5pyrfc_6_cyrfc_Throughput; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names) < 0) __PYX_ERR(0, 169, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names = &__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct__enum_names; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 170, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr = &__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_1_genexpr; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values) < 0) __PYX_ERR(0, 173, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values = &__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_2_enum_values; - if (PyType_Ready(&__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 174, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr.tp_dictoffset && __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } - __pyx_ptype_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr = &__pyx_type_5pyrfc_6_cyrfc___pyx_scope_struct_3_genexpr; - if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_object____object___to_py) < 0) __PYX_ERR(3, 64, __pyx_L1_error) + if (PyType_Ready(&__pyx_scope_struct____Pyx_CFunc_object____object___to_py) < 0) __PYX_ERR(1, 64, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_scope_struct____Pyx_CFunc_object____object___to_py.tp_print = 0; #endif @@ -45322,30 +43012,30 @@ if (!__Pyx_RefNanny) { } #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__cyrfc(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + 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(6, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(6, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(6, 1, __pyx_L1_error) + __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(6, 1, __pyx_L1_error) + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -45362,708 +43052,912 @@ if (!__Pyx_RefNanny) { #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (unlikely(!__pyx_m)) __PYX_ERR(6, 1, __pyx_L1_error) + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(6, 1, __pyx_L1_error) + __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(6, 1, __pyx_L1_error) + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(6, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(6, 1, __pyx_L1_error) + 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(6, 1, __pyx_L1_error) + 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(6, 1, __pyx_L1_error) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_pyrfc___cyrfc) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(6, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __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(6, 1, __pyx_L1_error) + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "pyrfc._cyrfc")) { - if (unlikely(PyDict_SetItemString(modules, "pyrfc._cyrfc", __pyx_m) < 0)) __PYX_ERR(6, 1, __pyx_L1_error) + if (unlikely(PyDict_SetItemString(modules, "pyrfc._cyrfc", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(6, 1, __pyx_L1_error) + 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(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(6, 1, __pyx_L1_error) + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) (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(6, 1, __pyx_L1_error) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "pyrfc/_cyrfc.pyx":11 - * - * from . csapnwrfc cimport * - * from . _exception import * # <<<<<<<<<<<<<< - * - * include "config.pyx" + /* "pyrfc/_cyrfc.pyx":9 + * from libc.stdlib cimport malloc, free + * from libc.stdint cimport uintptr_t + * from collections.abc import Iterable # <<<<<<<<<<<<<< + * from datetime import date, time, datetime + * from decimal import Decimal */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 11, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s__50); - __Pyx_GIVEREF(__pyx_n_s__50); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__50); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_exception, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 11, __pyx_L1_error) + __Pyx_INCREF(__pyx_n_s_Iterable); + __Pyx_GIVEREF(__pyx_n_s_Iterable); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Iterable); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_import_star(__pyx_t_2) < 0) __PYX_ERR(6, 11, __pyx_L1_error); + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/config.pyx":1 - * from locale import localeconv # <<<<<<<<<<<<<< + /* "pyrfc/_cyrfc.pyx":10 + * from libc.stdint cimport uintptr_t + * from collections.abc import Iterable + * from datetime import date, time, datetime # <<<<<<<<<<<<<< + * from decimal import Decimal * from enum import Enum, auto - * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1, __pyx_L1_error) + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_localeconv); - __Pyx_GIVEREF(__pyx_n_s_localeconv); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_localeconv); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_locale, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 1, __pyx_L1_error) + __Pyx_INCREF(__pyx_n_s_date); + __Pyx_GIVEREF(__pyx_n_s_date); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_date); + __Pyx_INCREF(__pyx_n_s_time); + __Pyx_GIVEREF(__pyx_n_s_time); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_time); + __Pyx_INCREF(__pyx_n_s_datetime); + __Pyx_GIVEREF(__pyx_n_s_datetime); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_datetime); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_localeconv); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 1, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_date, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_localeconv, __pyx_t_2) < 0) __PYX_ERR(7, 1, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/config.pyx":2 + /* "pyrfc/_cyrfc.pyx":11 + * from collections.abc import Iterable + * from datetime import date, time, datetime + * from decimal import Decimal # <<<<<<<<<<<<<< + * from enum import Enum, auto * from locale import localeconv - * from enum import Enum, auto # <<<<<<<<<<<<<< - * - * ################################################################################ */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 2, __pyx_L1_error) + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_Decimal); + __Pyx_GIVEREF(__pyx_n_s_Decimal); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Decimal); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_decimal, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Decimal, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":12 + * from datetime import date, time, datetime + * from decimal import Decimal + * from enum import Enum, auto # <<<<<<<<<<<<<< + * from locale import localeconv + * from os.path import isfile, join + */ + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_Enum); __Pyx_GIVEREF(__pyx_n_s_Enum); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Enum); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Enum); __Pyx_INCREF(__pyx_n_s_auto); __Pyx_GIVEREF(__pyx_n_s_auto); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_auto); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 2, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_auto); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_auto); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_auto, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":13 + * from decimal import Decimal + * from enum import Enum, auto + * from locale import localeconv # <<<<<<<<<<<<<< + * from os.path import isfile, join + * from sys import exc_info, platform + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_localeconv); + __Pyx_GIVEREF(__pyx_n_s_localeconv); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_localeconv); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_locale, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_localeconv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_1) < 0) __PYX_ERR(7, 2, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_localeconv, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_auto); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":14 + * from enum import Enum, auto + * from locale import localeconv + * from os.path import isfile, join # <<<<<<<<<<<<<< + * from sys import exc_info, platform + * import socket + */ + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_isfile); + __Pyx_GIVEREF(__pyx_n_s_isfile); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_isfile); + __Pyx_INCREF(__pyx_n_s_join); + __Pyx_GIVEREF(__pyx_n_s_join); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_join); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_os_path, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_auto, __pyx_t_1) < 0) __PYX_ERR(7, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_isfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_isfile, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_join, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":15 + * from locale import localeconv + * from os.path import isfile, join + * from sys import exc_info, platform # <<<<<<<<<<<<<< + * import socket + * from threading import Thread, Timer + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_exc_info); + __Pyx_GIVEREF(__pyx_n_s_exc_info); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_exc_info); + __Pyx_INCREF(__pyx_n_s_platform); + __Pyx_GIVEREF(__pyx_n_s_platform); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_platform); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_exc_info, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_platform); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_platform, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/config.pyx":9 + /* "pyrfc/_cyrfc.pyx":16 + * from os.path import isfile, join + * from sys import exc_info, platform + * import socket # <<<<<<<<<<<<<< + * from threading import Thread, Timer + * + */ + __pyx_t_2 = __Pyx_Import(__pyx_n_s_socket, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":17 + * from sys import exc_info, platform + * import socket + * from threading import Thread, Timer # <<<<<<<<<<<<<< + * + * from . csapnwrfc cimport * + */ + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_Thread); + __Pyx_GIVEREF(__pyx_n_s_Thread); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Thread); + __Pyx_INCREF(__pyx_n_s_Timer); + __Pyx_GIVEREF(__pyx_n_s_Timer); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Timer); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Thread, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Timer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timer, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":20 + * + * from . csapnwrfc cimport * + * from . _exception import * # <<<<<<<<<<<<<< + * from . _utils import enum_names, enum_values + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s__50); + __Pyx_GIVEREF(__pyx_n_s__50); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__50); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_exception, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_import_star(__pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyrfc/_cyrfc.pyx":21 + * from . csapnwrfc cimport * + * from . _exception import * + * from . _utils import enum_names, enum_values # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_enum_names); + __Pyx_GIVEREF(__pyx_n_s_enum_names); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_enum_names); + __Pyx_INCREF(__pyx_n_s_enum_values); + __Pyx_GIVEREF(__pyx_n_s_enum_values); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_enum_values); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_utils, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_enum_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum_names, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_enum_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum_values, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyrfc/_cyrfc.pyx":29 * * # configuration bitmasks, internal use * _MASK_DTIME = 0x01 # <<<<<<<<<<<<<< * _MASK_RETURN_IMPORT_PARAMS = 0x02 * _MASK_RSTRIP = 0x04 */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MASK_DTIME, __pyx_int_1) < 0) __PYX_ERR(7, 9, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MASK_DTIME, __pyx_int_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error) - /* "src/pyrfc/config.pyx":10 + /* "pyrfc/_cyrfc.pyx":30 * # configuration bitmasks, internal use * _MASK_DTIME = 0x01 * _MASK_RETURN_IMPORT_PARAMS = 0x02 # <<<<<<<<<<<<<< * _MASK_RSTRIP = 0x04 * */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MASK_RETURN_IMPORT_PARAMS, __pyx_int_2) < 0) __PYX_ERR(7, 10, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MASK_RETURN_IMPORT_PARAMS, __pyx_int_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error) - /* "src/pyrfc/config.pyx":11 + /* "pyrfc/_cyrfc.pyx":31 * _MASK_DTIME = 0x01 * _MASK_RETURN_IMPORT_PARAMS = 0x02 * _MASK_RSTRIP = 0x04 # <<<<<<<<<<<<<< * * _LOCALE_RADIX = localeconv()["decimal_point"] */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MASK_RSTRIP, __pyx_int_4) < 0) __PYX_ERR(7, 11, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MASK_RSTRIP, __pyx_int_4) < 0) __PYX_ERR(0, 31, __pyx_L1_error) - /* "src/pyrfc/config.pyx":13 + /* "pyrfc/_cyrfc.pyx":33 * _MASK_RSTRIP = 0x04 * * _LOCALE_RADIX = localeconv()["decimal_point"] # <<<<<<<<<<<<<< * * ################################################################################ */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_localeconv); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 13, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_localeconv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_decimal_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 13, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOCALE_RADIX, __pyx_t_2) < 0) __PYX_ERR(7, 13, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_s_decimal_point); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOCALE_RADIX, __pyx_t_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/config.pyx":21 + /* "pyrfc/_cyrfc.pyx":41 * * # RFC parameter direction * class RfcParameterDirection(Enum): # <<<<<<<<<<<<<< * RFC_IMPORT = RFC_DIRECTION.RFC_IMPORT * RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 21, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 21, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_RfcParameterDirection, __pyx_n_s_RfcParameterDirection, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 21, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_RfcParameterDirection, __pyx_n_s_RfcParameterDirection, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "src/pyrfc/config.pyx":22 + /* "pyrfc/_cyrfc.pyx":42 * # RFC parameter direction * class RfcParameterDirection(Enum): * RFC_IMPORT = RFC_DIRECTION.RFC_IMPORT # <<<<<<<<<<<<<< * RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT * RFC_CHANGING = RFC_DIRECTION.RFC_CHANGING */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_IMPORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 22, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_IMPORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_IMPORT, __pyx_t_4) < 0) __PYX_ERR(7, 22, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_IMPORT, __pyx_t_4) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":23 + /* "pyrfc/_cyrfc.pyx":43 * class RfcParameterDirection(Enum): * RFC_IMPORT = RFC_DIRECTION.RFC_IMPORT * RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT # <<<<<<<<<<<<<< * RFC_CHANGING = RFC_DIRECTION.RFC_CHANGING * RFC_TABLES = RFC_DIRECTION.RFC_TABLES */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_EXPORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 23, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_EXPORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_EXPORT, __pyx_t_4) < 0) __PYX_ERR(7, 23, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_EXPORT, __pyx_t_4) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":24 + /* "pyrfc/_cyrfc.pyx":44 * RFC_IMPORT = RFC_DIRECTION.RFC_IMPORT * RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT * RFC_CHANGING = RFC_DIRECTION.RFC_CHANGING # <<<<<<<<<<<<<< * RFC_TABLES = RFC_DIRECTION.RFC_TABLES * */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_CHANGING); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 24, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_CHANGING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_CHANGING, __pyx_t_4) < 0) __PYX_ERR(7, 24, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_CHANGING, __pyx_t_4) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":25 + /* "pyrfc/_cyrfc.pyx":45 * RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT * RFC_CHANGING = RFC_DIRECTION.RFC_CHANGING * RFC_TABLES = RFC_DIRECTION.RFC_TABLES # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_TABLES); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 25, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_DIRECTION(RFC_TABLES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_TABLES, __pyx_t_4) < 0) __PYX_ERR(7, 25, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_TABLES, __pyx_t_4) < 0) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":21 + /* "pyrfc/_cyrfc.pyx":41 * * # RFC parameter direction * class RfcParameterDirection(Enum): # <<<<<<<<<<<<<< * RFC_IMPORT = RFC_DIRECTION.RFC_IMPORT * RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_RfcParameterDirection, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 21, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_RfcParameterDirection, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_RfcParameterDirection, __pyx_t_4) < 0) __PYX_ERR(7, 21, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_RfcParameterDirection, __pyx_t_4) < 0) __PYX_ERR(0, 41, __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; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/config.pyx":29 + /* "pyrfc/_cyrfc.pyx":49 * * # RFC field type * class RfcFieldType(Enum): # <<<<<<<<<<<<<< * RFCTYPE_CHAR = RFCTYPE.RFCTYPE_CHAR * RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 29, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 29, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_RfcFieldType, __pyx_n_s_RfcFieldType, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 29, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_RfcFieldType, __pyx_n_s_RfcFieldType, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "src/pyrfc/config.pyx":30 + /* "pyrfc/_cyrfc.pyx":50 * # RFC field type * class RfcFieldType(Enum): * RFCTYPE_CHAR = RFCTYPE.RFCTYPE_CHAR # <<<<<<<<<<<<<< * RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE * RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_CHAR); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 30, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_CHAR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_CHAR, __pyx_t_4) < 0) __PYX_ERR(7, 30, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_CHAR, __pyx_t_4) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":31 + /* "pyrfc/_cyrfc.pyx":51 * class RfcFieldType(Enum): * RFCTYPE_CHAR = RFCTYPE.RFCTYPE_CHAR * RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE # <<<<<<<<<<<<<< * RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD * RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DATE); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 31, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DATE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DATE, __pyx_t_4) < 0) __PYX_ERR(7, 31, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DATE, __pyx_t_4) < 0) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":32 + /* "pyrfc/_cyrfc.pyx":52 * RFCTYPE_CHAR = RFCTYPE.RFCTYPE_CHAR * RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE * RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD # <<<<<<<<<<<<<< * RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME * RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_BCD); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 32, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_BCD); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_BCD, __pyx_t_4) < 0) __PYX_ERR(7, 32, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_BCD, __pyx_t_4) < 0) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":33 + /* "pyrfc/_cyrfc.pyx":53 * RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE * RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD * RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME # <<<<<<<<<<<<<< * RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE * RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TIME); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 33, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TIME); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TIME, __pyx_t_4) < 0) __PYX_ERR(7, 33, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TIME, __pyx_t_4) < 0) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":34 + /* "pyrfc/_cyrfc.pyx":54 * RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD * RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME * RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE # <<<<<<<<<<<<<< * RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE * RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 34, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_BYTE, __pyx_t_4) < 0) __PYX_ERR(7, 34, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_BYTE, __pyx_t_4) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":35 + /* "pyrfc/_cyrfc.pyx":55 * RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME * RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE * RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE # <<<<<<<<<<<<<< * RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM * RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TABLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 35, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TABLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TABLE, __pyx_t_4) < 0) __PYX_ERR(7, 35, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TABLE, __pyx_t_4) < 0) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":36 + /* "pyrfc/_cyrfc.pyx":56 * RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE * RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE * RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM # <<<<<<<<<<<<<< * RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT * RFCTYPE_INT = RFCTYPE.RFCTYPE_INT */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_NUM); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 36, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_NUM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_NUM, __pyx_t_4) < 0) __PYX_ERR(7, 36, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_NUM, __pyx_t_4) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":37 + /* "pyrfc/_cyrfc.pyx":57 * RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE * RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM * RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT # <<<<<<<<<<<<<< * RFCTYPE_INT = RFCTYPE.RFCTYPE_INT * RFCTYPE_INT2 = RFCTYPE.RFCTYPE_INT2 */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 37, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_FLOAT, __pyx_t_4) < 0) __PYX_ERR(7, 37, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_FLOAT, __pyx_t_4) < 0) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":38 + /* "pyrfc/_cyrfc.pyx":58 * RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM * RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT * RFCTYPE_INT = RFCTYPE.RFCTYPE_INT # <<<<<<<<<<<<<< * RFCTYPE_INT2 = RFCTYPE.RFCTYPE_INT2 * RFCTYPE_INT1 = RFCTYPE.RFCTYPE_INT1 */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 38, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT, __pyx_t_4) < 0) __PYX_ERR(7, 38, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT, __pyx_t_4) < 0) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":39 + /* "pyrfc/_cyrfc.pyx":59 * RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT * RFCTYPE_INT = RFCTYPE.RFCTYPE_INT * RFCTYPE_INT2 = RFCTYPE.RFCTYPE_INT2 # <<<<<<<<<<<<<< * RFCTYPE_INT1 = RFCTYPE.RFCTYPE_INT1 * RFCTYPE_NULL = RFCTYPE.RFCTYPE_NULL */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT2); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 39, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT2, __pyx_t_4) < 0) __PYX_ERR(7, 39, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT2, __pyx_t_4) < 0) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":40 + /* "pyrfc/_cyrfc.pyx":60 * RFCTYPE_INT = RFCTYPE.RFCTYPE_INT * RFCTYPE_INT2 = RFCTYPE.RFCTYPE_INT2 * RFCTYPE_INT1 = RFCTYPE.RFCTYPE_INT1 # <<<<<<<<<<<<<< * RFCTYPE_NULL = RFCTYPE.RFCTYPE_NULL * RFCTYPE_ABAPOBJECT = RFCTYPE.RFCTYPE_ABAPOBJECT */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 40, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT1, __pyx_t_4) < 0) __PYX_ERR(7, 40, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT1, __pyx_t_4) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":41 + /* "pyrfc/_cyrfc.pyx":61 * RFCTYPE_INT2 = RFCTYPE.RFCTYPE_INT2 * RFCTYPE_INT1 = RFCTYPE.RFCTYPE_INT1 * RFCTYPE_NULL = RFCTYPE.RFCTYPE_NULL # <<<<<<<<<<<<<< * RFCTYPE_ABAPOBJECT = RFCTYPE.RFCTYPE_ABAPOBJECT * RFCTYPE_STRUCTURE = RFCTYPE.RFCTYPE_STRUCTURE */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 41, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_NULL, __pyx_t_4) < 0) __PYX_ERR(7, 41, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_NULL, __pyx_t_4) < 0) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":42 + /* "pyrfc/_cyrfc.pyx":62 * RFCTYPE_INT1 = RFCTYPE.RFCTYPE_INT1 * RFCTYPE_NULL = RFCTYPE.RFCTYPE_NULL * RFCTYPE_ABAPOBJECT = RFCTYPE.RFCTYPE_ABAPOBJECT # <<<<<<<<<<<<<< * RFCTYPE_STRUCTURE = RFCTYPE.RFCTYPE_STRUCTURE * RFCTYPE_DECF16 = RFCTYPE.RFCTYPE_DECF16 */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_ABAPOBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 42, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_ABAPOBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_ABAPOBJECT, __pyx_t_4) < 0) __PYX_ERR(7, 42, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_ABAPOBJECT, __pyx_t_4) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":43 + /* "pyrfc/_cyrfc.pyx":63 * RFCTYPE_NULL = RFCTYPE.RFCTYPE_NULL * RFCTYPE_ABAPOBJECT = RFCTYPE.RFCTYPE_ABAPOBJECT * RFCTYPE_STRUCTURE = RFCTYPE.RFCTYPE_STRUCTURE # <<<<<<<<<<<<<< * RFCTYPE_DECF16 = RFCTYPE.RFCTYPE_DECF16 * RFCTYPE_DECF34 = RFCTYPE.RFCTYPE_DECF34 */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_STRUCTURE); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 43, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_STRUCTURE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_STRUCTURE, __pyx_t_4) < 0) __PYX_ERR(7, 43, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_STRUCTURE, __pyx_t_4) < 0) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":44 + /* "pyrfc/_cyrfc.pyx":64 * RFCTYPE_ABAPOBJECT = RFCTYPE.RFCTYPE_ABAPOBJECT * RFCTYPE_STRUCTURE = RFCTYPE.RFCTYPE_STRUCTURE * RFCTYPE_DECF16 = RFCTYPE.RFCTYPE_DECF16 # <<<<<<<<<<<<<< * RFCTYPE_DECF34 = RFCTYPE.RFCTYPE_DECF34 * RFCTYPE_XMLDATA = RFCTYPE.RFCTYPE_XMLDATA */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DECF16); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 44, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DECF16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DECF16, __pyx_t_4) < 0) __PYX_ERR(7, 44, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DECF16, __pyx_t_4) < 0) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":45 + /* "pyrfc/_cyrfc.pyx":65 * RFCTYPE_STRUCTURE = RFCTYPE.RFCTYPE_STRUCTURE * RFCTYPE_DECF16 = RFCTYPE.RFCTYPE_DECF16 * RFCTYPE_DECF34 = RFCTYPE.RFCTYPE_DECF34 # <<<<<<<<<<<<<< * RFCTYPE_XMLDATA = RFCTYPE.RFCTYPE_XMLDATA * RFCTYPE_STRING = RFCTYPE.RFCTYPE_STRING */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DECF34); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 45, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DECF34); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DECF34, __pyx_t_4) < 0) __PYX_ERR(7, 45, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DECF34, __pyx_t_4) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":46 + /* "pyrfc/_cyrfc.pyx":66 * RFCTYPE_DECF16 = RFCTYPE.RFCTYPE_DECF16 * RFCTYPE_DECF34 = RFCTYPE.RFCTYPE_DECF34 * RFCTYPE_XMLDATA = RFCTYPE.RFCTYPE_XMLDATA # <<<<<<<<<<<<<< * RFCTYPE_STRING = RFCTYPE.RFCTYPE_STRING * RFCTYPE_XSTRING = RFCTYPE.RFCTYPE_XSTRING */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_XMLDATA); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 46, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_XMLDATA); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_XMLDATA, __pyx_t_4) < 0) __PYX_ERR(7, 46, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_XMLDATA, __pyx_t_4) < 0) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":47 + /* "pyrfc/_cyrfc.pyx":67 * RFCTYPE_DECF34 = RFCTYPE.RFCTYPE_DECF34 * RFCTYPE_XMLDATA = RFCTYPE.RFCTYPE_XMLDATA * RFCTYPE_STRING = RFCTYPE.RFCTYPE_STRING # <<<<<<<<<<<<<< * RFCTYPE_XSTRING = RFCTYPE.RFCTYPE_XSTRING * RFCTYPE_INT8 = RFCTYPE.RFCTYPE_INT8 */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_STRING); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 47, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_STRING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_STRING, __pyx_t_4) < 0) __PYX_ERR(7, 47, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_STRING, __pyx_t_4) < 0) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":48 + /* "pyrfc/_cyrfc.pyx":68 * RFCTYPE_XMLDATA = RFCTYPE.RFCTYPE_XMLDATA * RFCTYPE_STRING = RFCTYPE.RFCTYPE_STRING * RFCTYPE_XSTRING = RFCTYPE.RFCTYPE_XSTRING # <<<<<<<<<<<<<< * RFCTYPE_INT8 = RFCTYPE.RFCTYPE_INT8 * RFCTYPE_UTCLONG = RFCTYPE.RFCTYPE_UTCLONG */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_XSTRING); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 48, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_XSTRING); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_XSTRING, __pyx_t_4) < 0) __PYX_ERR(7, 48, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_XSTRING, __pyx_t_4) < 0) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":49 + /* "pyrfc/_cyrfc.pyx":69 * RFCTYPE_STRING = RFCTYPE.RFCTYPE_STRING * RFCTYPE_XSTRING = RFCTYPE.RFCTYPE_XSTRING * RFCTYPE_INT8 = RFCTYPE.RFCTYPE_INT8 # <<<<<<<<<<<<<< * RFCTYPE_UTCLONG = RFCTYPE.RFCTYPE_UTCLONG * RFCTYPE_UTCSECOND = RFCTYPE.RFCTYPE_UTCSECOND */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT8); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 49, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_INT8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT8, __pyx_t_4) < 0) __PYX_ERR(7, 49, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_INT8, __pyx_t_4) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":50 + /* "pyrfc/_cyrfc.pyx":70 * RFCTYPE_XSTRING = RFCTYPE.RFCTYPE_XSTRING * RFCTYPE_INT8 = RFCTYPE.RFCTYPE_INT8 * RFCTYPE_UTCLONG = RFCTYPE.RFCTYPE_UTCLONG # <<<<<<<<<<<<<< * RFCTYPE_UTCSECOND = RFCTYPE.RFCTYPE_UTCSECOND * RFCTYPE_UTCMINUTE = RFCTYPE.RFCTYPE_UTCMINUTE */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_UTCLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 50, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_UTCLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_UTCLONG, __pyx_t_4) < 0) __PYX_ERR(7, 50, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_UTCLONG, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":51 + /* "pyrfc/_cyrfc.pyx":71 * RFCTYPE_INT8 = RFCTYPE.RFCTYPE_INT8 * RFCTYPE_UTCLONG = RFCTYPE.RFCTYPE_UTCLONG * RFCTYPE_UTCSECOND = RFCTYPE.RFCTYPE_UTCSECOND # <<<<<<<<<<<<<< * RFCTYPE_UTCMINUTE = RFCTYPE.RFCTYPE_UTCMINUTE * RFCTYPE_DTDAY = RFCTYPE.RFCTYPE_DTDAY */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_UTCSECOND); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 51, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_UTCSECOND); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_UTCSECOND, __pyx_t_4) < 0) __PYX_ERR(7, 51, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_UTCSECOND, __pyx_t_4) < 0) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":52 + /* "pyrfc/_cyrfc.pyx":72 * RFCTYPE_UTCLONG = RFCTYPE.RFCTYPE_UTCLONG * RFCTYPE_UTCSECOND = RFCTYPE.RFCTYPE_UTCSECOND * RFCTYPE_UTCMINUTE = RFCTYPE.RFCTYPE_UTCMINUTE # <<<<<<<<<<<<<< * RFCTYPE_DTDAY = RFCTYPE.RFCTYPE_DTDAY * RFCTYPE_DTWEEK = RFCTYPE.RFCTYPE_DTWEEK */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_UTCMINUTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 52, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_UTCMINUTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_UTCMINUTE, __pyx_t_4) < 0) __PYX_ERR(7, 52, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_UTCMINUTE, __pyx_t_4) < 0) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":53 + /* "pyrfc/_cyrfc.pyx":73 * RFCTYPE_UTCSECOND = RFCTYPE.RFCTYPE_UTCSECOND * RFCTYPE_UTCMINUTE = RFCTYPE.RFCTYPE_UTCMINUTE * RFCTYPE_DTDAY = RFCTYPE.RFCTYPE_DTDAY # <<<<<<<<<<<<<< * RFCTYPE_DTWEEK = RFCTYPE.RFCTYPE_DTWEEK * RFCTYPE_DTMONTH = RFCTYPE.RFCTYPE_DTMONTH */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DTDAY); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 53, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DTDAY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DTDAY, __pyx_t_4) < 0) __PYX_ERR(7, 53, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DTDAY, __pyx_t_4) < 0) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":54 + /* "pyrfc/_cyrfc.pyx":74 * RFCTYPE_UTCMINUTE = RFCTYPE.RFCTYPE_UTCMINUTE * RFCTYPE_DTDAY = RFCTYPE.RFCTYPE_DTDAY * RFCTYPE_DTWEEK = RFCTYPE.RFCTYPE_DTWEEK # <<<<<<<<<<<<<< * RFCTYPE_DTMONTH = RFCTYPE.RFCTYPE_DTMONTH * RFCTYPE_TSECOND = RFCTYPE.RFCTYPE_TSECOND */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DTWEEK); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 54, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DTWEEK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DTWEEK, __pyx_t_4) < 0) __PYX_ERR(7, 54, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DTWEEK, __pyx_t_4) < 0) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":55 + /* "pyrfc/_cyrfc.pyx":75 * RFCTYPE_DTDAY = RFCTYPE.RFCTYPE_DTDAY * RFCTYPE_DTWEEK = RFCTYPE.RFCTYPE_DTWEEK * RFCTYPE_DTMONTH = RFCTYPE.RFCTYPE_DTMONTH # <<<<<<<<<<<<<< * RFCTYPE_TSECOND = RFCTYPE.RFCTYPE_TSECOND * RFCTYPE_TMINUTE = RFCTYPE.RFCTYPE_TMINUTE */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DTMONTH); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 55, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_DTMONTH); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DTMONTH, __pyx_t_4) < 0) __PYX_ERR(7, 55, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_DTMONTH, __pyx_t_4) < 0) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":56 + /* "pyrfc/_cyrfc.pyx":76 * RFCTYPE_DTWEEK = RFCTYPE.RFCTYPE_DTWEEK * RFCTYPE_DTMONTH = RFCTYPE.RFCTYPE_DTMONTH * RFCTYPE_TSECOND = RFCTYPE.RFCTYPE_TSECOND # <<<<<<<<<<<<<< * RFCTYPE_TMINUTE = RFCTYPE.RFCTYPE_TMINUTE * RFCTYPE_CDAY = RFCTYPE.RFCTYPE_CDAY */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TSECOND); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 56, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TSECOND); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TSECOND, __pyx_t_4) < 0) __PYX_ERR(7, 56, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TSECOND, __pyx_t_4) < 0) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":57 + /* "pyrfc/_cyrfc.pyx":77 * RFCTYPE_DTMONTH = RFCTYPE.RFCTYPE_DTMONTH * RFCTYPE_TSECOND = RFCTYPE.RFCTYPE_TSECOND * RFCTYPE_TMINUTE = RFCTYPE.RFCTYPE_TMINUTE # <<<<<<<<<<<<<< * RFCTYPE_CDAY = RFCTYPE.RFCTYPE_CDAY * */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TMINUTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 57, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_TMINUTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TMINUTE, __pyx_t_4) < 0) __PYX_ERR(7, 57, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_TMINUTE, __pyx_t_4) < 0) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":58 + /* "pyrfc/_cyrfc.pyx":78 * RFCTYPE_TSECOND = RFCTYPE.RFCTYPE_TSECOND * RFCTYPE_TMINUTE = RFCTYPE.RFCTYPE_TMINUTE * RFCTYPE_CDAY = RFCTYPE.RFCTYPE_CDAY # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_CDAY); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 58, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFCTYPE(RFCTYPE_CDAY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_CDAY, __pyx_t_4) < 0) __PYX_ERR(7, 58, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFCTYPE_CDAY, __pyx_t_4) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":29 + /* "pyrfc/_cyrfc.pyx":49 * * # RFC field type * class RfcFieldType(Enum): # <<<<<<<<<<<<<< * RFCTYPE_CHAR = RFCTYPE.RFCTYPE_CHAR * RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_RfcFieldType, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 29, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_RfcFieldType, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_RfcFieldType, __pyx_t_4) < 0) __PYX_ERR(7, 29, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_RfcFieldType, __pyx_t_4) < 0) __PYX_ERR(0, 49, __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_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/config.pyx":62 + /* "pyrfc/_cyrfc.pyx":82 * * # bgRFC unit state * class UnitState(Enum): # <<<<<<<<<<<<<< * not_found = RFC_UNIT_STATE.RFC_UNIT_NOT_FOUND * in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 62, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 62, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_UnitState, __pyx_n_s_UnitState, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 62, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_UnitState, __pyx_n_s_UnitState, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "src/pyrfc/config.pyx":63 + /* "pyrfc/_cyrfc.pyx":83 * # bgRFC unit state * class UnitState(Enum): * not_found = RFC_UNIT_STATE.RFC_UNIT_NOT_FOUND # <<<<<<<<<<<<<< * in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS * committed = RFC_UNIT_STATE.RFC_UNIT_COMMITTED */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_NOT_FOUND); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 63, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_NOT_FOUND); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_not_found, __pyx_t_4) < 0) __PYX_ERR(7, 63, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_not_found, __pyx_t_4) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":64 + /* "pyrfc/_cyrfc.pyx":84 * class UnitState(Enum): * not_found = RFC_UNIT_STATE.RFC_UNIT_NOT_FOUND * in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS # <<<<<<<<<<<<<< * committed = RFC_UNIT_STATE.RFC_UNIT_COMMITTED * rolled_back = RFC_UNIT_STATE.RFC_UNIT_ROLLED_BACK */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_IN_PROCESS); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 64, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_IN_PROCESS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_in_process, __pyx_t_4) < 0) __PYX_ERR(7, 64, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_in_process, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":65 + /* "pyrfc/_cyrfc.pyx":85 * not_found = RFC_UNIT_STATE.RFC_UNIT_NOT_FOUND * in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS * committed = RFC_UNIT_STATE.RFC_UNIT_COMMITTED # <<<<<<<<<<<<<< * rolled_back = RFC_UNIT_STATE.RFC_UNIT_ROLLED_BACK * confirmed = RFC_UNIT_STATE.RFC_UNIT_CONFIRMED */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_COMMITTED); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 65, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_COMMITTED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_committed, __pyx_t_4) < 0) __PYX_ERR(7, 65, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_committed, __pyx_t_4) < 0) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":66 + /* "pyrfc/_cyrfc.pyx":86 * in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS * committed = RFC_UNIT_STATE.RFC_UNIT_COMMITTED * rolled_back = RFC_UNIT_STATE.RFC_UNIT_ROLLED_BACK # <<<<<<<<<<<<<< * confirmed = RFC_UNIT_STATE.RFC_UNIT_CONFIRMED * created = auto() */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_ROLLED_BACK); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 66, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_ROLLED_BACK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rolled_back, __pyx_t_4) < 0) __PYX_ERR(7, 66, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rolled_back, __pyx_t_4) < 0) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":67 + /* "pyrfc/_cyrfc.pyx":87 * committed = RFC_UNIT_STATE.RFC_UNIT_COMMITTED * rolled_back = RFC_UNIT_STATE.RFC_UNIT_ROLLED_BACK * confirmed = RFC_UNIT_STATE.RFC_UNIT_CONFIRMED # <<<<<<<<<<<<<< * created = auto() * executed = auto() */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_CONFIRMED); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 67, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_UNIT_STATE(RFC_UNIT_CONFIRMED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_confirmed, __pyx_t_4) < 0) __PYX_ERR(7, 67, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_confirmed, __pyx_t_4) < 0) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":68 + /* "pyrfc/_cyrfc.pyx":88 * rolled_back = RFC_UNIT_STATE.RFC_UNIT_ROLLED_BACK * confirmed = RFC_UNIT_STATE.RFC_UNIT_CONFIRMED * created = auto() # <<<<<<<<<<<<<< * executed = auto() * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_auto); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 68, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_auto); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -46077,20 +43971,20 @@ if (!__Pyx_RefNanny) { } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 68, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_created, __pyx_t_4) < 0) __PYX_ERR(7, 68, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_created, __pyx_t_4) < 0) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":69 + /* "pyrfc/_cyrfc.pyx":89 * confirmed = RFC_UNIT_STATE.RFC_UNIT_CONFIRMED * created = auto() * executed = auto() # <<<<<<<<<<<<<< * * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_auto); if (unlikely(!__pyx_t_5)) __PYX_ERR(7, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_auto); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -46104,858 +43998,550 @@ if (!__Pyx_RefNanny) { } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 69, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_executed, __pyx_t_4) < 0) __PYX_ERR(7, 69, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_executed, __pyx_t_4) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":62 + /* "pyrfc/_cyrfc.pyx":82 * * # bgRFC unit state * class UnitState(Enum): # <<<<<<<<<<<<<< * not_found = RFC_UNIT_STATE.RFC_UNIT_NOT_FOUND * in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_UnitState, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 62, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_UnitState, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnitState, __pyx_t_4) < 0) __PYX_ERR(7, 62, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnitState, __pyx_t_4) < 0) __PYX_ERR(0, 82, __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; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/config.pyx":73 + /* "pyrfc/_cyrfc.pyx":93 * * # bgRFC status * class RCStatus(Enum): # <<<<<<<<<<<<<< * OK = RFC_RC.RFC_OK * RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 73, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 73, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_RCStatus, __pyx_n_s_RCStatus, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 73, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_RCStatus, __pyx_n_s_RCStatus, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "src/pyrfc/config.pyx":74 + /* "pyrfc/_cyrfc.pyx":94 * # bgRFC status * class RCStatus(Enum): * OK = RFC_RC.RFC_OK # <<<<<<<<<<<<<< * RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND * RFC_EXTERNAL_FAILURE = RFC_RC.RFC_EXTERNAL_FAILURE */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 74, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_OK, __pyx_t_4) < 0) __PYX_ERR(7, 74, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_OK, __pyx_t_4) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":75 + /* "pyrfc/_cyrfc.pyx":95 * class RCStatus(Enum): * OK = RFC_RC.RFC_OK * RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND # <<<<<<<<<<<<<< * RFC_EXTERNAL_FAILURE = RFC_RC.RFC_EXTERNAL_FAILURE * RFC_EXECUTED = RFC_RC.RFC_EXECUTED */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_NOT_FOUND); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 75, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_NOT_FOUND); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_NOT_FOUND, __pyx_t_4) < 0) __PYX_ERR(7, 75, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_NOT_FOUND, __pyx_t_4) < 0) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":76 + /* "pyrfc/_cyrfc.pyx":96 * OK = RFC_RC.RFC_OK * RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND * RFC_EXTERNAL_FAILURE = RFC_RC.RFC_EXTERNAL_FAILURE # <<<<<<<<<<<<<< * RFC_EXECUTED = RFC_RC.RFC_EXECUTED * */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 76, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_EXTERNAL_FAILURE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_EXTERNAL_FAILURE, __pyx_t_4) < 0) __PYX_ERR(7, 76, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_EXTERNAL_FAILURE, __pyx_t_4) < 0) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":77 + /* "pyrfc/_cyrfc.pyx":97 * RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND * RFC_EXTERNAL_FAILURE = RFC_RC.RFC_EXTERNAL_FAILURE * RFC_EXECUTED = RFC_RC.RFC_EXECUTED # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_EXECUTED); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 77, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_RC(RFC_EXECUTED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_EXECUTED, __pyx_t_4) < 0) __PYX_ERR(7, 77, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_RFC_EXECUTED, __pyx_t_4) < 0) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":73 + /* "pyrfc/_cyrfc.pyx":93 * * # bgRFC status * class RCStatus(Enum): # <<<<<<<<<<<<<< * OK = RFC_RC.RFC_OK * RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_RCStatus, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 73, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_RCStatus, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_RCStatus, __pyx_t_4) < 0) __PYX_ERR(7, 73, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_RCStatus, __pyx_t_4) < 0) __PYX_ERR(0, 93, __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_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/config.pyx":81 + /* "pyrfc/_cyrfc.pyx":101 * * # bgRFCunit call type * class UnitCallType(Enum): # <<<<<<<<<<<<<< * synchronous = RFC_CALL_TYPE.RFC_SYNCHRONOUS * transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 81, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_UnitCallType, __pyx_n_s_UnitCallType, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(7, 81, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_UnitCallType, __pyx_n_s_UnitCallType, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "src/pyrfc/config.pyx":82 + /* "pyrfc/_cyrfc.pyx":102 * # bgRFCunit call type * class UnitCallType(Enum): * synchronous = RFC_CALL_TYPE.RFC_SYNCHRONOUS # <<<<<<<<<<<<<< * transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL * queued = RFC_CALL_TYPE.RFC_QUEUED */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_SYNCHRONOUS); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 82, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_SYNCHRONOUS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_synchronous, __pyx_t_4) < 0) __PYX_ERR(7, 82, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_synchronous, __pyx_t_4) < 0) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":83 + /* "pyrfc/_cyrfc.pyx":103 * class UnitCallType(Enum): * synchronous = RFC_CALL_TYPE.RFC_SYNCHRONOUS * transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL # <<<<<<<<<<<<<< * queued = RFC_CALL_TYPE.RFC_QUEUED * background_unit = RFC_CALL_TYPE.RFC_BACKGROUND_UNIT */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_TRANSACTIONAL); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 83, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_TRANSACTIONAL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_transactional, __pyx_t_4) < 0) __PYX_ERR(7, 83, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_transactional, __pyx_t_4) < 0) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":84 + /* "pyrfc/_cyrfc.pyx":104 * synchronous = RFC_CALL_TYPE.RFC_SYNCHRONOUS * transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL * queued = RFC_CALL_TYPE.RFC_QUEUED # <<<<<<<<<<<<<< * background_unit = RFC_CALL_TYPE.RFC_BACKGROUND_UNIT + * */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_QUEUED); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 84, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_QUEUED); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_queued, __pyx_t_4) < 0) __PYX_ERR(7, 84, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_queued, __pyx_t_4) < 0) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":85 + /* "pyrfc/_cyrfc.pyx":105 * transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL * queued = RFC_CALL_TYPE.RFC_QUEUED * background_unit = RFC_CALL_TYPE.RFC_BACKGROUND_UNIT # <<<<<<<<<<<<<< + * + * ################################################################################ */ - __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_BACKGROUND_UNIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 85, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_RFC_CALL_TYPE(RFC_BACKGROUND_UNIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_background_unit, __pyx_t_4) < 0) __PYX_ERR(7, 85, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_background_unit, __pyx_t_4) < 0) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "src/pyrfc/config.pyx":81 + /* "pyrfc/_cyrfc.pyx":101 * * # bgRFCunit call type * class UnitCallType(Enum): # <<<<<<<<<<<<<< * synchronous = RFC_CALL_TYPE.RFC_SYNCHRONOUS * transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_UnitCallType, __pyx_t_1, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(7, 81, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_UnitCallType, __pyx_t_2, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnitCallType, __pyx_t_4) < 0) __PYX_ERR(7, 81, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnitCallType, __pyx_t_4) < 0) __PYX_ERR(0, 101, __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; - - /* "src/pyrfc/nwrfcsdk.pyx":1 - * from locale import localeconv # <<<<<<<<<<<<<< - * from os.path import isfile, join - * import pickle - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_localeconv); - __Pyx_GIVEREF(__pyx_n_s_localeconv); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_localeconv); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_locale, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_localeconv); 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_localeconv, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":2 - * from locale import localeconv - * from os.path import isfile, join # <<<<<<<<<<<<<< - * import pickle - * from sys import platform - */ - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_isfile); - __Pyx_GIVEREF(__pyx_n_s_isfile); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_isfile); - __Pyx_INCREF(__pyx_n_s_join); - __Pyx_GIVEREF(__pyx_n_s_join); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_join); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os_path, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_isfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_isfile, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_join, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":3 - * from locale import localeconv - * from os.path import isfile, join - * import pickle # <<<<<<<<<<<<<< - * from sys import platform - * from threading import Thread - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_pickle, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pickle, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":4 - * from os.path import isfile, join - * import pickle - * from sys import platform # <<<<<<<<<<<<<< - * from threading import Thread - * - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_platform); - __Pyx_GIVEREF(__pyx_n_s_platform); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_platform); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_platform); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_platform, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":5 - * import pickle - * from sys import platform - * from threading import Thread # <<<<<<<<<<<<<< - * - * ################################################################################ - */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_Thread); - __Pyx_GIVEREF(__pyx_n_s_Thread); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Thread); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Thread); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Thread, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":12 + /* "pyrfc/_cyrfc.pyx":112 * * * def get_nwrfclib_version(): # <<<<<<<<<<<<<< * """Get SAP NW RFC Lib version * :returns: tuple of major, minor and patch level and OS platform */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_1get_nwrfclib_version, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nwrfclib_version, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_1get_nwrfclib_version, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nwrfclib_version, __pyx_t_2) < 0) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":23 + /* "pyrfc/_cyrfc.pyx":123 * * * def set_ini_file_directory(path_name): # <<<<<<<<<<<<<< * """Sets the directory in which to search for the sapnwrfc.ini file * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_3set_ini_file_directory, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_ini_file_directory, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_3set_ini_file_directory, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_ini_file_directory, __pyx_t_2) < 0) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":43 + /* "pyrfc/_cyrfc.pyx":143 * * * def reload_ini_file(): # <<<<<<<<<<<<<< * """Reloads the contents of the sapnwrfc.ini file into memory. * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_5reload_ini_file, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_reload_ini_file, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_5reload_ini_file, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reload_ini_file, __pyx_t_2) < 0) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":62 + /* "pyrfc/_cyrfc.pyx":162 * * * def language_iso_to_sap(lang_iso): # <<<<<<<<<<<<<< * """Language code conversion of ISO code to SAP code. * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_7language_iso_to_sap, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_language_iso_to_sap, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_7language_iso_to_sap, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_language_iso_to_sap, __pyx_t_2) < 0) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":83 + /* "pyrfc/_cyrfc.pyx":183 * * * def language_sap_to_iso(lang_sap): # <<<<<<<<<<<<<< * """Language code conversion of SAP code to ISO code. * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_9language_sap_to_iso, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_language_sap_to_iso, __pyx_t_1) < 0) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_9language_sap_to_iso, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_language_sap_to_iso, __pyx_t_2) < 0) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":104 + /* "pyrfc/_cyrfc.pyx":204 * * * def set_cryptolib_path(path_name): # <<<<<<<<<<<<<< * """Sets the absolute path to the sapcrypto library to enable TLS encryption via Websocket Rfc. * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_11set_cryptolib_path, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_cryptolib_path, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_11set_cryptolib_path, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_cryptolib_path, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":128 + /* "pyrfc/_cyrfc.pyx":228 * * * def set_locale_radix(value=None): # <<<<<<<<<<<<<< * """Sets the locale radix for decimal conversions. * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_13set_locale_radix, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_locale_radix, __pyx_t_1) < 0) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_13set_locale_radix, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_locale_radix, __pyx_t_2) < 0) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":152 + /* "pyrfc/_cyrfc.pyx":252 * * * def cancel_connection(client_connection): # <<<<<<<<<<<<<< * """Immediately cancels the RFC call which is currently being called over the given RFC connection * and closes the connection. Can be used only on an RFC client connection. */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_15cancel_connection, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cancel_connection, __pyx_t_1) < 0) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":169 - * - * - * def enum_names(enum_obj): # <<<<<<<<<<<<<< - * return set(e.name for e in enum_obj) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_17enum_names, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum_names, __pyx_t_1) < 0) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":173 - * - * - * def enum_values(enum_obj): # <<<<<<<<<<<<<< - * return set(e.value for e in enum_obj) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_19enum_values, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum_values, __pyx_t_1) < 0) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":177 - * - * - * def py_to_string(obj): # <<<<<<<<<<<<<< - * return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_21py_to_string, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_to_string, __pyx_t_1) < 0) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/nwrfcsdk.pyx":181 - * - * - * def string_to_py(objstr): # <<<<<<<<<<<<<< - * return pickle.loads(objstr) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_23string_to_py, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_string_to_py, __pyx_t_1) < 0) __PYX_ERR(0, 181, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_15cancel_connection, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cancel_connection, __pyx_t_2) < 0) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":228 + /* "pyrfc/_cyrfc.pyx":312 * * * class TypeDescription(object): # <<<<<<<<<<<<<< * """ A type description * */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__75); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__75, __pyx_n_s_TypeDescription_2, __pyx_n_s_TypeDescription_2, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_kp_s_A_type_description_This_class_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__67); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__67, __pyx_n_s_TypeDescription_2, __pyx_n_s_TypeDescription_2, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_kp_s_A_type_description_This_class_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); - /* "src/pyrfc/nwrfcsdk.pyx":253 + /* "pyrfc/_cyrfc.pyx":337 * * """ * def __init__(self, name, nuc_length, uc_length): # <<<<<<<<<<<<<< * self.fields = [] * if len(name)<1 or len(name)>30: */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_15TypeDescription_1__init__, 0, __pyx_n_s_TypeDescription___init, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_15TypeDescription_1__init__, 0, __pyx_n_s_TypeDescription___init, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 253, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":264 + /* "pyrfc/_cyrfc.pyx":348 * self.uc_length = uc_length * * def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, # <<<<<<<<<<<<<< * uc_offset, decimals=0, type_description=None): * """ Adds a field to the type description. */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_15TypeDescription_3add_field, 0, __pyx_n_s_TypeDescription_add_field, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_15TypeDescription_3add_field, 0, __pyx_n_s_TypeDescription_add_field, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__80); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_add_field, __pyx_t_3) < 0) __PYX_ERR(0, 264, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__72); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_add_field, __pyx_t_3) < 0) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":305 + /* "pyrfc/_cyrfc.pyx":389 * }) * * def __repr__(self): # <<<<<<<<<<<<<< * return f"" */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_15TypeDescription_5__repr__, 0, __pyx_n_s_TypeDescription___repr, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_15TypeDescription_5__repr__, 0, __pyx_n_s_TypeDescription___repr, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_3) < 0) __PYX_ERR(0, 305, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_repr, __pyx_t_3) < 0) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":228 + /* "pyrfc/_cyrfc.pyx":312 * * * class TypeDescription(object): # <<<<<<<<<<<<<< * """ A type description * */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_TypeDescription_2, __pyx_tuple__75, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_TypeDescription_2, __pyx_tuple__67, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_TypeDescription_2, __pyx_t_3) < 0) __PYX_ERR(0, 228, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TypeDescription_2, __pyx_t_3) < 0) __PYX_ERR(0, 312, __pyx_L1_error) __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; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":314 + /* "pyrfc/_cyrfc.pyx":398 * * * class FunctionDescription(object): # <<<<<<<<<<<<<< * """ A function description * */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__83); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__83, __pyx_n_s_FunctionDescription_2, __pyx_n_s_FunctionDescription_2, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_kp_s_A_function_description_This_cla); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__75); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__75, __pyx_n_s_FunctionDescription_2, __pyx_n_s_FunctionDescription_2, (PyObject *) NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_kp_s_A_function_description_This_cla); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); - /* "src/pyrfc/nwrfcsdk.pyx":337 + /* "pyrfc/_cyrfc.pyx":421 * * """ * def __init__(self, name): # <<<<<<<<<<<<<< * self.name = name * self.parameters = [] */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_19FunctionDescription_1__init__, 0, __pyx_n_s_FunctionDescription___init, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_19FunctionDescription_1__init__, 0, __pyx_n_s_FunctionDescription___init, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 337, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":341 + /* "pyrfc/_cyrfc.pyx":425 * self.parameters = [] * * def add_parameter(self, name, parameter_type, direction, nuc_length, # <<<<<<<<<<<<<< * uc_length, decimals=0, default_value="", parameter_text="", * optional=False, type_description=None): */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_19FunctionDescription_3add_parameter, 0, __pyx_n_s_FunctionDescription_add_paramete, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_19FunctionDescription_3add_parameter, 0, __pyx_n_s_FunctionDescription_add_paramete, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__88); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_add_parameter, __pyx_t_3) < 0) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__80); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_add_parameter, __pyx_t_3) < 0) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":390 + /* "pyrfc/_cyrfc.pyx":474 * }) * * def __repr__(self): # <<<<<<<<<<<<<< * return f"" + * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_19FunctionDescription_5__repr__, 0, __pyx_n_s_FunctionDescription___repr, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pyrfc_6_cyrfc_19FunctionDescription_5__repr__, 0, __pyx_n_s_FunctionDescription___repr, NULL, __pyx_n_s_pyrfc__cyrfc, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_3) < 0) __PYX_ERR(0, 390, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_repr, __pyx_t_3) < 0) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "src/pyrfc/nwrfcsdk.pyx":314 + /* "pyrfc/_cyrfc.pyx":398 * * * class FunctionDescription(object): # <<<<<<<<<<<<<< * """ A function description * */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FunctionDescription_2, __pyx_tuple__83, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_FunctionDescription_2, __pyx_tuple__75, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FunctionDescription_2, __pyx_t_3) < 0) __PYX_ERR(0, 314, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FunctionDescription_2, __pyx_t_3) < 0) __PYX_ERR(0, 398, __pyx_L1_error) __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; - - /* "src/pyrfc/data_container.pyx":1 - * from datetime import date, time, datetime # <<<<<<<<<<<<<< - * from decimal import Decimal - * - */ - __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_date); - __Pyx_GIVEREF(__pyx_n_s_date); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_date); - __Pyx_INCREF(__pyx_n_s_time); - __Pyx_GIVEREF(__pyx_n_s_time); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_time); - __Pyx_INCREF(__pyx_n_s_datetime); - __Pyx_GIVEREF(__pyx_n_s_datetime); - PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_datetime); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_datetime, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_date, __pyx_t_1) < 0) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) __PYX_ERR(4, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/data_container.pyx":2 - * from datetime import date, time, datetime - * from decimal import Decimal # <<<<<<<<<<<<<< - * - * ################################################################################ - */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_Decimal); - __Pyx_GIVEREF(__pyx_n_s_Decimal); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Decimal); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_decimal, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Decimal); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Decimal, __pyx_t_2) < 0) __PYX_ERR(4, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":1 - * from collections.abc import Iterable # <<<<<<<<<<<<<< - * from sys import platform - * from threading import Timer - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_Iterable); - __Pyx_GIVEREF(__pyx_n_s_Iterable); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Iterable); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/client.pyx":2 - * from collections.abc import Iterable - * from sys import platform # <<<<<<<<<<<<<< - * from threading import Timer - * - */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_platform); - __Pyx_GIVEREF(__pyx_n_s_platform); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_platform); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_platform); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_platform, __pyx_t_2) < 0) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "src/pyrfc/client.pyx":3 - * from collections.abc import Iterable - * from sys import platform - * from threading import Timer # <<<<<<<<<<<<<< - * - * # NOTES ON ERROR HANDLING - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_Timer); - __Pyx_GIVEREF(__pyx_n_s_Timer); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Timer); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_threading, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Timer); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timer, __pyx_t_1) < 0) __PYX_ERR(2, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":1 - * from sys import exc_info # <<<<<<<<<<<<<< - * from threading import Thread - * import socket - */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_exc_info); - __Pyx_GIVEREF(__pyx_n_s_exc_info); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_exc_info); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_exc_info, __pyx_t_2) < 0) __PYX_ERR(5, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "src/pyrfc/server.pyx":2 - * from sys import exc_info - * from threading import Thread # <<<<<<<<<<<<<< - * import socket - * - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_Thread); - __Pyx_GIVEREF(__pyx_n_s_Thread); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Thread); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_threading, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Thread); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Thread, __pyx_t_1) < 0) __PYX_ERR(5, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":3 - * from sys import exc_info - * from threading import Thread - * import socket # <<<<<<<<<<<<<< - * - * ################################################################################ - */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_socket, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_2) < 0) __PYX_ERR(5, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "src/pyrfc/server.pyx":13 + /* "pyrfc/_cyrfc.pyx":1493 * # "callback": Python function, * # "server": Server object) * server_functions = {} # <<<<<<<<<<<<<< * * # global information about served functions / callbacks */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 13, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_functions, __pyx_t_2) < 0) __PYX_ERR(5, 13, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_functions, __pyx_t_2) < 0) __PYX_ERR(0, 1493, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":18 + /* "pyrfc/_cyrfc.pyx":1498 * # "auth_check": Default authorization check function * # "server_log": Server logging flag, default False * server_context = {} # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_context, __pyx_t_2) < 0) __PYX_ERR(5, 18, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_context, __pyx_t_2) < 0) __PYX_ERR(0, 1498, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":21 + /* "pyrfc/_cyrfc.pyx":1501 * * * def default_auth_check(func_name=False, request_context = None): # <<<<<<<<<<<<<< * request_context = request_context or {} * _server_log(f"authorization check for '{func_name}'", request_context['server_context']) */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_25default_auth_check, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 21, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_17default_auth_check, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_auth_check, __pyx_t_2) < 0) __PYX_ERR(5, 21, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_auth_check, __pyx_t_2) < 0) __PYX_ERR(0, 1501, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":27 + /* "pyrfc/_cyrfc.pyx":1507 * * * def _server_log(origin, log_message): # <<<<<<<<<<<<<< * if server_context["server_log"]: * print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_27_server_log, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 27, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_19_server_log, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_log, __pyx_t_2) < 0) __PYX_ERR(5, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_server_log, __pyx_t_2) < 0) __PYX_ERR(0, 1507, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "src/pyrfc/server.pyx":282 + /* "pyrfc/_cyrfc.pyx":1762 * * __bgRfcFunction = { * "check": None, # <<<<<<<<<<<<<< * "commit": None, * "rollback": None, */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 282, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_check, Py_None) < 0) __PYX_ERR(5, 282, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_check, Py_None) < 0) __PYX_ERR(0, 1762, __pyx_L1_error) - /* "src/pyrfc/server.pyx":283 + /* "pyrfc/_cyrfc.pyx":1763 * __bgRfcFunction = { * "check": None, * "commit": None, # <<<<<<<<<<<<<< * "rollback": None, * "confirm": None, */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_commit, Py_None) < 0) __PYX_ERR(5, 282, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_commit, Py_None) < 0) __PYX_ERR(0, 1762, __pyx_L1_error) - /* "src/pyrfc/server.pyx":284 + /* "pyrfc/_cyrfc.pyx":1764 * "check": None, * "commit": None, * "rollback": None, # <<<<<<<<<<<<<< * "confirm": None, * "getState": None */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rollback, Py_None) < 0) __PYX_ERR(5, 282, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_rollback, Py_None) < 0) __PYX_ERR(0, 1762, __pyx_L1_error) - /* "src/pyrfc/server.pyx":285 + /* "pyrfc/_cyrfc.pyx":1765 * "commit": None, * "rollback": None, * "confirm": None, # <<<<<<<<<<<<<< * "getState": None * } */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_confirm, Py_None) < 0) __PYX_ERR(5, 282, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_confirm, Py_None) < 0) __PYX_ERR(0, 1762, __pyx_L1_error) - /* "src/pyrfc/server.pyx":286 + /* "pyrfc/_cyrfc.pyx":1766 * "rollback": None, * "confirm": None, * "getState": None # <<<<<<<<<<<<<< * } * */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_getState, Py_None) < 0) __PYX_ERR(5, 282, __pyx_L1_error) - if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server->tp_dict, __pyx_n_s_bgRfcFunction, __pyx_t_2) < 0) __PYX_ERR(5, 281, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_getState, Py_None) < 0) __PYX_ERR(0, 1762, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Server->tp_dict, __pyx_n_s_bgRfcFunction, __pyx_t_2) < 0) __PYX_ERR(0, 1761, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_5pyrfc_6_cyrfc_Server); - /* "src/pyrfc/throughput.pyx":7 + /* "pyrfc/_cyrfc.pyx":2173 * * cdef class Throughput: * _registry = [] # <<<<<<<<<<<<<< * * cdef RFC_THROUGHPUT_HANDLE _throughput_handle */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput->tp_dict, __pyx_n_s_registry, __pyx_t_2) < 0) __PYX_ERR(1, 7, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput->tp_dict, __pyx_n_s_registry, __pyx_t_2) < 0) __PYX_ERR(0, 2173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_5pyrfc_6_cyrfc_Throughput); - /* "src/pyrfc/throughput.pyx":66 + /* "pyrfc/_cyrfc.pyx":2232 * * @staticmethod * def getFromConnection(Connection connection): # <<<<<<<<<<<<<< * """Returns the currently attached throughput object from a connection, if any. * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_10Throughput_5getFromConnection, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 66, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5pyrfc_6_cyrfc_10Throughput_5getFromConnection, NULL, __pyx_n_s_pyrfc__cyrfc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput->tp_dict, __pyx_n_s_getFromConnection, __pyx_t_2) < 0) __PYX_ERR(1, 66, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput->tp_dict, __pyx_n_s_getFromConnection, __pyx_t_2) < 0) __PYX_ERR(0, 2232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_5pyrfc_6_cyrfc_Throughput); - /* "src/pyrfc/throughput.pyx":65 + /* "pyrfc/_cyrfc.pyx":2231 * self._connections.add(connection) * * @staticmethod # <<<<<<<<<<<<<< * def getFromConnection(Connection connection): * """Returns the currently attached throughput object from a connection, if any. */ - __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput, __pyx_n_s_getFromConnection); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_GetNameInClass(__pyx_t_2, (PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput, __pyx_n_s_getFromConnection); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput->tp_dict, __pyx_n_s_getFromConnection, __pyx_t_1) < 0) __PYX_ERR(1, 66, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_ptype_5pyrfc_6_cyrfc_Throughput->tp_dict, __pyx_n_s_getFromConnection, __pyx_t_1) < 0) __PYX_ERR(0, 2232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_5pyrfc_6_cyrfc_Throughput); @@ -46964,9 +44550,9 @@ if (!__Pyx_RefNanny) { * # * # SPDX-License-Identifier: Apache-2.0 */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1, __pyx_L1_error) + __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(6, 1, __pyx_L1_error) + 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; /* "cfunc.to_py":64 @@ -47294,7 +44880,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -47302,12 +44894,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } -#else - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); #endif } bad: @@ -47735,11 +45321,6 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { } #endif -/* None */ -static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { - PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); -} - /* KeywordStringCheck */ static int __Pyx_CheckKeywordStrings( PyObject *kwdict, @@ -48259,474 +45840,161 @@ static const char DIGIT_PAIRS_8[2*8*8+1] = { "4041424344454647" "5051525354555657" "6061626364656667" - "7071727374757677" -}; -static const char DIGITS_HEX[2*16+1] = { - "0123456789abcdef" - "0123456789ABCDEF" -}; - -/* BuildPyUnicode */ -static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, - int prepend_sign, char padding_char) { - PyObject *uval; - Py_ssize_t uoffset = ulength - clength; -#if CYTHON_USE_UNICODE_INTERNALS - Py_ssize_t i; -#if CYTHON_PEP393_ENABLED - void *udata; - uval = PyUnicode_New(ulength, 127); - if (unlikely(!uval)) return NULL; - udata = PyUnicode_DATA(uval); -#else - Py_UNICODE *udata; - uval = PyUnicode_FromUnicode(NULL, ulength); - if (unlikely(!uval)) return NULL; - udata = PyUnicode_AS_UNICODE(uval); -#endif - if (uoffset > 0) { - i = 0; - if (prepend_sign) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); - i++; - } - for (; i < uoffset; i++) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); - } - } - for (i=0; i < clength; i++) { - __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); - } -#else - { - PyObject *sign = NULL, *padding = NULL; - uval = NULL; - if (uoffset > 0) { - prepend_sign = !!prepend_sign; - if (uoffset > prepend_sign) { - padding = PyUnicode_FromOrdinal(padding_char); - if (likely(padding) && uoffset > prepend_sign + 1) { - PyObject *tmp; - PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); - if (unlikely(!repeat)) goto done_or_error; - tmp = PyNumber_Multiply(padding, repeat); - Py_DECREF(repeat); - Py_DECREF(padding); - padding = tmp; - } - if (unlikely(!padding)) goto done_or_error; - } - if (prepend_sign) { - sign = PyUnicode_FromOrdinal('-'); - if (unlikely(!sign)) goto done_or_error; - } - } - uval = PyUnicode_DecodeASCII(chars, clength, NULL); - if (likely(uval) && padding) { - PyObject *tmp = PyNumber_Add(padding, uval); - Py_DECREF(uval); - uval = tmp; - } - if (likely(uval) && sign) { - PyObject *tmp = PyNumber_Add(sign, uval); - Py_DECREF(uval); - uval = tmp; - } -done_or_error: - Py_XDECREF(padding); - Py_XDECREF(sign); - } -#endif - return uval; -} - -/* CIntToPyUnicode */ -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { - char digits[sizeof(Py_ssize_t)*3+2]; - char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; - const char *hex_digits = DIGITS_HEX; - Py_ssize_t length, ulength; - int prepend_sign, last_one_off; - Py_ssize_t remaining; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (format_char == 'X') { - hex_digits += 16; - format_char = 'x'; - } - remaining = value; - last_one_off = 0; - dpos = end; - do { - int digit_pos; - switch (format_char) { - case 'o': - digit_pos = abs((int)(remaining % (8*8))); - remaining = (Py_ssize_t) (remaining / (8*8)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); - last_one_off = (digit_pos < 8); - break; - case 'd': - digit_pos = abs((int)(remaining % (10*10))); - remaining = (Py_ssize_t) (remaining / (10*10)); - dpos -= 2; - memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); - last_one_off = (digit_pos < 10); - break; - case 'x': - *(--dpos) = hex_digits[abs((int)(remaining % 16))]; - remaining = (Py_ssize_t) (remaining / 16); - break; - default: - assert(0); - break; - } - } while (unlikely(remaining != 0)); - if (last_one_off) { - assert(*dpos == '0'); - dpos++; - } - length = end - dpos; - ulength = length; - prepend_sign = 0; - if (!is_unsigned && value <= neg_one) { - if (padding_char == ' ' || width <= length + 1) { - *(--dpos) = '-'; - ++length; - } else { - prepend_sign = 1; - } - ++ulength; - } - if (width > ulength) { - ulength = width; - } - if (ulength == 1) { - return PyUnicode_FromOrdinal(*dpos); - } - return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); -} - -/* GetItemInt */ -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyList_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - Py_ssize_t wrapped_i = i; - if (wraparound & unlikely(i < 0)) { - wrapped_i += PyTuple_GET_SIZE(o); - } - if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; - } - return exc_info; -} -#endif - -/* ReRaiseException */ -static CYTHON_INLINE void __Pyx_ReraiseException(void) { - PyObject *type = NULL, *value = NULL, *tb = NULL; -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = PyThreadState_GET(); - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - type = exc_info->exc_type; - value = exc_info->exc_value; - tb = exc_info->exc_traceback; - #else - type = tstate->exc_type; - value = tstate->exc_value; - tb = tstate->exc_traceback; - #endif -#else - PyErr_GetExcInfo(&type, &value, &tb); -#endif - if (!type || type == Py_None) { -#if !CYTHON_FAST_THREAD_STATE - Py_XDECREF(type); - Py_XDECREF(value); - Py_XDECREF(tb); -#endif - PyErr_SetString(PyExc_RuntimeError, - "No active exception to reraise"); - } else { -#if CYTHON_FAST_THREAD_STATE - Py_INCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); -#endif - PyErr_Restore(type, value, tb); - } -} - -/* SaveResetException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = type; - exc_info->exc_value = value; - exc_info->exc_traceback = tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; icurexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) -#endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) + "7071727374757677" +}; +static const char DIGITS_HEX[2*16+1] = { + "0123456789abcdef" + "0123456789ABCDEF" +}; + +/* BuildPyUnicode */ +static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength, + int prepend_sign, char padding_char) { + PyObject *uval; + Py_ssize_t uoffset = ulength - clength; +#if CYTHON_USE_UNICODE_INTERNALS + Py_ssize_t i; +#if CYTHON_PEP393_ENABLED + void *udata; + uval = PyUnicode_New(ulength, 127); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_DATA(uval); #else - if (unlikely(PyErr_Occurred())) + Py_UNICODE *udata; + uval = PyUnicode_FromUnicode(NULL, ulength); + if (unlikely(!uval)) return NULL; + udata = PyUnicode_AS_UNICODE(uval); #endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; + if (uoffset > 0) { + i = 0; + if (prepend_sign) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); + i++; + } + for (; i < uoffset; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); + } } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #if CYTHON_USE_EXC_INFO_STACK - { - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; + for (i=0; i < clength; i++) { + __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); #else - PyErr_SetExcInfo(local_type, local_value, local_tb); + { + PyObject *sign = NULL, *padding = NULL; + uval = NULL; + if (uoffset > 0) { + prepend_sign = !!prepend_sign; + if (uoffset > prepend_sign) { + padding = PyUnicode_FromOrdinal(padding_char); + if (likely(padding) && uoffset > prepend_sign + 1) { + PyObject *tmp; + PyObject *repeat = PyInt_FromSsize_t(uoffset - prepend_sign); + if (unlikely(!repeat)) goto done_or_error; + tmp = PyNumber_Multiply(padding, repeat); + Py_DECREF(repeat); + Py_DECREF(padding); + padding = tmp; + } + if (unlikely(!padding)) goto done_or_error; + } + if (prepend_sign) { + sign = PyUnicode_FromOrdinal('-'); + if (unlikely(!sign)) goto done_or_error; + } + } + uval = PyUnicode_DecodeASCII(chars, clength, NULL); + if (likely(uval) && padding) { + PyObject *tmp = PyNumber_Add(padding, uval); + Py_DECREF(uval); + uval = tmp; + } + if (likely(uval) && sign) { + PyObject *tmp = PyNumber_Add(sign, uval); + Py_DECREF(uval); + uval = tmp; + } +done_or_error: + Py_XDECREF(padding); + Py_XDECREF(sign); + } #endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; + return uval; } -/* SwapException */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - #if CYTHON_USE_EXC_INFO_STACK - _PyErr_StackItem *exc_info = tstate->exc_info; - tmp_type = exc_info->exc_type; - tmp_value = exc_info->exc_value; - tmp_tb = exc_info->exc_traceback; - exc_info->exc_type = *type; - exc_info->exc_value = *value; - exc_info->exc_traceback = *tb; - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - #endif - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} +/* CIntToPyUnicode */ +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) { + char digits[sizeof(Py_ssize_t)*3+2]; + char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2; + const char *hex_digits = DIGITS_HEX; + Py_ssize_t length, ulength; + int prepend_sign, last_one_off; + Py_ssize_t remaining; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop #endif + const int is_unsigned = neg_one > const_zero; + if (format_char == 'X') { + hex_digits += 16; + format_char = 'x'; + } + remaining = value; + last_one_off = 0; + dpos = end; + do { + int digit_pos; + switch (format_char) { + case 'o': + digit_pos = abs((int)(remaining % (8*8))); + remaining = (Py_ssize_t) (remaining / (8*8)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); + last_one_off = (digit_pos < 8); + break; + case 'd': + digit_pos = abs((int)(remaining % (10*10))); + remaining = (Py_ssize_t) (remaining / (10*10)); + dpos -= 2; + memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); + last_one_off = (digit_pos < 10); + break; + case 'x': + *(--dpos) = hex_digits[abs((int)(remaining % 16))]; + remaining = (Py_ssize_t) (remaining / 16); + break; + default: + assert(0); + break; + } + } while (unlikely(remaining != 0)); + if (last_one_off) { + assert(*dpos == '0'); + dpos++; + } + length = end - dpos; + ulength = length; + prepend_sign = 0; + if (!is_unsigned && value <= neg_one) { + if (padding_char == ' ' || width <= length + 1) { + *(--dpos) = '-'; + ++length; + } else { + prepend_sign = 1; + } + ++ulength; + } + if (width > ulength) { + ulength = width; + } + if (ulength == 1) { + return PyUnicode_FromOrdinal(*dpos); + } + return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); +} /* BytesEquals */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { @@ -48877,419 +46145,270 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #endif } -/* StringJoin */ -#if !CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { - return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); -} -#endif - -/* PyObjectFormat */ -#if CYTHON_USE_UNICODE_WRITER -static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { - int ret; - _PyUnicodeWriter writer; - if (likely(PyFloat_CheckExact(obj))) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 - _PyUnicodeWriter_Init(&writer, 0); +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else - _PyUnicodeWriter_Init(&writer); +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif - ret = _PyFloat_FormatAdvancedWriter( - &writer, - obj, - format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); - } else if (likely(PyLong_CheckExact(obj))) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 - _PyUnicodeWriter_Init(&writer, 0); +{ + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; #else - _PyUnicodeWriter_Init(&writer); -#endif - ret = _PyLong_FormatAdvancedWriter( - &writer, - obj, - format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); - } else { - return PyObject_Format(obj, format_spec); - } - if (unlikely(ret == -1)) { - _PyUnicodeWriter_Dealloc(&writer); - return NULL; - } - return _PyUnicodeWriter_Finish(&writer); -} -#endif - -/* SliceObject */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); - } - } - return ms->sq_slice(obj, cstart, cstop); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) + PyErr_Fetch(&local_type, &local_value, &local_tb); #endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) #else - result = PyObject_GetItem(obj, py_slice); + if (unlikely(PyErr_Occurred())) #endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; - } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; -} - -/* UnpackUnboundCMethod */ -static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { - PyObject *method; - method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); - if (unlikely(!method)) - return -1; - target->method = method; -#if CYTHON_COMPILING_IN_CPYTHON + goto bad; #if PY_MAJOR_VERSION >= 3 - if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK { - PyMethodDescrObject *descr = (PyMethodDescrObject*) method; - target->func = descr->d_method->ml_meth; - target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); - } -#endif - return 0; -} - -/* CallUnboundCMethod1 */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { - if (likely(cfunc->func)) { - int flag = cfunc->flag; - if (flag == METH_O) { - return (*(cfunc->func))(self, arg); - } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { - #if PY_VERSION_HEX >= 0x030700A0 - return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); - #else - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - #endif - } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } - return __Pyx__CallUnboundCMethod1(cfunc, self, arg); -} -#endif -static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ - PyObject *args, *result = NULL; - if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; -#if CYTHON_COMPILING_IN_CPYTHON - if (cfunc->func && (cfunc->flag & METH_VARARGS)) { - args = PyTuple_New(1); - if (unlikely(!args)) goto bad; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - if (cfunc->flag & METH_KEYWORDS) - result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); - else - result = (*cfunc->func)(self, args); - } else { - args = PyTuple_New(2); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); - } -#else - args = PyTuple_Pack(2, self, arg); - if (unlikely(!args)) goto bad; - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); -#endif -bad: - Py_XDECREF(args); - return result; -} - -/* CallUnboundCMethod2 */ -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 -static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { - if (likely(cfunc->func)) { - PyObject *args[2] = {arg1, arg2}; - if (cfunc->flag == METH_FASTCALL) { - #if PY_VERSION_HEX >= 0x030700A0 - return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2); - #else - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); - #endif - } - #if PY_VERSION_HEX >= 0x030700A0 - if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) - return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); - #endif - } - return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); -} -#endif -static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ - PyObject *args, *result = NULL; - if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; -#if CYTHON_COMPILING_IN_CPYTHON - if (cfunc->func && (cfunc->flag & METH_VARARGS)) { - args = PyTuple_New(2); - if (unlikely(!args)) goto bad; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - if (cfunc->flag & METH_KEYWORDS) - result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); - else - result = (*cfunc->func)(self, args); - } else { - args = PyTuple_New(3); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 1, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 2, arg2); - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); #else - args = PyTuple_Pack(3, self, arg1, arg2); - if (unlikely(!args)) goto bad; - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + PyErr_SetExcInfo(local_type, local_value, local_tb); #endif + return 0; bad: - Py_XDECREF(args); - return result; + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; } -/* dict_getitem_default */ -static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { - PyObject* value; -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (unlikely(PyErr_Occurred())) - return NULL; - value = default_value; - } - Py_INCREF(value); - if ((1)); +/* SwapException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + #endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} #else - if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { - value = PyDict_GetItem(d, key); - if (unlikely(!value)) { - value = default_value; - } - Py_INCREF(value); - } +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} #endif - else { - if (default_value == Py_None) - value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key); - else - value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value); + +/* GetTopmostException */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; } - return value; + return exc_info; } +#endif -/* SetItemInt */ -static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; +/* SaveResetException */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; + #else + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + #endif + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); } -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +#endif + +/* 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; } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return m->sq_ass_item(o, i, v); + 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 -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) -#else - if (is_list || PySequence_Check(o)) -#endif - { - return PySequence_SetItem(o, i, v); +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); } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); + return res; } - -/* PyIntCompare */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; +#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; iob_digit; - if (intval == 0) { - if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } else if (intval < 0) { - if (size >= 0) - Py_RETURN_FALSE; - intval = -intval; - size = -size; + return 0; +} +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { + if (likely(err == exc_type)) return 1; + if (likely(PyExceptionClass_Check(err))) { + if (likely(PyExceptionClass_Check(exc_type))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); + } else if (likely(PyTuple_Check(exc_type))) { + return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); } else { - if (size <= 0) - Py_RETURN_FALSE; } - uintval = (unsigned long) intval; -#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 4)) { - unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 3)) { - unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 2)) { - unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 1)) { - unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif - unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; + return PyErr_GivenExceptionMatches(err, exc_type); +} +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { + assert(PyExceptionClass_Check(exc_type1)); + assert(PyExceptionClass_Check(exc_type2)); + if (likely(err == exc_type1 || err == exc_type2)) return 1; + if (likely(PyExceptionClass_Check(err))) { + return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); } - return ( - PyObject_RichCompare(op1, op2, Py_EQ)); + return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); } +#endif /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY @@ -49415,138 +46534,102 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED } #endif -/* decode_c_string */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, Py_ssize_t start, Py_ssize_t stop, - const char* encoding, const char* errors, - PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; } - if (stop < 0) - stop += length; - } - if (unlikely(stop <= start)) - return __Pyx_NewRef(__pyx_empty_unicode); - length = stop - start; - cstring += start; - if (decode_func) { - return decode_func(cstring, length, errors); - } else { - return PyUnicode_Decode(cstring, length, encoding, errors); - } -} - -/* 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; + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; } - 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; + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + goto bad; + PyErr_Clear(); + } } + return ms->sq_slice(obj, cstart, cstop); } - __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; itp_as_mapping; + if (likely(mp && mp->mp_subscript)) #endif - for (i=0; imp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; } - return PyErr_GivenExceptionMatches(err, exc_type); -} -static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { - assert(PyExceptionClass_Check(exc_type1)); - assert(PyExceptionClass_Check(exc_type2)); - if (likely(err == exc_type1 || err == exc_type2)) return 1; - if (likely(PyExceptionClass_Check(err))) { - return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); - } - return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); + PyErr_Format(PyExc_TypeError, + "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); +bad: + return NULL; } -#endif /* CIntToPyUnicode */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_RFC_UNIT_STATE(RFC_UNIT_STATE value, Py_ssize_t width, char padding_char, char format_char) { @@ -49698,6 +46781,93 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t wi return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); } +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { @@ -49884,11 +47054,85 @@ static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) { return -1; } +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; icurexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; + if (unlikely(PyTuple_Check(err))) + return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); +} +#endif + /* None */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } +/* SetItemInt */ +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, + CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return -1; + PyErr_Clear(); + } + } + return m->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) +#else + if (is_list || PySequence_Check(o)) +#endif + { + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { @@ -49910,6 +47154,343 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam return 0; } +/* ReRaiseException */ +static CYTHON_INLINE void __Pyx_ReraiseException(void) { + PyObject *type = NULL, *value = NULL, *tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = PyThreadState_GET(); + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + type = exc_info->exc_type; + value = exc_info->exc_value; + tb = exc_info->exc_traceback; + #else + type = tstate->exc_type; + value = tstate->exc_value; + tb = tstate->exc_traceback; + #endif +#else + PyErr_GetExcInfo(&type, &value, &tb); +#endif + if (!type || type == Py_None) { +#if !CYTHON_FAST_THREAD_STATE + Py_XDECREF(type); + Py_XDECREF(value); + Py_XDECREF(tb); +#endif + PyErr_SetString(PyExc_RuntimeError, + "No active exception to reraise"); + } else { +#if CYTHON_FAST_THREAD_STATE + Py_INCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); +#endif + PyErr_Restore(type, value, tb); + } +} + +/* StringJoin */ +#if !CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { + return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); +} +#endif + +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 + _PyUnicodeWriter_Init(&writer, 0); +#else + _PyUnicodeWriter_Init(&writer); +#endif + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 + _PyUnicodeWriter_Init(&writer, 0); +#else + _PyUnicodeWriter_Init(&writer); +#endif + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); + return NULL; + } + return _PyUnicodeWriter_Finish(&writer); +} +#endif + +/* UnpackUnboundCMethod */ +static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION >= 3 + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); + } +#endif + return 0; +} + +/* CallUnboundCMethod1 */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + if (likely(cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return (*(cfunc->func))(self, arg); + } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); + #else + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + #endif + } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); + } + } + return __Pyx__CallUnboundCMethod1(cfunc, self, arg); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(2, self, arg); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* CallUnboundCMethod2 */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + if (likely(cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 + return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2); + #else + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + #if PY_VERSION_HEX >= 0x030700A0 + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); + #endif + } + return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(3); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 1, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 2, arg2); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(3, self, arg1, arg2); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* dict_getitem_default */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); + if ((1)); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } +#endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value); + } + return value; +} + +/* PyIntCompare */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { + if (op1 == op2) { + Py_RETURN_TRUE; + } + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long a = PyInt_AS_LONG(op1); + if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + int unequal; + unsigned long uintval; + Py_ssize_t size = Py_SIZE(op1); + const digit* digits = ((PyLongObject*)op1)->ob_digit; + if (intval == 0) { + if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } else if (intval < 0) { + if (size >= 0) + Py_RETURN_FALSE; + intval = -intval; + size = -size; + } else { + if (size <= 0) + Py_RETURN_FALSE; + } + uintval = (unsigned long) intval; +#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 4)) { + unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 3)) { + unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 2)) { + unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif +#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 + if (uintval >> (PyLong_SHIFT * 1)) { + unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) + | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); + } else +#endif + unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); + if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = PyFloat_AS_DOUBLE(op1); + if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; + } + return ( + PyObject_RichCompare(op1, op2, Py_EQ)); +} + +/* decode_c_string */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, Py_ssize_t start, Py_ssize_t stop, + const char* encoding, const char* errors, + PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { + Py_ssize_t length; + if (unlikely((start < 0) | (stop < 0))) { + size_t slen = strlen(cstring); + if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, + "c-string too long to convert to Python"); + return NULL; + } + length = (Py_ssize_t) slen; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + } + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_empty_unicode); + length = stop - start; + cstring += start; + if (decode_func) { + return decode_func(cstring, length, errors); + } else { + return PyUnicode_Decode(cstring, length, encoding, errors); + } +} + /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; @@ -51955,26 +49536,26 @@ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { } /* CIntFromPy */ -static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *x) { +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const RFC_INT neg_one = (RFC_INT) -1, const_zero = (RFC_INT) 0; + const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(RFC_INT) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(RFC_INT, long, PyInt_AS_LONG(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 (RFC_INT) val; + return (int) val; } } else #endif @@ -51983,32 +49564,32 @@ static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *x) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (RFC_INT) 0; - case 1: __PYX_VERIFY_RETURN_INT(RFC_INT, digit, digits[0]) + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: - if (8 * sizeof(RFC_INT) > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT) >= 2 * PyLong_SHIFT) { - return (RFC_INT) (((((RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0])); + __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(RFC_INT) > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT) >= 3 * PyLong_SHIFT) { - return (RFC_INT) (((((((RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0])); + __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(RFC_INT) > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_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(RFC_INT) >= 4 * PyLong_SHIFT) { - return (RFC_INT) (((((((((RFC_INT)digits[3]) << PyLong_SHIFT) | (RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0])); + __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; @@ -52022,86 +49603,86 @@ static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *x) { { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (RFC_INT) -1; + return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(RFC_INT) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } 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 (RFC_INT) 0; - case -1: __PYX_VERIFY_RETURN_INT(RFC_INT, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(RFC_INT, digit, +digits[0]) + 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(RFC_INT) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT) - 1 > 2 * PyLong_SHIFT) { - return (RFC_INT) (((RFC_INT)-1)*(((((RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); + __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(RFC_INT) > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT) - 1 > 2 * PyLong_SHIFT) { - return (RFC_INT) ((((((RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); + __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(RFC_INT) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT) - 1 > 3 * PyLong_SHIFT) { - return (RFC_INT) (((RFC_INT)-1)*(((((((RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); + __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(RFC_INT) > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT) - 1 > 3 * PyLong_SHIFT) { - return (RFC_INT) ((((((((RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); + __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(RFC_INT) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_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(RFC_INT) - 1 > 4 * PyLong_SHIFT) { - return (RFC_INT) (((RFC_INT)-1)*(((((((((RFC_INT)digits[3]) << PyLong_SHIFT) | (RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); + __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(RFC_INT) > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_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(RFC_INT) - 1 > 4 * PyLong_SHIFT) { - return (RFC_INT) ((((((((((RFC_INT)digits[3]) << PyLong_SHIFT) | (RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); + __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(RFC_INT) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT, long, PyLong_AsLong(x)) + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -52110,7 +49691,7 @@ static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *x) { PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - RFC_INT val; + int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -52130,47 +49711,85 @@ static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *x) { return val; } #endif - return (RFC_INT) -1; + return (int) -1; } } else { - RFC_INT val; + int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (RFC_INT) -1; - val = __Pyx_PyInt_As_RFC_INT(tmp); + 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 RFC_INT"); - return (RFC_INT) -1; + "value too large to convert to int"); + return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to RFC_INT"); - return (RFC_INT) -1; + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } 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); + } } /* CIntFromPy */ -static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *x) { +static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const RFC_INT8 neg_one = (RFC_INT8) -1, const_zero = (RFC_INT8) 0; + const short neg_one = (short) -1, const_zero = (short) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(RFC_INT8) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, long, PyInt_AS_LONG(x)) + if (sizeof(short) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (RFC_INT8) val; + return (short) val; } } else #endif @@ -52179,32 +49798,32 @@ static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *x) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (RFC_INT8) 0; - case 1: __PYX_VERIFY_RETURN_INT(RFC_INT8, digit, digits[0]) + case 0: return (short) 0; + case 1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0]) case 2: - if (8 * sizeof(RFC_INT8) > 1 * PyLong_SHIFT) { + if (8 * sizeof(short) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT8) >= 2 * PyLong_SHIFT) { - return (RFC_INT8) (((((RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0])); + __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) { + return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])); } } break; case 3: - if (8 * sizeof(RFC_INT8) > 2 * PyLong_SHIFT) { + if (8 * sizeof(short) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT8) >= 3 * PyLong_SHIFT) { - return (RFC_INT8) (((((((RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0])); + __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) { + return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])); } } break; case 4: - if (8 * sizeof(RFC_INT8) > 3 * PyLong_SHIFT) { + if (8 * sizeof(short) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, 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(RFC_INT8) >= 4 * PyLong_SHIFT) { - return (RFC_INT8) (((((((((RFC_INT8)digits[3]) << PyLong_SHIFT) | (RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0])); + __PYX_VERIFY_RETURN_INT(short, 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(short) >= 4 * PyLong_SHIFT) { + return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])); } } break; @@ -52218,86 +49837,86 @@ static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *x) { { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (RFC_INT8) -1; + return (short) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(RFC_INT8) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(short) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT8) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(short, 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 (RFC_INT8) 0; - case -1: __PYX_VERIFY_RETURN_INT(RFC_INT8, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(RFC_INT8, digit, +digits[0]) + case 0: return (short) 0; + case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(short, digit, +digits[0]) case -2: - if (8 * sizeof(RFC_INT8) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT8) - 1 > 2 * PyLong_SHIFT) { - return (RFC_INT8) (((RFC_INT8)-1)*(((((RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); + __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) { + return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); } } break; case 2: - if (8 * sizeof(RFC_INT8) > 1 * PyLong_SHIFT) { + if (8 * sizeof(short) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT8) - 1 > 2 * PyLong_SHIFT) { - return (RFC_INT8) ((((((RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); + __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) { + return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); } } break; case -3: - if (8 * sizeof(RFC_INT8) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT8) - 1 > 3 * PyLong_SHIFT) { - return (RFC_INT8) (((RFC_INT8)-1)*(((((((RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); + __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) { + return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); } } break; case 3: - if (8 * sizeof(RFC_INT8) > 2 * PyLong_SHIFT) { + if (8 * sizeof(short) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_INT8) - 1 > 3 * PyLong_SHIFT) { - return (RFC_INT8) ((((((((RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); + __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) { + return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); } } break; case -4: - if (8 * sizeof(RFC_INT8) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, 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(RFC_INT8) - 1 > 4 * PyLong_SHIFT) { - return (RFC_INT8) (((RFC_INT8)-1)*(((((((((RFC_INT8)digits[3]) << PyLong_SHIFT) | (RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); + __PYX_VERIFY_RETURN_INT(short, 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(short) - 1 > 4 * PyLong_SHIFT) { + return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); } } break; case 4: - if (8 * sizeof(RFC_INT8) > 3 * PyLong_SHIFT) { + if (8 * sizeof(short) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_INT8, 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(RFC_INT8) - 1 > 4 * PyLong_SHIFT) { - return (RFC_INT8) ((((((((((RFC_INT8)digits[3]) << PyLong_SHIFT) | (RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); + __PYX_VERIFY_RETURN_INT(short, 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(short) - 1 > 4 * PyLong_SHIFT) { + return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); } } break; } #endif - if (sizeof(RFC_INT8) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, long, PyLong_AsLong(x)) + if (sizeof(short) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT8) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(short, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -52306,7 +49925,241 @@ static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *x) { PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - RFC_INT8 val; + short 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 (short) -1; + } + } else { + short val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (short) -1; + val = __Pyx_PyInt_As_short(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to short"); + return (short) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to short"); + return (short) -1; +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + 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 RFC_RC __Pyx_PyInt_As_RFC_RC(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const RFC_RC neg_one = (RFC_RC) -1, const_zero = (RFC_RC) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(RFC_RC) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(RFC_RC, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (RFC_RC) 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 (RFC_RC) 0; + case 1: __PYX_VERIFY_RETURN_INT(RFC_RC, digit, digits[0]) + case 2: + if (8 * sizeof(RFC_RC) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_RC) >= 2 * PyLong_SHIFT) { + return (RFC_RC) (((((RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(RFC_RC) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_RC) >= 3 * PyLong_SHIFT) { + return (RFC_RC) (((((((RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(RFC_RC) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, 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(RFC_RC) >= 4 * PyLong_SHIFT) { + return (RFC_RC) (((((((((RFC_RC)digits[3]) << PyLong_SHIFT) | (RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)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 (RFC_RC) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(RFC_RC) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(RFC_RC) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, 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 (RFC_RC) 0; + case -1: __PYX_VERIFY_RETURN_INT(RFC_RC, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(RFC_RC, digit, +digits[0]) + case -2: + if (8 * sizeof(RFC_RC) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_RC) - 1 > 2 * PyLong_SHIFT) { + return (RFC_RC) (((RFC_RC)-1)*(((((RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(RFC_RC) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_RC) - 1 > 2 * PyLong_SHIFT) { + return (RFC_RC) ((((((RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(RFC_RC) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_RC) - 1 > 3 * PyLong_SHIFT) { + return (RFC_RC) (((RFC_RC)-1)*(((((((RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(RFC_RC) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_RC) - 1 > 3 * PyLong_SHIFT) { + return (RFC_RC) ((((((((RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(RFC_RC) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, 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(RFC_RC) - 1 > 4 * PyLong_SHIFT) { + return (RFC_RC) (((RFC_RC)-1)*(((((((((RFC_RC)digits[3]) << PyLong_SHIFT) | (RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(RFC_RC) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(RFC_RC, 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(RFC_RC) - 1 > 4 * PyLong_SHIFT) { + return (RFC_RC) ((((((((((RFC_RC)digits[3]) << PyLong_SHIFT) | (RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + } + } + break; + } +#endif + if (sizeof(RFC_RC) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(RFC_RC) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, 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 + RFC_RC val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -52326,85 +50179,47 @@ static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *x) { return val; } #endif - return (RFC_INT8) -1; + return (RFC_RC) -1; } } else { - RFC_INT8 val; + RFC_RC val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (RFC_INT8) -1; - val = __Pyx_PyInt_As_RFC_INT8(tmp); + if (!tmp) return (RFC_RC) -1; + val = __Pyx_PyInt_As_RFC_RC(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to RFC_INT8"); - return (RFC_INT8) -1; + "value too large to convert to RFC_RC"); + return (RFC_RC) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to RFC_INT8"); - return (RFC_INT8) -1; -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_ERROR_GROUP(RFC_ERROR_GROUP value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const RFC_ERROR_GROUP neg_one = (RFC_ERROR_GROUP) -1, const_zero = (RFC_ERROR_GROUP) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(RFC_ERROR_GROUP) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(RFC_ERROR_GROUP) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_ERROR_GROUP) <= 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(RFC_ERROR_GROUP), - little, !is_unsigned); - } + "can't convert negative value to RFC_RC"); + return (RFC_RC) -1; } /* CIntFromPy */ -static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *x) { +static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const RFC_ERROR_GROUP neg_one = (RFC_ERROR_GROUP) -1, const_zero = (RFC_ERROR_GROUP) 0; + const RFCTYPE neg_one = (RFCTYPE) -1, const_zero = (RFCTYPE) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(RFC_ERROR_GROUP) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, long, PyInt_AS_LONG(x)) + if (sizeof(RFCTYPE) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(RFCTYPE, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (RFC_ERROR_GROUP) val; + return (RFCTYPE) val; } } else #endif @@ -52413,32 +50228,32 @@ static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *x) #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (RFC_ERROR_GROUP) 0; - case 1: __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, digit, digits[0]) + case 0: return (RFCTYPE) 0; + case 1: __PYX_VERIFY_RETURN_INT(RFCTYPE, digit, digits[0]) case 2: - if (8 * sizeof(RFC_ERROR_GROUP) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_ERROR_GROUP) >= 2 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) (((((RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0])); + __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFCTYPE) >= 2 * PyLong_SHIFT) { + return (RFCTYPE) (((((RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0])); } } break; case 3: - if (8 * sizeof(RFC_ERROR_GROUP) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_ERROR_GROUP) >= 3 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) (((((((RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0])); + __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFCTYPE) >= 3 * PyLong_SHIFT) { + return (RFCTYPE) (((((((RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0])); } } break; case 4: - if (8 * sizeof(RFC_ERROR_GROUP) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, 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(RFC_ERROR_GROUP) >= 4 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) (((((((((RFC_ERROR_GROUP)digits[3]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0])); + __PYX_VERIFY_RETURN_INT(RFCTYPE, 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(RFCTYPE) >= 4 * PyLong_SHIFT) { + return (RFCTYPE) (((((((((RFCTYPE)digits[3]) << PyLong_SHIFT) | (RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0])); } } break; @@ -52452,86 +50267,86 @@ static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *x) { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (RFC_ERROR_GROUP) -1; + return (RFCTYPE) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(RFCTYPE) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(RFCTYPE) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, 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 (RFC_ERROR_GROUP) 0; - case -1: __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, digit, +digits[0]) + case 0: return (RFCTYPE) 0; + case -1: __PYX_VERIFY_RETURN_INT(RFCTYPE, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(RFCTYPE, digit, +digits[0]) case -2: - if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 2 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) (((RFC_ERROR_GROUP)-1)*(((((RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFCTYPE, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFCTYPE) - 1 > 2 * PyLong_SHIFT) { + return (RFCTYPE) (((RFCTYPE)-1)*(((((RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); } } break; case 2: - if (8 * sizeof(RFC_ERROR_GROUP) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 2 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) ((((((RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFCTYPE) - 1 > 2 * PyLong_SHIFT) { + return (RFCTYPE) ((((((RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); } } break; case -3: - if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 3 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) (((RFC_ERROR_GROUP)-1)*(((((((RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFCTYPE, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFCTYPE) - 1 > 3 * PyLong_SHIFT) { + return (RFCTYPE) (((RFCTYPE)-1)*(((((((RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); } } break; case 3: - if (8 * sizeof(RFC_ERROR_GROUP) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 3 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) ((((((((RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFCTYPE) - 1 > 3 * PyLong_SHIFT) { + return (RFCTYPE) ((((((((RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); } } break; case -4: - if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, 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(RFC_ERROR_GROUP) - 1 > 4 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) (((RFC_ERROR_GROUP)-1)*(((((((((RFC_ERROR_GROUP)digits[3]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFCTYPE, 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(RFCTYPE) - 1 > 4 * PyLong_SHIFT) { + return (RFCTYPE) (((RFCTYPE)-1)*(((((((((RFCTYPE)digits[3]) << PyLong_SHIFT) | (RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); } } break; case 4: - if (8 * sizeof(RFC_ERROR_GROUP) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFCTYPE) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, 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(RFC_ERROR_GROUP) - 1 > 4 * PyLong_SHIFT) { - return (RFC_ERROR_GROUP) ((((((((((RFC_ERROR_GROUP)digits[3]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFCTYPE, 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(RFCTYPE) - 1 > 4 * PyLong_SHIFT) { + return (RFCTYPE) ((((((((((RFCTYPE)digits[3]) << PyLong_SHIFT) | (RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); } } break; } #endif - if (sizeof(RFC_ERROR_GROUP) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, long, PyLong_AsLong(x)) + if (sizeof(RFCTYPE) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(RFCTYPE) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -52540,7 +50355,7 @@ static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *x) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - RFC_ERROR_GROUP val; + RFCTYPE val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -52560,47 +50375,47 @@ static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *x) return val; } #endif - return (RFC_ERROR_GROUP) -1; + return (RFCTYPE) -1; } } else { - RFC_ERROR_GROUP val; + RFCTYPE val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (RFC_ERROR_GROUP) -1; - val = __Pyx_PyInt_As_RFC_ERROR_GROUP(tmp); + if (!tmp) return (RFCTYPE) -1; + val = __Pyx_PyInt_As_RFCTYPE(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to RFC_ERROR_GROUP"); - return (RFC_ERROR_GROUP) -1; + "value too large to convert to RFCTYPE"); + return (RFCTYPE) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to RFC_ERROR_GROUP"); - return (RFC_ERROR_GROUP) -1; + "can't convert negative value to RFCTYPE"); + return (RFCTYPE) -1; } /* CIntFromPy */ -static CYTHON_INLINE RFC_RC __Pyx_PyInt_As_RFC_RC(PyObject *x) { +static CYTHON_INLINE RFC_DIRECTION __Pyx_PyInt_As_RFC_DIRECTION(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const RFC_RC neg_one = (RFC_RC) -1, const_zero = (RFC_RC) 0; + const RFC_DIRECTION neg_one = (RFC_DIRECTION) -1, const_zero = (RFC_DIRECTION) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(RFC_RC) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(RFC_RC, long, PyInt_AS_LONG(x)) + if (sizeof(RFC_DIRECTION) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (RFC_RC) val; + return (RFC_DIRECTION) val; } } else #endif @@ -52609,32 +50424,32 @@ static CYTHON_INLINE RFC_RC __Pyx_PyInt_As_RFC_RC(PyObject *x) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (RFC_RC) 0; - case 1: __PYX_VERIFY_RETURN_INT(RFC_RC, digit, digits[0]) + case 0: return (RFC_DIRECTION) 0; + case 1: __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, digit, digits[0]) case 2: - if (8 * sizeof(RFC_RC) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_RC) >= 2 * PyLong_SHIFT) { - return (RFC_RC) (((((RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_DIRECTION) >= 2 * PyLong_SHIFT) { + return (RFC_DIRECTION) (((((RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0])); } } break; case 3: - if (8 * sizeof(RFC_RC) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_RC) >= 3 * PyLong_SHIFT) { - return (RFC_RC) (((((((RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_DIRECTION) >= 3 * PyLong_SHIFT) { + return (RFC_DIRECTION) (((((((RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0])); } } break; case 4: - if (8 * sizeof(RFC_RC) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, 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(RFC_RC) >= 4 * PyLong_SHIFT) { - return (RFC_RC) (((((((((RFC_RC)digits[3]) << PyLong_SHIFT) | (RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, 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(RFC_DIRECTION) >= 4 * PyLong_SHIFT) { + return (RFC_DIRECTION) (((((((((RFC_DIRECTION)digits[3]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0])); } } break; @@ -52648,86 +50463,86 @@ static CYTHON_INLINE RFC_RC __Pyx_PyInt_As_RFC_RC(PyObject *x) { { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (RFC_RC) -1; + return (RFC_DIRECTION) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(RFC_RC) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(RFC_DIRECTION) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_RC) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(RFC_DIRECTION) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, 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 (RFC_RC) 0; - case -1: __PYX_VERIFY_RETURN_INT(RFC_RC, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(RFC_RC, digit, +digits[0]) + case 0: return (RFC_DIRECTION) 0; + case -1: __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, digit, +digits[0]) case -2: - if (8 * sizeof(RFC_RC) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_RC) - 1 > 2 * PyLong_SHIFT) { - return (RFC_RC) (((RFC_RC)-1)*(((((RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_DIRECTION) - 1 > 2 * PyLong_SHIFT) { + return (RFC_DIRECTION) (((RFC_DIRECTION)-1)*(((((RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); } } break; case 2: - if (8 * sizeof(RFC_RC) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_RC) - 1 > 2 * PyLong_SHIFT) { - return (RFC_RC) ((((((RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_DIRECTION) - 1 > 2 * PyLong_SHIFT) { + return (RFC_DIRECTION) ((((((RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); } } break; case -3: - if (8 * sizeof(RFC_RC) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_RC) - 1 > 3 * PyLong_SHIFT) { - return (RFC_RC) (((RFC_RC)-1)*(((((((RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_DIRECTION) - 1 > 3 * PyLong_SHIFT) { + return (RFC_DIRECTION) (((RFC_DIRECTION)-1)*(((((((RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); } } break; case 3: - if (8 * sizeof(RFC_RC) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_RC) - 1 > 3 * PyLong_SHIFT) { - return (RFC_RC) ((((((((RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_DIRECTION) - 1 > 3 * PyLong_SHIFT) { + return (RFC_DIRECTION) ((((((((RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); } } break; case -4: - if (8 * sizeof(RFC_RC) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, 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(RFC_RC) - 1 > 4 * PyLong_SHIFT) { - return (RFC_RC) (((RFC_RC)-1)*(((((((((RFC_RC)digits[3]) << PyLong_SHIFT) | (RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, 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(RFC_DIRECTION) - 1 > 4 * PyLong_SHIFT) { + return (RFC_DIRECTION) (((RFC_DIRECTION)-1)*(((((((((RFC_DIRECTION)digits[3]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); } } break; case 4: - if (8 * sizeof(RFC_RC) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_DIRECTION) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_RC, 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(RFC_RC) - 1 > 4 * PyLong_SHIFT) { - return (RFC_RC) ((((((((((RFC_RC)digits[3]) << PyLong_SHIFT) | (RFC_RC)digits[2]) << PyLong_SHIFT) | (RFC_RC)digits[1]) << PyLong_SHIFT) | (RFC_RC)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, 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(RFC_DIRECTION) - 1 > 4 * PyLong_SHIFT) { + return (RFC_DIRECTION) ((((((((((RFC_DIRECTION)digits[3]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); } } break; } #endif - if (sizeof(RFC_RC) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, long, PyLong_AsLong(x)) + if (sizeof(RFC_DIRECTION) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_RC) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_RC, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(RFC_DIRECTION) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -52736,7 +50551,7 @@ static CYTHON_INLINE RFC_RC __Pyx_PyInt_As_RFC_RC(PyObject *x) { PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - RFC_RC val; + RFC_DIRECTION val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -52756,166 +50571,52 @@ static CYTHON_INLINE RFC_RC __Pyx_PyInt_As_RFC_RC(PyObject *x) { return val; } #endif - return (RFC_RC) -1; + return (RFC_DIRECTION) -1; } } else { - RFC_RC val; + RFC_DIRECTION val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (RFC_RC) -1; - val = __Pyx_PyInt_As_RFC_RC(tmp); + if (!tmp) return (RFC_DIRECTION) -1; + val = __Pyx_PyInt_As_RFC_DIRECTION(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to RFC_RC"); - return (RFC_RC) -1; + "value too large to convert to RFC_DIRECTION"); + return (RFC_DIRECTION) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to RFC_RC"); - return (RFC_RC) -1; -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_RAW(SAP_RAW value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const SAP_RAW neg_one = (SAP_RAW) -1, const_zero = (SAP_RAW) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(SAP_RAW) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(SAP_RAW) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(SAP_RAW) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(SAP_RAW) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(SAP_RAW) <= 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(SAP_RAW), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT(RFC_INT value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const RFC_INT neg_one = (RFC_INT) -1, const_zero = (RFC_INT) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(RFC_INT) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(RFC_INT) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(RFC_INT) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_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(RFC_INT), - little, !is_unsigned); - } -} - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT2(RFC_INT2 value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const RFC_INT2 neg_one = (RFC_INT2) -1, const_zero = (RFC_INT2) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(RFC_INT2) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(RFC_INT2) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT2) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(RFC_INT2) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT2) <= 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(RFC_INT2), - little, !is_unsigned); - } + "can't convert negative value to RFC_DIRECTION"); + return (RFC_DIRECTION) -1; } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT8(RFC_INT8 value) { +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_ULLONG(SAP_ULLONG value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const RFC_INT8 neg_one = (RFC_INT8) -1, const_zero = (RFC_INT8) 0; + const SAP_ULLONG neg_one = (SAP_ULLONG) -1, const_zero = (SAP_ULLONG) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(RFC_INT8) < sizeof(long)) { + if (sizeof(SAP_ULLONG) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(RFC_INT8) <= sizeof(unsigned long)) { + } else if (sizeof(SAP_ULLONG) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT8) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(SAP_ULLONG) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(RFC_INT8) <= sizeof(long)) { + if (sizeof(SAP_ULLONG) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_INT8) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(SAP_ULLONG) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -52923,32 +50624,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT8(RFC_INT8 value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(RFC_INT8), + return _PyLong_FromByteArray(bytes, sizeof(SAP_ULLONG), little, !is_unsigned); } } /* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +static CYTHON_INLINE RFC_INT __Pyx_PyInt_As_RFC_INT(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const int neg_one = (int) -1, const_zero = (int) 0; + const RFC_INT neg_one = (RFC_INT) -1, const_zero = (RFC_INT) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + if (sizeof(RFC_INT) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(RFC_INT, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (int) val; + return (RFC_INT) val; } } else #endif @@ -52957,32 +50658,32 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #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 0: return (RFC_INT) 0; + case 1: __PYX_VERIFY_RETURN_INT(RFC_INT, digit, digits[0]) case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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])); + __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT) >= 2 * PyLong_SHIFT) { + return (RFC_INT) (((((RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0])); } } break; case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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])); + __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT) >= 3 * PyLong_SHIFT) { + return (RFC_INT) (((((((RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0])); } } break; case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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])); + __PYX_VERIFY_RETURN_INT(RFC_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(RFC_INT) >= 4 * PyLong_SHIFT) { + return (RFC_INT) (((((((((RFC_INT)digits[3]) << PyLong_SHIFT) | (RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0])); } } break; @@ -52996,86 +50697,86 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (int) -1; + return (RFC_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)) + if (sizeof(RFC_INT) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_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)) + } else if (sizeof(RFC_INT) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_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 0: return (RFC_INT) 0; + case -1: __PYX_VERIFY_RETURN_INT(RFC_INT, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(RFC_INT, digit, +digits[0]) case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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]))); + __PYX_VERIFY_RETURN_INT(RFC_INT, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT) - 1 > 2 * PyLong_SHIFT) { + return (RFC_INT) (((RFC_INT)-1)*(((((RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); } } break; case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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]))); + __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT) - 1 > 2 * PyLong_SHIFT) { + return (RFC_INT) ((((((RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); } } break; case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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]))); + __PYX_VERIFY_RETURN_INT(RFC_INT, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT) - 1 > 3 * PyLong_SHIFT) { + return (RFC_INT) (((RFC_INT)-1)*(((((((RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); } } break; case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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]))); + __PYX_VERIFY_RETURN_INT(RFC_INT, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT) - 1 > 3 * PyLong_SHIFT) { + return (RFC_INT) ((((((((RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); } } break; case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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]))); + __PYX_VERIFY_RETURN_INT(RFC_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(RFC_INT) - 1 > 4 * PyLong_SHIFT) { + return (RFC_INT) (((RFC_INT)-1)*(((((((((RFC_INT)digits[3]) << PyLong_SHIFT) | (RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); } } break; case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_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]))); + __PYX_VERIFY_RETURN_INT(RFC_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(RFC_INT) - 1 > 4 * PyLong_SHIFT) { + return (RFC_INT) ((((((((((RFC_INT)digits[3]) << PyLong_SHIFT) | (RFC_INT)digits[2]) << PyLong_SHIFT) | (RFC_INT)digits[1]) << PyLong_SHIFT) | (RFC_INT)digits[0]))); } } break; } #endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + if (sizeof(RFC_INT) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_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)) + } else if (sizeof(RFC_INT) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_INT, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -53084,7 +50785,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - int val; + RFC_INT val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -53104,85 +50805,47 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { return val; } #endif - return (int) -1; + return (RFC_INT) -1; } } else { - int val; + RFC_INT val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); + if (!tmp) return (RFC_INT) -1; + val = __Pyx_PyInt_As_RFC_INT(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; + "value too large to convert to RFC_INT"); + return (RFC_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_int(int value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } + "can't convert negative value to RFC_INT"); + return (RFC_INT) -1; } /* CIntFromPy */ -static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) { +static CYTHON_INLINE RFC_INT8 __Pyx_PyInt_As_RFC_INT8(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const short neg_one = (short) -1, const_zero = (short) 0; + const RFC_INT8 neg_one = (RFC_INT8) -1, const_zero = (RFC_INT8) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(short) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x)) + if (sizeof(RFC_INT8) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(RFC_INT8, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (short) val; + return (RFC_INT8) val; } } else #endif @@ -53191,32 +50854,32 @@ static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (short) 0; - case 1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0]) + case 0: return (RFC_INT8) 0; + case 1: __PYX_VERIFY_RETURN_INT(RFC_INT8, digit, digits[0]) case 2: - if (8 * sizeof(short) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) { - return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT8) >= 2 * PyLong_SHIFT) { + return (RFC_INT8) (((((RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0])); } } break; case 3: - if (8 * sizeof(short) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) { - return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT8) >= 3 * PyLong_SHIFT) { + return (RFC_INT8) (((((((RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0])); } } break; case 4: - if (8 * sizeof(short) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, 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(short) >= 4 * PyLong_SHIFT) { - return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_INT8, 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(RFC_INT8) >= 4 * PyLong_SHIFT) { + return (RFC_INT8) (((((((((RFC_INT8)digits[3]) << PyLong_SHIFT) | (RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0])); } } break; @@ -53230,86 +50893,86 @@ static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) { { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (short) -1; + return (RFC_INT8) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(short) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(RFC_INT8) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(RFC_INT8) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, 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 (short) 0; - case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(short, digit, +digits[0]) + case 0: return (RFC_INT8) 0; + case -1: __PYX_VERIFY_RETURN_INT(RFC_INT8, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(RFC_INT8, digit, +digits[0]) case -2: - if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) { - return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_INT8, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT8) - 1 > 2 * PyLong_SHIFT) { + return (RFC_INT8) (((RFC_INT8)-1)*(((((RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); } } break; case 2: - if (8 * sizeof(short) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) { - return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT8) - 1 > 2 * PyLong_SHIFT) { + return (RFC_INT8) ((((((RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); } } break; case -3: - if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) { - return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_INT8, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT8) - 1 > 3 * PyLong_SHIFT) { + return (RFC_INT8) (((RFC_INT8)-1)*(((((((RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); } } break; case 3: - if (8 * sizeof(short) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) { - return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_INT8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_INT8) - 1 > 3 * PyLong_SHIFT) { + return (RFC_INT8) ((((((((RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); } } break; case -4: - if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, 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(short) - 1 > 4 * PyLong_SHIFT) { - return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_INT8, 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(RFC_INT8) - 1 > 4 * PyLong_SHIFT) { + return (RFC_INT8) (((RFC_INT8)-1)*(((((((((RFC_INT8)digits[3]) << PyLong_SHIFT) | (RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); } } break; case 4: - if (8 * sizeof(short) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_INT8) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(short, 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(short) - 1 > 4 * PyLong_SHIFT) { - return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_INT8, 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(RFC_INT8) - 1 > 4 * PyLong_SHIFT) { + return (RFC_INT8) ((((((((((RFC_INT8)digits[3]) << PyLong_SHIFT) | (RFC_INT8)digits[2]) << PyLong_SHIFT) | (RFC_INT8)digits[1]) << PyLong_SHIFT) | (RFC_INT8)digits[0]))); } } break; } #endif - if (sizeof(short) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x)) + if (sizeof(RFC_INT8) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(short, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(RFC_INT8) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_INT8, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -53318,7 +50981,7 @@ static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) { PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - short val; + RFC_INT8 val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -53338,52 +51001,52 @@ static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) { return val; } #endif - return (short) -1; + return (RFC_INT8) -1; } } else { - short val; + RFC_INT8 val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (short) -1; - val = __Pyx_PyInt_As_short(tmp); + if (!tmp) return (RFC_INT8) -1; + val = __Pyx_PyInt_As_RFC_INT8(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to short"); - return (short) -1; + "value too large to convert to RFC_INT8"); + return (RFC_INT8) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to short"); - return (short) -1; + "can't convert negative value to RFC_INT8"); + return (RFC_INT8) -1; } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_ERROR_GROUP(RFC_ERROR_GROUP value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const long neg_one = (long) -1, const_zero = (long) 0; + const RFC_ERROR_GROUP neg_one = (RFC_ERROR_GROUP) -1, const_zero = (RFC_ERROR_GROUP) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { + if (sizeof(RFC_ERROR_GROUP) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { + } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(long) <= sizeof(long)) { + if (sizeof(RFC_ERROR_GROUP) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -53391,32 +51054,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), + return _PyLong_FromByteArray(bytes, sizeof(RFC_ERROR_GROUP), little, !is_unsigned); } } /* CIntFromPy */ -static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *x) { +static CYTHON_INLINE RFC_ERROR_GROUP __Pyx_PyInt_As_RFC_ERROR_GROUP(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const RFCTYPE neg_one = (RFCTYPE) -1, const_zero = (RFCTYPE) 0; + const RFC_ERROR_GROUP neg_one = (RFC_ERROR_GROUP) -1, const_zero = (RFC_ERROR_GROUP) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(RFCTYPE) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, long, PyInt_AS_LONG(x)) + if (sizeof(RFC_ERROR_GROUP) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (RFCTYPE) val; + return (RFC_ERROR_GROUP) val; } } else #endif @@ -53425,32 +51088,32 @@ static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *x) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (RFCTYPE) 0; - case 1: __PYX_VERIFY_RETURN_INT(RFCTYPE, digit, digits[0]) + case 0: return (RFC_ERROR_GROUP) 0; + case 1: __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, digit, digits[0]) case 2: - if (8 * sizeof(RFCTYPE) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFCTYPE) >= 2 * PyLong_SHIFT) { - return (RFCTYPE) (((((RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_ERROR_GROUP) >= 2 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) (((((RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0])); } } break; case 3: - if (8 * sizeof(RFCTYPE) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFCTYPE) >= 3 * PyLong_SHIFT) { - return (RFCTYPE) (((((((RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_ERROR_GROUP) >= 3 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) (((((((RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0])); } } break; case 4: - if (8 * sizeof(RFCTYPE) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, 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(RFCTYPE) >= 4 * PyLong_SHIFT) { - return (RFCTYPE) (((((((((RFCTYPE)digits[3]) << PyLong_SHIFT) | (RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0])); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, 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(RFC_ERROR_GROUP) >= 4 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) (((((((((RFC_ERROR_GROUP)digits[3]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0])); } } break; @@ -53464,86 +51127,86 @@ static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *x) { { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (RFCTYPE) -1; + return (RFC_ERROR_GROUP) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(RFCTYPE) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFCTYPE) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, 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 (RFCTYPE) 0; - case -1: __PYX_VERIFY_RETURN_INT(RFCTYPE, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(RFCTYPE, digit, +digits[0]) + case 0: return (RFC_ERROR_GROUP) 0; + case -1: __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, digit, +digits[0]) case -2: - if (8 * sizeof(RFCTYPE) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFCTYPE) - 1 > 2 * PyLong_SHIFT) { - return (RFCTYPE) (((RFCTYPE)-1)*(((((RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 2 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) (((RFC_ERROR_GROUP)-1)*(((((RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); } } break; case 2: - if (8 * sizeof(RFCTYPE) > 1 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFCTYPE) - 1 > 2 * PyLong_SHIFT) { - return (RFCTYPE) ((((((RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 2 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) ((((((RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); } } break; case -3: - if (8 * sizeof(RFCTYPE) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFCTYPE) - 1 > 3 * PyLong_SHIFT) { - return (RFCTYPE) (((RFCTYPE)-1)*(((((((RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 3 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) (((RFC_ERROR_GROUP)-1)*(((((((RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); } } break; case 3: - if (8 * sizeof(RFCTYPE) > 2 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFCTYPE) - 1 > 3 * PyLong_SHIFT) { - return (RFCTYPE) ((((((((RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 3 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) ((((((((RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); } } break; case -4: - if (8 * sizeof(RFCTYPE) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, 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(RFCTYPE) - 1 > 4 * PyLong_SHIFT) { - return (RFCTYPE) (((RFCTYPE)-1)*(((((((((RFCTYPE)digits[3]) << PyLong_SHIFT) | (RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, 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(RFC_ERROR_GROUP) - 1 > 4 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) (((RFC_ERROR_GROUP)-1)*(((((((((RFC_ERROR_GROUP)digits[3]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); } } break; case 4: - if (8 * sizeof(RFCTYPE) > 3 * PyLong_SHIFT) { + if (8 * sizeof(RFC_ERROR_GROUP) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFCTYPE, 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(RFCTYPE) - 1 > 4 * PyLong_SHIFT) { - return (RFCTYPE) ((((((((((RFCTYPE)digits[3]) << PyLong_SHIFT) | (RFCTYPE)digits[2]) << PyLong_SHIFT) | (RFCTYPE)digits[1]) << PyLong_SHIFT) | (RFCTYPE)digits[0]))); + __PYX_VERIFY_RETURN_INT(RFC_ERROR_GROUP, 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(RFC_ERROR_GROUP) - 1 > 4 * PyLong_SHIFT) { + return (RFC_ERROR_GROUP) ((((((((((RFC_ERROR_GROUP)digits[3]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[2]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[1]) << PyLong_SHIFT) | (RFC_ERROR_GROUP)digits[0]))); } } break; } #endif - if (sizeof(RFCTYPE) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, long, PyLong_AsLong(x)) + if (sizeof(RFC_ERROR_GROUP) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(RFCTYPE) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFCTYPE, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(RFC_ERROR_GROUP) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(RFC_ERROR_GROUP, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -53552,7 +51215,7 @@ static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *x) { PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - RFCTYPE val; + RFC_ERROR_GROUP val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -53572,248 +51235,166 @@ static CYTHON_INLINE RFCTYPE __Pyx_PyInt_As_RFCTYPE(PyObject *x) { return val; } #endif - return (RFCTYPE) -1; + return (RFC_ERROR_GROUP) -1; } } else { - RFCTYPE val; + RFC_ERROR_GROUP val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (RFCTYPE) -1; - val = __Pyx_PyInt_As_RFCTYPE(tmp); + if (!tmp) return (RFC_ERROR_GROUP) -1; + val = __Pyx_PyInt_As_RFC_ERROR_GROUP(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to RFCTYPE"); - return (RFCTYPE) -1; + "value too large to convert to RFC_ERROR_GROUP"); + return (RFC_ERROR_GROUP) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to RFCTYPE"); - return (RFCTYPE) -1; + "can't convert negative value to RFC_ERROR_GROUP"); + return (RFC_ERROR_GROUP) -1; } -/* CIntFromPy */ -static CYTHON_INLINE RFC_DIRECTION __Pyx_PyInt_As_RFC_DIRECTION(PyObject *x) { +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_RAW(SAP_RAW value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const RFC_DIRECTION neg_one = (RFC_DIRECTION) -1, const_zero = (RFC_DIRECTION) 0; + const SAP_RAW neg_one = (SAP_RAW) -1, const_zero = (SAP_RAW) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(RFC_DIRECTION) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (RFC_DIRECTION) 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 (RFC_DIRECTION) 0; - case 1: __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, digit, digits[0]) - case 2: - if (8 * sizeof(RFC_DIRECTION) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_DIRECTION) >= 2 * PyLong_SHIFT) { - return (RFC_DIRECTION) (((((RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(RFC_DIRECTION) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_DIRECTION) >= 3 * PyLong_SHIFT) { - return (RFC_DIRECTION) (((((((RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(RFC_DIRECTION) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, 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(RFC_DIRECTION) >= 4 * PyLong_SHIFT) { - return (RFC_DIRECTION) (((((((((RFC_DIRECTION)digits[3]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)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 (RFC_DIRECTION) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(RFC_DIRECTION) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, unsigned long, PyLong_AsUnsignedLong(x)) + if (is_unsigned) { + if (sizeof(SAP_RAW) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(SAP_RAW) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_DIRECTION) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(SAP_RAW) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (RFC_DIRECTION) 0; - case -1: __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, digit, +digits[0]) - case -2: - if (8 * sizeof(RFC_DIRECTION) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_DIRECTION) - 1 > 2 * PyLong_SHIFT) { - return (RFC_DIRECTION) (((RFC_DIRECTION)-1)*(((((RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(RFC_DIRECTION) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_DIRECTION) - 1 > 2 * PyLong_SHIFT) { - return (RFC_DIRECTION) ((((((RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(RFC_DIRECTION) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_DIRECTION) - 1 > 3 * PyLong_SHIFT) { - return (RFC_DIRECTION) (((RFC_DIRECTION)-1)*(((((((RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(RFC_DIRECTION) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(RFC_DIRECTION) - 1 > 3 * PyLong_SHIFT) { - return (RFC_DIRECTION) ((((((((RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(RFC_DIRECTION) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, 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(RFC_DIRECTION) - 1 > 4 * PyLong_SHIFT) { - return (RFC_DIRECTION) (((RFC_DIRECTION)-1)*(((((((((RFC_DIRECTION)digits[3]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(RFC_DIRECTION) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(RFC_DIRECTION, 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(RFC_DIRECTION) - 1 > 4 * PyLong_SHIFT) { - return (RFC_DIRECTION) ((((((((((RFC_DIRECTION)digits[3]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[2]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[1]) << PyLong_SHIFT) | (RFC_DIRECTION)digits[0]))); - } - } - break; - } + } + } else { + if (sizeof(SAP_RAW) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(SAP_RAW) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); #endif - if (sizeof(RFC_DIRECTION) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, long, PyLong_AsLong(x)) + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(SAP_RAW), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT(RFC_INT value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const RFC_INT neg_one = (RFC_INT) -1, const_zero = (RFC_INT) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(RFC_INT) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(RFC_INT) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(RFC_DIRECTION) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(RFC_DIRECTION, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(RFC_INT) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif - } } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - RFC_DIRECTION 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; - } + } else { + if (sizeof(RFC_INT) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(RFC_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(RFC_INT), + little, !is_unsigned); + } +} + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT2(RFC_INT2 value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const RFC_INT2 neg_one = (RFC_INT2) -1, const_zero = (RFC_INT2) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(RFC_INT2) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(RFC_INT2) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(RFC_INT2) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif - return (RFC_DIRECTION) -1; } } else { - RFC_DIRECTION val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (RFC_DIRECTION) -1; - val = __Pyx_PyInt_As_RFC_DIRECTION(tmp); - Py_DECREF(tmp); - return val; + if (sizeof(RFC_INT2) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(RFC_INT2) <= 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(RFC_INT2), + little, !is_unsigned); } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to RFC_DIRECTION"); - return (RFC_DIRECTION) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to RFC_DIRECTION"); - return (RFC_DIRECTION) -1; } /* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_ULLONG(SAP_ULLONG value) { +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_RFC_INT8(RFC_INT8 value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const SAP_ULLONG neg_one = (SAP_ULLONG) -1, const_zero = (SAP_ULLONG) 0; + const RFC_INT8 neg_one = (RFC_INT8) -1, const_zero = (RFC_INT8) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(SAP_ULLONG) < sizeof(long)) { + if (sizeof(RFC_INT8) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(SAP_ULLONG) <= sizeof(unsigned long)) { + } else if (sizeof(RFC_INT8) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(SAP_ULLONG) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(RFC_INT8) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(SAP_ULLONG) <= sizeof(long)) { + if (sizeof(RFC_INT8) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(SAP_ULLONG) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(RFC_INT8) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -53821,7 +51402,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_SAP_ULLONG(SAP_ULLONG value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(SAP_ULLONG), + return _PyLong_FromByteArray(bytes, sizeof(RFC_INT8), little, !is_unsigned); } } @@ -54059,1000 +51640,6 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { return (long) -1; } -/* CoroutineBase */ -#include -#include -#if PY_VERSION_HEX >= 0x030b00a6 - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif -#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) -static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) { - PyObject *et, *ev, *tb; - PyObject *value = NULL; - __Pyx_ErrFetch(&et, &ev, &tb); - if (!et) { - Py_XDECREF(tb); - Py_XDECREF(ev); - Py_INCREF(Py_None); - *pvalue = Py_None; - return 0; - } - if (likely(et == PyExc_StopIteration)) { - if (!ev) { - Py_INCREF(Py_None); - value = Py_None; - } -#if PY_VERSION_HEX >= 0x030300A0 - else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { - value = ((PyStopIterationObject *)ev)->value; - Py_INCREF(value); - Py_DECREF(ev); - } -#endif - else if (unlikely(PyTuple_Check(ev))) { - if (PyTuple_GET_SIZE(ev) >= 1) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - value = PyTuple_GET_ITEM(ev, 0); - Py_INCREF(value); -#else - value = PySequence_ITEM(ev, 0); -#endif - } else { - Py_INCREF(Py_None); - value = Py_None; - } - Py_DECREF(ev); - } - else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { - value = ev; - } - if (likely(value)) { - Py_XDECREF(tb); - Py_DECREF(et); - *pvalue = value; - return 0; - } - } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { - __Pyx_ErrRestore(et, ev, tb); - return -1; - } - PyErr_NormalizeException(&et, &ev, &tb); - if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { - __Pyx_ErrRestore(et, ev, tb); - return -1; - } - Py_XDECREF(tb); - Py_DECREF(et); -#if PY_VERSION_HEX >= 0x030300A0 - value = ((PyStopIterationObject *)ev)->value; - Py_INCREF(value); - Py_DECREF(ev); -#else - { - PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); - Py_DECREF(ev); - if (likely(args)) { - value = PySequence_GetItem(args, 0); - Py_DECREF(args); - } - if (unlikely(!value)) { - __Pyx_ErrRestore(NULL, NULL, NULL); - Py_INCREF(Py_None); - value = Py_None; - } - } -#endif - *pvalue = value; - return 0; -} -static CYTHON_INLINE -void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { - PyObject *t, *v, *tb; - t = exc_state->exc_type; - v = exc_state->exc_value; - tb = exc_state->exc_traceback; - exc_state->exc_type = NULL; - exc_state->exc_value = NULL; - exc_state->exc_traceback = NULL; - Py_XDECREF(t); - Py_XDECREF(v); - Py_XDECREF(tb); -} -#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) -static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) { - const char *msg; - if ((0)) { - #ifdef __Pyx_Coroutine_USED - } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { - msg = "coroutine already executing"; - #endif - #ifdef __Pyx_AsyncGen_USED - } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { - msg = "async generator already executing"; - #endif - } else { - msg = "generator already executing"; - } - PyErr_SetString(PyExc_ValueError, msg); -} -#define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL) -static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) { - const char *msg; - if ((0)) { - #ifdef __Pyx_Coroutine_USED - } else if (__Pyx_Coroutine_Check(gen)) { - msg = "can't send non-None value to a just-started coroutine"; - #endif - #ifdef __Pyx_AsyncGen_USED - } else if (__Pyx_AsyncGen_CheckExact(gen)) { - msg = "can't send non-None value to a just-started async generator"; - #endif - } else { - msg = "can't send non-None value to a just-started generator"; - } - PyErr_SetString(PyExc_TypeError, msg); -} -#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL) -static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) { - #ifdef __Pyx_Coroutine_USED - if (!closing && __Pyx_Coroutine_Check(gen)) { - PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); - } else - #endif - if (value) { - #ifdef __Pyx_AsyncGen_USED - if (__Pyx_AsyncGen_CheckExact(gen)) - PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); - else - #endif - PyErr_SetNone(PyExc_StopIteration); - } -} -static -PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) { - __Pyx_PyThreadState_declare - PyThreadState *tstate; - __Pyx_ExcInfoStruct *exc_state; - PyObject *retval; - assert(!self->is_running); - if (unlikely(self->resume_label == 0)) { - if (unlikely(value && value != Py_None)) { - return __Pyx_Coroutine_NotStartedError((PyObject*)self); - } - } - if (unlikely(self->resume_label == -1)) { - return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); - } -#if CYTHON_FAST_THREAD_STATE - __Pyx_PyThreadState_assign - tstate = __pyx_tstate; -#else - tstate = __Pyx_PyThreadState_Current; -#endif - exc_state = &self->gi_exc_state; - if (exc_state->exc_type) { - #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON - #else - if (exc_state->exc_traceback) { - PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback; - PyFrameObject *f = tb->tb_frame; - assert(f->f_back == NULL); - #if PY_VERSION_HEX >= 0x030B00A1 - f->f_back = PyThreadState_GetFrame(tstate); - #else - Py_XINCREF(tstate->frame); - f->f_back = tstate->frame; - #endif - } - #endif - } -#if CYTHON_USE_EXC_INFO_STACK - exc_state->previous_item = tstate->exc_info; - tstate->exc_info = exc_state; -#else - if (exc_state->exc_type) { - __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); - } else { - __Pyx_Coroutine_ExceptionClear(exc_state); - __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); - } -#endif - self->is_running = 1; - retval = self->body((PyObject *) self, tstate, value); - self->is_running = 0; -#if CYTHON_USE_EXC_INFO_STACK - exc_state = &self->gi_exc_state; - tstate->exc_info = exc_state->previous_item; - exc_state->previous_item = NULL; - __Pyx_Coroutine_ResetFrameBackpointer(exc_state); -#endif - return retval; -} -static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { - PyObject *exc_tb = exc_state->exc_traceback; - if (likely(exc_tb)) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON -#else - PyTracebackObject *tb = (PyTracebackObject *) exc_tb; - PyFrameObject *f = tb->tb_frame; - Py_CLEAR(f->f_back); -#endif - } -} -static CYTHON_INLINE -PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) { - if (unlikely(!retval)) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (!__Pyx_PyErr_Occurred()) { - PyObject *exc = PyExc_StopIteration; - #ifdef __Pyx_AsyncGen_USED - if (__Pyx_AsyncGen_CheckExact(gen)) - exc = __Pyx_PyExc_StopAsyncIteration; - #endif - __Pyx_PyErr_SetNone(exc); - } - } - return retval; -} -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) -static CYTHON_INLINE -PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { -#if PY_VERSION_HEX <= 0x030A00A1 - return _PyGen_Send(gen, arg); -#else - PyObject *result; - if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { - if (PyAsyncGen_CheckExact(gen)) { - assert(result == Py_None); - PyErr_SetNone(PyExc_StopAsyncIteration); - } - else if (result == Py_None) { - PyErr_SetNone(PyExc_StopIteration); - } - else { - _PyGen_SetStopIterationValue(result); - } - Py_CLEAR(result); - } - return result; -#endif -} -#endif -static CYTHON_INLINE -PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { - PyObject *ret; - PyObject *val = NULL; - __Pyx_Coroutine_Undelegate(gen); - __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); - ret = __Pyx_Coroutine_SendEx(gen, val, 0); - Py_XDECREF(val); - return ret; -} -static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { - PyObject *retval; - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(gen->is_running)) - return __Pyx_Coroutine_AlreadyRunningError(gen); - if (yf) { - PyObject *ret; - gen->is_running = 1; - #ifdef __Pyx_Generator_USED - if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Coroutine_Send(yf, value); - } else - #endif - #ifdef __Pyx_Coroutine_USED - if (__Pyx_Coroutine_Check(yf)) { - ret = __Pyx_Coroutine_Send(yf, value); - } else - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_PyAsyncGenASend_CheckExact(yf)) { - ret = __Pyx_async_gen_asend_send(yf, value); - } else - #endif - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) - if (PyGen_CheckExact(yf)) { - ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); - } else - #endif - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) - if (PyCoro_CheckExact(yf)) { - ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); - } else - #endif - { - if (value == Py_None) - ret = Py_TYPE(yf)->tp_iternext(yf); - else - ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); - } - gen->is_running = 0; - if (likely(ret)) { - return ret; - } - retval = __Pyx_Coroutine_FinishDelegation(gen); - } else { - retval = __Pyx_Coroutine_SendEx(gen, value, 0); - } - return __Pyx_Coroutine_MethodReturn(self, retval); -} -static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { - PyObject *retval = NULL; - int err = 0; - #ifdef __Pyx_Generator_USED - if (__Pyx_Generator_CheckExact(yf)) { - retval = __Pyx_Coroutine_Close(yf); - if (!retval) - return -1; - } else - #endif - #ifdef __Pyx_Coroutine_USED - if (__Pyx_Coroutine_Check(yf)) { - retval = __Pyx_Coroutine_Close(yf); - if (!retval) - return -1; - } else - if (__Pyx_CoroutineAwait_CheckExact(yf)) { - retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL); - if (!retval) - return -1; - } else - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_PyAsyncGenASend_CheckExact(yf)) { - retval = __Pyx_async_gen_asend_close(yf, NULL); - } else - if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { - retval = __Pyx_async_gen_athrow_close(yf, NULL); - } else - #endif - { - PyObject *meth; - gen->is_running = 1; - meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close_2); - if (unlikely(!meth)) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_WriteUnraisable(yf); - } - PyErr_Clear(); - } else { - retval = PyObject_CallFunction(meth, NULL); - Py_DECREF(meth); - if (!retval) - err = -1; - } - gen->is_running = 0; - } - Py_XDECREF(retval); - return err; -} -static PyObject *__Pyx_Generator_Next(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(gen->is_running)) - return __Pyx_Coroutine_AlreadyRunningError(gen); - if (yf) { - PyObject *ret; - gen->is_running = 1; - #ifdef __Pyx_Generator_USED - if (__Pyx_Generator_CheckExact(yf)) { - ret = __Pyx_Generator_Next(yf); - } else - #endif - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) - if (PyGen_CheckExact(yf)) { - ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); - } else - #endif - #ifdef __Pyx_Coroutine_USED - if (__Pyx_Coroutine_Check(yf)) { - ret = __Pyx_Coroutine_Send(yf, Py_None); - } else - #endif - ret = Py_TYPE(yf)->tp_iternext(yf); - gen->is_running = 0; - if (likely(ret)) { - return ret; - } - return __Pyx_Coroutine_FinishDelegation(gen); - } - return __Pyx_Coroutine_SendEx(gen, Py_None, 0); -} -static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) { - return __Pyx_Coroutine_Close(self); -} -static PyObject *__Pyx_Coroutine_Close(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - PyObject *retval, *raised_exception; - PyObject *yf = gen->yieldfrom; - int err = 0; - if (unlikely(gen->is_running)) - return __Pyx_Coroutine_AlreadyRunningError(gen); - if (yf) { - Py_INCREF(yf); - err = __Pyx_Coroutine_CloseIter(gen, yf); - __Pyx_Coroutine_Undelegate(gen); - Py_DECREF(yf); - } - if (err == 0) - PyErr_SetNone(PyExc_GeneratorExit); - retval = __Pyx_Coroutine_SendEx(gen, NULL, 1); - if (unlikely(retval)) { - const char *msg; - Py_DECREF(retval); - if ((0)) { - #ifdef __Pyx_Coroutine_USED - } else if (__Pyx_Coroutine_Check(self)) { - msg = "coroutine ignored GeneratorExit"; - #endif - #ifdef __Pyx_AsyncGen_USED - } else if (__Pyx_AsyncGen_CheckExact(self)) { -#if PY_VERSION_HEX < 0x03060000 - msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)"; -#else - msg = "async generator ignored GeneratorExit"; -#endif - #endif - } else { - msg = "generator ignored GeneratorExit"; - } - PyErr_SetString(PyExc_RuntimeError, msg); - return NULL; - } - raised_exception = PyErr_Occurred(); - if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) { - if (raised_exception) PyErr_Clear(); - Py_INCREF(Py_None); - return Py_None; - } - return NULL; -} -static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, - PyObject *args, int close_on_genexit) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - PyObject *yf = gen->yieldfrom; - if (unlikely(gen->is_running)) - return __Pyx_Coroutine_AlreadyRunningError(gen); - if (yf) { - PyObject *ret; - Py_INCREF(yf); - if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { - int err = __Pyx_Coroutine_CloseIter(gen, yf); - Py_DECREF(yf); - __Pyx_Coroutine_Undelegate(gen); - if (err < 0) - return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); - goto throw_here; - } - gen->is_running = 1; - if (0 - #ifdef __Pyx_Generator_USED - || __Pyx_Generator_CheckExact(yf) - #endif - #ifdef __Pyx_Coroutine_USED - || __Pyx_Coroutine_Check(yf) - #endif - ) { - ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); - #ifdef __Pyx_Coroutine_USED - } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { - ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); - #endif - } else { - PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); - if (unlikely(!meth)) { - Py_DECREF(yf); - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { - gen->is_running = 0; - return NULL; - } - PyErr_Clear(); - __Pyx_Coroutine_Undelegate(gen); - gen->is_running = 0; - goto throw_here; - } - if (likely(args)) { - ret = PyObject_CallObject(meth, args); - } else { - ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL); - } - Py_DECREF(meth); - } - gen->is_running = 0; - Py_DECREF(yf); - if (!ret) { - ret = __Pyx_Coroutine_FinishDelegation(gen); - } - return __Pyx_Coroutine_MethodReturn(self, ret); - } -throw_here: - __Pyx_Raise(typ, val, tb, NULL); - return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); -} -static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { - PyObject *typ; - PyObject *val = NULL; - PyObject *tb = NULL; - if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) - return NULL; - return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); -} -static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { - Py_VISIT(exc_state->exc_type); - Py_VISIT(exc_state->exc_value); - Py_VISIT(exc_state->exc_traceback); - return 0; -} -static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { - Py_VISIT(gen->closure); - Py_VISIT(gen->classobj); - Py_VISIT(gen->yieldfrom); - return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); -} -static int __Pyx_Coroutine_clear(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - Py_CLEAR(gen->closure); - Py_CLEAR(gen->classobj); - Py_CLEAR(gen->yieldfrom); - __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); -#ifdef __Pyx_AsyncGen_USED - if (__Pyx_AsyncGen_CheckExact(self)) { - Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); - } -#endif - Py_CLEAR(gen->gi_code); - Py_CLEAR(gen->gi_frame); - Py_CLEAR(gen->gi_name); - Py_CLEAR(gen->gi_qualname); - Py_CLEAR(gen->gi_modulename); - return 0; -} -static void __Pyx_Coroutine_dealloc(PyObject *self) { - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - PyObject_GC_UnTrack(gen); - if (gen->gi_weakreflist != NULL) - PyObject_ClearWeakRefs(self); - if (gen->resume_label >= 0) { - PyObject_GC_Track(self); -#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE - if (PyObject_CallFinalizerFromDealloc(self)) -#else - Py_TYPE(gen)->tp_del(self); - if (Py_REFCNT(self) > 0) -#endif - { - return; - } - PyObject_GC_UnTrack(self); - } -#ifdef __Pyx_AsyncGen_USED - if (__Pyx_AsyncGen_CheckExact(self)) { - /* We have to handle this case for asynchronous generators - right here, because this code has to be between UNTRACK - and GC_Del. */ - Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); - } -#endif - __Pyx_Coroutine_clear(self); - PyObject_GC_Del(gen); -} -static void __Pyx_Coroutine_del(PyObject *self) { - PyObject *error_type, *error_value, *error_traceback; - __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; - __Pyx_PyThreadState_declare - if (gen->resume_label < 0) { - return; - } -#if !CYTHON_USE_TP_FINALIZE - assert(self->ob_refcnt == 0); - __Pyx_SET_REFCNT(self, 1); -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); -#ifdef __Pyx_AsyncGen_USED - if (__Pyx_AsyncGen_CheckExact(self)) { - __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; - PyObject *finalizer = agen->ag_finalizer; - if (finalizer && !agen->ag_closed) { - PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); - if (unlikely(!res)) { - PyErr_WriteUnraisable(self); - } else { - Py_DECREF(res); - } - __Pyx_ErrRestore(error_type, error_value, error_traceback); - return; - } - } -#endif - if (unlikely(gen->resume_label == 0 && !error_value)) { -#ifdef __Pyx_Coroutine_USED -#ifdef __Pyx_Generator_USED - if (!__Pyx_Generator_CheckExact(self)) -#endif - { - PyObject_GC_UnTrack(self); -#if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat) - if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) - PyErr_WriteUnraisable(self); -#else - {PyObject *msg; - char *cmsg; - #if CYTHON_COMPILING_IN_PYPY - msg = NULL; - cmsg = (char*) "coroutine was never awaited"; - #else - char *cname; - PyObject *qualname; - qualname = gen->gi_qualname; - cname = PyString_AS_STRING(qualname); - msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname); - if (unlikely(!msg)) { - PyErr_Clear(); - cmsg = (char*) "coroutine was never awaited"; - } else { - cmsg = PyString_AS_STRING(msg); - } - #endif - if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) - PyErr_WriteUnraisable(self); - Py_XDECREF(msg);} -#endif - PyObject_GC_Track(self); - } -#endif - } else { - PyObject *res = __Pyx_Coroutine_Close(self); - if (unlikely(!res)) { - if (PyErr_Occurred()) - PyErr_WriteUnraisable(self); - } else { - Py_DECREF(res); - } - } - __Pyx_ErrRestore(error_type, error_value, error_traceback); -#if !CYTHON_USE_TP_FINALIZE - assert(Py_REFCNT(self) > 0); - if (--self->ob_refcnt == 0) { - return; - } - { - Py_ssize_t refcnt = Py_REFCNT(self); - _Py_NewReference(self); - __Pyx_SET_REFCNT(self, refcnt); - } -#if CYTHON_COMPILING_IN_CPYTHON - assert(PyType_IS_GC(Py_TYPE(self)) && - _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); - _Py_DEC_REFTOTAL; -#endif -#ifdef COUNT_ALLOCS - --Py_TYPE(self)->tp_frees; - --Py_TYPE(self)->tp_allocs; -#endif -#endif -} -static PyObject * -__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) -{ - PyObject *name = self->gi_name; - if (unlikely(!name)) name = Py_None; - Py_INCREF(name); - return name; -} -static int -__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = self->gi_name; - Py_INCREF(value); - self->gi_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) -{ - PyObject *name = self->gi_qualname; - if (unlikely(!name)) name = Py_None; - Py_INCREF(name); - return name; -} -static int -__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = self->gi_qualname; - Py_INCREF(value); - self->gi_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) -{ - PyObject *frame = self->gi_frame; - if (!frame) { - if (unlikely(!self->gi_code)) { - Py_RETURN_NONE; - } - frame = (PyObject *) PyFrame_New( - PyThreadState_Get(), /*PyThreadState *tstate,*/ - (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (unlikely(!frame)) - return NULL; - self->gi_frame = frame; - } - Py_INCREF(frame); - return frame; -} -static __pyx_CoroutineObject *__Pyx__Coroutine_New( - PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, - PyObject *name, PyObject *qualname, PyObject *module_name) { - __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); - if (unlikely(!gen)) - return NULL; - return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); -} -static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( - __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, - PyObject *name, PyObject *qualname, PyObject *module_name) { - gen->body = body; - gen->closure = closure; - Py_XINCREF(closure); - gen->is_running = 0; - gen->resume_label = 0; - gen->classobj = NULL; - gen->yieldfrom = NULL; - gen->gi_exc_state.exc_type = NULL; - gen->gi_exc_state.exc_value = NULL; - gen->gi_exc_state.exc_traceback = NULL; -#if CYTHON_USE_EXC_INFO_STACK - gen->gi_exc_state.previous_item = NULL; -#endif - gen->gi_weakreflist = NULL; - Py_XINCREF(qualname); - gen->gi_qualname = qualname; - Py_XINCREF(name); - gen->gi_name = name; - Py_XINCREF(module_name); - gen->gi_modulename = module_name; - Py_XINCREF(code); - gen->gi_code = code; - gen->gi_frame = NULL; - PyObject_GC_Track(gen); - return gen; -} - -/* PatchModuleWithCoroutine */ -static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { -#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - int result; - PyObject *globals, *result_obj; - globals = PyDict_New(); if (unlikely(!globals)) goto ignore; - result = PyDict_SetItemString(globals, "_cython_coroutine_type", - #ifdef __Pyx_Coroutine_USED - (PyObject*)__pyx_CoroutineType); - #else - Py_None); - #endif - if (unlikely(result < 0)) goto ignore; - result = PyDict_SetItemString(globals, "_cython_generator_type", - #ifdef __Pyx_Generator_USED - (PyObject*)__pyx_GeneratorType); - #else - Py_None); - #endif - if (unlikely(result < 0)) goto ignore; - if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; - if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; - result_obj = PyRun_String(py_code, Py_file_input, globals, globals); - if (unlikely(!result_obj)) goto ignore; - Py_DECREF(result_obj); - Py_DECREF(globals); - return module; -ignore: - Py_XDECREF(globals); - PyErr_WriteUnraisable(module); - if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { - Py_DECREF(module); - module = NULL; - } -#else - py_code++; -#endif - return module; -} - -/* PatchGeneratorABC */ -#ifndef CYTHON_REGISTER_ABCS -#define CYTHON_REGISTER_ABCS 1 -#endif -#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) -static PyObject* __Pyx_patch_abc_module(PyObject *module); -static PyObject* __Pyx_patch_abc_module(PyObject *module) { - module = __Pyx_Coroutine_patch_module( - module, "" -"if _cython_generator_type is not None:\n" -" try: Generator = _module.Generator\n" -" except AttributeError: pass\n" -" else: Generator.register(_cython_generator_type)\n" -"if _cython_coroutine_type is not None:\n" -" try: Coroutine = _module.Coroutine\n" -" except AttributeError: pass\n" -" else: Coroutine.register(_cython_coroutine_type)\n" - ); - return module; -} -#endif -static int __Pyx_patch_abc(void) { -#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - static int abc_patched = 0; - if (CYTHON_REGISTER_ABCS && !abc_patched) { - PyObject *module; - module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); - if (!module) { - PyErr_WriteUnraisable(NULL); - if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, - ((PY_MAJOR_VERSION >= 3) ? - "Cython module failed to register with collections.abc module" : - "Cython module failed to register with collections module"), 1) < 0)) { - return -1; - } - } else { - module = __Pyx_patch_abc_module(module); - abc_patched = 1; - if (unlikely(!module)) - return -1; - Py_DECREF(module); - } - module = PyImport_ImportModule("backports_abc"); - if (module) { - module = __Pyx_patch_abc_module(module); - Py_XDECREF(module); - } - if (!module) { - PyErr_Clear(); - } - } -#else - if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL); -#endif - return 0; -} - -/* Generator */ -static PyMethodDef __pyx_Generator_methods[] = { - {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, - (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, - {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, - (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, - {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, - (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, - {0, 0, 0, 0} -}; -static PyMemberDef __pyx_Generator_memberlist[] = { - {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, - {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, - (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, - {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, - {0, 0, 0, 0, 0} -}; -static PyGetSetDef __pyx_Generator_getsets[] = { - {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, - (char*) PyDoc_STR("name of the generator"), 0}, - {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, - (char*) PyDoc_STR("qualified name of the generator"), 0}, - {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, - (char*) PyDoc_STR("Frame of the generator"), 0}, - {0, 0, 0, 0, 0} -}; -static PyTypeObject __pyx_GeneratorType_type = { - PyVarObject_HEAD_INIT(0, 0) - "generator", - sizeof(__pyx_CoroutineObject), - 0, - (destructor) __Pyx_Coroutine_dealloc, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, - 0, - (traverseproc) __Pyx_Coroutine_traverse, - 0, - 0, - offsetof(__pyx_CoroutineObject, gi_weakreflist), - 0, - (iternextfunc) __Pyx_Generator_Next, - __pyx_Generator_methods, - __pyx_Generator_memberlist, - __pyx_Generator_getsets, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if CYTHON_USE_TP_FINALIZE - 0, -#else - __Pyx_Coroutine_del, -#endif - 0, -#if CYTHON_USE_TP_FINALIZE - __Pyx_Coroutine_del, -#elif PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 - 0, -#endif -}; -static int __pyx_Generator_init(void) { - __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; - __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); - if (unlikely(!__pyx_GeneratorType)) { - return -1; - } - return 0; -} - /* CStringEquals */ static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) { while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } diff --git a/src/pyrfc/_cyrfc.pyx b/src/pyrfc/_cyrfc.pyx index d75fee8..dacdb5e 100755 --- a/src/pyrfc/_cyrfc.pyx +++ b/src/pyrfc/_cyrfc.pyx @@ -6,13 +6,3114 @@ from libc.stdlib cimport malloc, free from libc.stdint cimport uintptr_t +from collections.abc import Iterable +from datetime import date, time, datetime +from decimal import Decimal +from enum import Enum, auto +from locale import localeconv +from os.path import isfile, join +from sys import exc_info, platform +import socket +from threading import Thread, Timer from . csapnwrfc cimport * from . _exception import * +from . _utils import enum_names, enum_values -include "config.pyx" -include "nwrfcsdk.pyx" -include "data_container.pyx" -include "client.pyx" -include "server.pyx" -include "throughput.pyx" + +################################################################################ +# Configuration options +################################################################################ + +# configuration bitmasks, internal use +_MASK_DTIME = 0x01 +_MASK_RETURN_IMPORT_PARAMS = 0x02 +_MASK_RSTRIP = 0x04 + +_LOCALE_RADIX = localeconv()["decimal_point"] + +################################################################################ +# Enumerators, external and internal use +################################################################################ + + +# RFC parameter direction +class RfcParameterDirection(Enum): + RFC_IMPORT = RFC_DIRECTION.RFC_IMPORT + RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT + RFC_CHANGING = RFC_DIRECTION.RFC_CHANGING + RFC_TABLES = RFC_DIRECTION.RFC_TABLES + + +# RFC field type +class RfcFieldType(Enum): + RFCTYPE_CHAR = RFCTYPE.RFCTYPE_CHAR + RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE + RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD + RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME + RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE + RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE + RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM + RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT + RFCTYPE_INT = RFCTYPE.RFCTYPE_INT + RFCTYPE_INT2 = RFCTYPE.RFCTYPE_INT2 + RFCTYPE_INT1 = RFCTYPE.RFCTYPE_INT1 + RFCTYPE_NULL = RFCTYPE.RFCTYPE_NULL + RFCTYPE_ABAPOBJECT = RFCTYPE.RFCTYPE_ABAPOBJECT + RFCTYPE_STRUCTURE = RFCTYPE.RFCTYPE_STRUCTURE + RFCTYPE_DECF16 = RFCTYPE.RFCTYPE_DECF16 + RFCTYPE_DECF34 = RFCTYPE.RFCTYPE_DECF34 + RFCTYPE_XMLDATA = RFCTYPE.RFCTYPE_XMLDATA + RFCTYPE_STRING = RFCTYPE.RFCTYPE_STRING + RFCTYPE_XSTRING = RFCTYPE.RFCTYPE_XSTRING + RFCTYPE_INT8 = RFCTYPE.RFCTYPE_INT8 + RFCTYPE_UTCLONG = RFCTYPE.RFCTYPE_UTCLONG + RFCTYPE_UTCSECOND = RFCTYPE.RFCTYPE_UTCSECOND + RFCTYPE_UTCMINUTE = RFCTYPE.RFCTYPE_UTCMINUTE + RFCTYPE_DTDAY = RFCTYPE.RFCTYPE_DTDAY + RFCTYPE_DTWEEK = RFCTYPE.RFCTYPE_DTWEEK + RFCTYPE_DTMONTH = RFCTYPE.RFCTYPE_DTMONTH + RFCTYPE_TSECOND = RFCTYPE.RFCTYPE_TSECOND + RFCTYPE_TMINUTE = RFCTYPE.RFCTYPE_TMINUTE + RFCTYPE_CDAY = RFCTYPE.RFCTYPE_CDAY + + +# bgRFC unit state +class UnitState(Enum): + not_found = RFC_UNIT_STATE.RFC_UNIT_NOT_FOUND + in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS + committed = RFC_UNIT_STATE.RFC_UNIT_COMMITTED + rolled_back = RFC_UNIT_STATE.RFC_UNIT_ROLLED_BACK + confirmed = RFC_UNIT_STATE.RFC_UNIT_CONFIRMED + created = auto() + executed = auto() + + +# bgRFC status +class RCStatus(Enum): + OK = RFC_RC.RFC_OK + RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND + RFC_EXTERNAL_FAILURE = RFC_RC.RFC_EXTERNAL_FAILURE + RFC_EXECUTED = RFC_RC.RFC_EXECUTED + + +# bgRFCunit call type +class UnitCallType(Enum): + synchronous = RFC_CALL_TYPE.RFC_SYNCHRONOUS + transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL + queued = RFC_CALL_TYPE.RFC_QUEUED + background_unit = RFC_CALL_TYPE.RFC_BACKGROUND_UNIT + +################################################################################ +# NW RFC SDK FUNCTIONALITY +################################################################################ + + +def get_nwrfclib_version(): + """Get SAP NW RFC Lib version + :returns: tuple of major, minor and patch level and OS platform + """ + cdef unsigned major = 0 + cdef unsigned minor = 0 + cdef unsigned patchlevel = 0 + RfcGetVersion(&major, &minor, &patchlevel) + return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} + + +def set_ini_file_directory(path_name): + """Sets the directory in which to search for the sapnwrfc.ini file + + :param path_name: Directory in which to search for the sapnwrfc.ini file. + :type path_name: string + + :return: nothing, raises an error + """ + if type(path_name) is not str: + raise TypeError('sapnwrfc.ini path is not a string:', path_name) + cdef RFC_ERROR_INFO errorInfo + cdef SAP_UC pathName [512] + if not isfile(join(path_name, "sapnwrfc.ini")): + raise TypeError('sapnwrfc.ini not found in:', path_name) + pathName = fillString(path_name) + cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + + +def reload_ini_file(): + """Reloads the contents of the sapnwrfc.ini file into memory. + + Searches the directory given by ``RfcSetIniPath()`` (or the current working directory) + for the file sapnwrfc.ini and loads its contents into memory. Reloading the sapnwrfc.ini + file is only necessary after the file has been manually edited. + If you want to use a sapnwrfc.ini file in a different location, consider using ``RfcSetIniPath()``. + + Note: If a file with the name ``sapnwrfc.ini`` does not exist in the given directory, + this is not considered an error! Default settings are used in this case. + + :return: nothing, raises an error + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc = RfcReloadIniFile (&errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + + +def language_iso_to_sap(lang_iso): + """Language code conversion of ISO code to SAP code. + + :param lang_iso: Language ISO code + :type lang_iso: string + + :return: SAP language code of char 1 type + + :raises: :exc:`~pyrfc.RFCError` or a subclass + if ISO to SAP code conversion fails. + """ + cdef SAP_UC *uclang_iso = fillString(lang_iso) + cdef SAP_UC uclang_sap[8] + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc = RfcLanguageIsoToSap(uclang_iso, uclang_sap, &errorInfo) + free(uclang_iso) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return wrapString(uclang_sap, 1) + + +def language_sap_to_iso(lang_sap): + """Language code conversion of SAP code to ISO code. + + :param lang_sap: Language SAP code + :type lang_sap: string + + :return: ISO language code + + :raises: :exc:`~pyrfc.RFCError` or a subclass + if SAP to ISO code conversion fails. + """ + cdef SAP_UC *uclang_sap = fillString(lang_sap) + cdef SAP_UC uclang_iso[16] + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc = RfcLanguageSapToIso(uclang_sap, uclang_iso, &errorInfo) + free(uclang_sap) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return wrapString(uclang_iso, 2) + + +def set_cryptolib_path(path_name): + """Sets the absolute path to the sapcrypto library to enable TLS encryption via Websocket Rfc. + + The parameter path_name needs also to contain the name of the library. + This function has the same effect as the sapnwrfc.ini parameter TLS_SAPCRYPTOLIB. + This API cannot reset a new path to the library during runtime. Once set, the path is definitive. + + :param path_name: Absolute path to crypto library + :type path_name: string + + :return: nothing, raises an error + """ + if type(path_name) is not str: + raise TypeError('sapnwrfc.ini path is not a string:', path_name) + cdef RFC_ERROR_INFO errorInfo + cdef SAP_UC pathName [512] + if not isfile(path_name): + raise TypeError('Crypto library not found:', path_name) + pathName = fillString(path_name) + cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + + +def set_locale_radix(value=None): + """Sets the locale radix for decimal conversions. + + :param value: Locale radix like ``.`` or ``,`` + :type path_name: string + + :return: New radix set + """ + global _LOCALE_RADIX + if value is None: + value = localeconv()['decimal_point'] + _LOCALE_RADIX = value + return _LOCALE_RADIX + + +cdef _cancel_connection(client_connection): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + if client_connection.handle is not None: + rc = RfcCancel(client_connection.handle, &errorInfo) + if rc != RFC_OK or errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + + +def cancel_connection(client_connection): + """Immediately cancels the RFC call which is currently being called over the given RFC connection + and closes the connection. Can be used only on an RFC client connection. + + RFC call cancellation with timeout can be done automatically, without using this method explicitely. + The ``timeout`` option can be at connection level, when creating connection instance, or at RFC call level, as + RFC ``Connection.call()`` option. Either way, the connection will be cancelled if RFC call takes longer than ``timeout`` seconds. + + :param client_connection: RFC client connection instance to be cancelled + :type client_connection: Connection + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection cannot be cancelled cleanly. + """ + Thread(target=_cancel_connection, args=(client_connection,)).start() + + +################################################################################ +# CONNECTION PARAMETERS +################################################################################ + + +cdef class ConnectionParameters: + """Connection parameters instance in SAP unicode format + + :param args: Connection parameters like ASHOST="ABC" etc + :type args: positional + + :returns: Nothing + """ + cdef unsigned _params_count + cdef RFC_CONNECTION_PARAMETER *_params + + def __cinit__(self, **params): + self._params_count = len(params) + if self._params_count < 1: + raise RFCError("Connection parameters missing") + self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) + cdef int i = 0 + for name, value in params.iteritems(): + self._params[i].name = fillString(name) + self._params[i].value = fillString(value) + i += 1 + + def __del__(self): + self._free() + + def _free(self): + if self._params_count > 0: + for i in range(self._params_count): + free(self._params[i].name) + free( self._params[i].value) + free(self._params) + self._params_count = 0 + +################################################################################ +# Type Description +################################################################################ + + +class TypeDescription(object): + """ A type description + + This class wraps the RFC_TYPE_DESC_HANDLE as e.g. contained in + a parameter description of a function description. + + :param name: Name of the type. + :param nuc_length: Length of the type in non unicode systems. + :param uc_length: Length of the type in unicode systems. + + *Attributes and methods* + + **name** + The name of the function. + + **nuc_length** + The length in bytes if chars are non unicode. + + **uc_length** + The length in bytes if chars are unicode. + + **fields** + The fields as a list of dicts. + + """ + def __init__(self, name, nuc_length, uc_length): + self.fields = [] + if len(name)<1 or len(name)>30: + raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") + for int_field in [nuc_length, uc_length]: + if type(int_field) not in [int, long]: + raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") + self.name = name + self.nuc_length = nuc_length + self.uc_length = uc_length + + def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, + uc_offset, decimals=0, type_description=None): + """ Adds a field to the type description. + + :param name: Field name + :type name: string (30) + :param field_type: RfcFieldType enum name + :type field_type: string + :param nuc_length: NUC length + :type nuc_length: int + :param uc_length: UC length + :type uc_length: int + :param nuc_offset: NUC offset. + :type nuc_offset: int + :param uc_offset: UC offset. + :type uc_offset: int + :param decimals: Decimals (default=0) + :type decimals: int + :param type_description: An object of class TypeDescription or None (default=None) + :type type_description: object of class TypeDescription + """ + if len(name)<1: + return None + if len(name)>30: + raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") + if field_type not in enum_names(RfcFieldType): + raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") + for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: + if not isinstance(int_field, (int, long)): + raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") + self.fields.append({ + 'name': name, + 'field_type': field_type, + 'nuc_length': nuc_length, + 'nuc_offset': nuc_offset, + 'uc_length': uc_length, + 'uc_offset': uc_offset, + 'decimals': decimals, + 'type_description': type_description + }) + + def __repr__(self): + return f"" + +################################################################################ +# Function Description +################################################################################ + + +class FunctionDescription(object): + """ A function description + + This class wraps the RFC_FUNCTION_DESC_HANDLE as e.g. returned by + RfcGetFunctionDesc() and used for server functionality. + + .. WARNING:: + + Actually, the function description does not support exceptions + (cf. RfcAddException() etc.) + + :param name: Name of the function. + + + *Attributes and methods* + + **name** + The name of the function. + + **parameters** + The parameters as a list of dicts. + + """ + def __init__(self, name): + self.name = name + self.parameters = [] + + def add_parameter(self, name, parameter_type, direction, nuc_length, + uc_length, decimals=0, default_value="", parameter_text="", + optional=False, type_description=None): + """ Adds a parameter to the function description. + + :param name: Parameter name + :type name: string (30) + :param parameter_type: RfcFieldType enum name + :type parameter_type: string + :param direction: RfcParameterDirection enum name + :type direction: string + :param nuc_length: NUC length + :type nuc_length: int + :param uc_length: UC length + :type uc_length: int + :param decimals: Decimals (default=0) + :type decimals: int + :param default_value: Default value (default="") + :type default_value: string (30) + :param parameter_text: Parameter text (default="") + :type parameter_text: string (79) + :param optional: Is the parameter optional (default=False) + :type optional: bool + :param type_description: An object of class TypeDescription or None (default=None) + :type type_description: object of class TypeDescription + """ + if len(name)<1 or len(name)>30: + raise TypeError(f"field 'name' (string) {name} should be from 1-30 chars.") + if parameter_type not in enum_names(RfcFieldType): + raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") + if direction not in enum_names(RfcParameterDirection): + raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") + if len(default_value)>30: + raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") + if len(parameter_text)>79: + raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") + self.parameters.append({ + 'name': name, + 'parameter_type': parameter_type, + 'direction': direction, + 'nuc_length': nuc_length, + 'uc_length': uc_length, + 'decimals': decimals, + 'default_value': default_value, + 'parameter_text': parameter_text, + 'optional': optional, + 'type_description': type_description + }) + + def __repr__(self): + return f"" + +# NOTES ON ERROR HANDLING +# If an error occurs within a connection object, the error may - depending +# on the error code - affect the status of the connection object. +# Therefore, the _error() method is called instead of raising the error +# directly. +# However, updating the connection status is not possible in the +# fill/wrap-functions, as there is no connection object available. But this +# should not be a problem as we do not expect connection-affecting errors if +# no connection is present. +# +# NOTES ON NOGIL: +# NW RFC Lib function call may take a while (e.g. invoking RFC), +# other threads may be blocked meanwhile. To avoid this, some statements +# calling NW RFC Lib functions are executed within a "with nogil:" block, +# thereby releasing the Python global interpreter lock (GIL). + +################################################################################ +# CLIENT CONNECTION +################################################################################ + + +cdef class Connection: + """ A connection to an SAP backend system + + Instantiating an :class:`pyrfc.Connection` object will + automatically attempt to open a connection the SAP backend. + + :param config: Configuration of the client connection, valid for all RFC calls of given connection. Allowed keys are: + + * ``dtime`` + ABAP DATE and TIME strings are returned as Python datetime date and time objects, + instead of ABAP date and time strings (default is False) + + * ``rstrip`` + right strips strings returned from RFC call (default is True) + + * ``return_import_params`` + importing parameters are returned by the RFC call (default is False) + + * ``timeout`` + Cancel connection if ongoing RFC calls takes longer than ``timeout`` seconds. + Timeout can be also set as option for particular RFC call, overriding timeout set at connection level. + + Examples: https://github.com/SAP/PyRFC/tree/main/examples/timeout + + + :type config: dict or None (default) + + :param params: SAP connection parameters. The parameters consist of + ``client``, ``user``, ``passwd``, ``lang``, ``trace`` + and additionally one of + + * Direct application server logon: ``ashost``, ``sysnr``. + * Logon with load balancing: ``mshost``, ``msserv``, ``sysid``, + ``group``. + ``msserv`` is needed only, if the service of the message server + is not defined as sapms in /etc/services. + * When logging on with SNC, ``user`` and ``passwd`` are to be replaced by + ``snc_qop``, ``snc_myname``, ``snc_partnername``, and optionally + ``snc_lib``. + (If ``snc_lib`` is not specified, the RFC library uses the "global" GSS library + defined via environment variable SNC_LIB.) + :type params: Keyword parameters + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection attempt fails. + """ + cdef unsigned __bconfig + cdef public dict __config + cdef bint active_transaction + cdef bint active_unit + cdef RFC_CONNECTION_HANDLE _handle + cdef RFC_TRANSACTION_HANDLE _tHandle + cdef RFC_UNIT_HANDLE _uHandle + cdef ConnectionParameters _connection + + @property + def version(self): + """Get SAP NW RFC SDK and PyRFC binding versions + :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version + """ + cdef unsigned major = 0 + cdef unsigned minor = 0 + cdef unsigned patchlevel = 0 + RfcGetVersion(&major, &minor, &patchlevel) + return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} + + @property + def options(self): + """Client connection configuration + + :getter: Client connection options + :setter: Set when new connection object created + :type: dict + """ + return self.__config + + @property + def handle(self): + """Get client connection handle + + :getter: Client connection handle + :type: uintptr_t + """ + return self._handle if self._handle is not NULL else None + + @property + def alive(self): + """Conection alive property + + :getter: True when alive + :type: boolean + """ + return self._handle != NULL + + def __init__(self, config=None, **params): + # check and set connection configuration + config = config or {} + for k in config: + if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: + raise RFCError(f"Connection configuration option '{k}' is not supported") + self.__config = {} + self.__config['dtime'] = config.get('dtime', False) + self.__config['return_import_params'] = config.get('return_import_params', False) + self.__config['rstrip'] = config.get('rstrip', True) + self.__config['timeout'] = config.get('timeout', None) + + # set internal configuration + self.__bconfig = 0 + if self.__config['dtime']: + self.__bconfig |= _MASK_DTIME + if self.__config['return_import_params']: + self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS + if self.__config['rstrip']: + self.__bconfig |= _MASK_RSTRIP + + self._connection = ConnectionParameters(**params) + self._handle = NULL + self.active_transaction = False + self.active_unit = False + self._open() + + def free(self): + """ Explicitly free connection parameters and close the connection. + + Note that this is usually required because the object destruction + can be delayed by the garbage collection and problems may occur + when too many connections are opened. + """ + self.__del__() + + def __del__(self): + self._close() + self._connection._free() + + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + # Although the _close() method is also called in the destructor, the + # explicit call assures the immediate closing to the connection. + self._close() + + def open(self): + """ Open client the connection + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection cannot be opened. + """ + self._open() + + def reopen(self): + """ Re-open client the connection + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection cannot be re-opened. + """ + self._reopen() + + def close(self): + """ Close the connection + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection cannot be closed cleanly. + """ + self._close() + + def cancel(self): + """ Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection cannot be cancelled cleanly. + """ + cancel_connection(self) + + def __bool__(self): + return self.alive + + cdef _reopen(self): + self._close() + self._open() + + cdef _open(self): + cdef RFC_ERROR_INFO errorInfo + with nogil: + self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) + if not self._handle: + self._error(&errorInfo) + + def _close(self): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + if self._handle != NULL: + rc = RfcCloseConnection(self._handle, &errorInfo) + self._handle = NULL + if rc != RFC_OK: + self._error(&errorInfo) + + cdef _error(self, RFC_ERROR_INFO* errorInfo): + """ + Error treatment of a connection. + + :param errorInfo: the errorInfo data given in a RFC that returned an RC > 0. + :return: nothing, raises an error + """ + # Set alive=false if the error is in a certain group + # Before, the alive=false setting depended on the error code. However, the group seems more robust here. + # errorInfo.code in + # RFC_COMMUNICATION_FAILURE, RFC_ABAP_MESSAGE, RFC_ABAP_RUNTIME_FAILURE, + # RFC_INVALID_HANDLE, RFC_NOT_FOUND, RFC_INVALID_PARAMETER: + # if errorInfo.group in (ABAP_RUNTIME_FAILURE, LOGON_FAILURE, COMMUNICATION_FAILURE, EXTERNAL_RUNTIME_FAILURE): + # self.alive = False + + raise wrapError(errorInfo) + + def ping(self): + """ Send a RFC Ping through the current connection + + Returns nothing. + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the RFC Ping fails. + """ + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + rc = RfcPing(self._handle, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + + def reset_server_context(self): + """ Resets the SAP server context ("user context / ABAP session context") + associated with the given client connection, but does not close the connection + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof in case resetting the server context fails. + (Better close the connection in that case.). + :exc:`sapnwrf2.CommunicationError` if no conversion + was found for the + """ + + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + rc = RfcResetServerContext(self._handle, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + + def get_connection_attributes(self): + """ Get connection details + + :returns: Mapping of connection information keys: + + * active_unit: True if there is a filled and submitted unit w/o being confirmed or destroyed. + * dest: RFC destination + * host: Own host name + * partnerHost: Partner host name + * sysNumber: R/3 system number + * sysId: R/3 system ID + * client: Client ("Mandant") + * user: User + * language: Language + * trace: Trace level (0-3) + * isoLanguage: 2-byte ISO-Language + * codepage: Own code page + * partnerCodepage: Partner code page + * rfcRole: C/S: RFC Client / RFC Server + * type: 2/3/E/R: R/2,R/3,Ext,Reg.Ext + * partnerType: 2/3/E/R: R/2,R/3,Ext,Reg.Ext + * rel: My system release + * partnerRe: Partner system release + * kernelRel: Partner kernel release + * cpicConvId: CPI-C Conversation ID + * progName: Name calling APAB program (report, module pool) + * partnerBytesPerChar: Bytes per char in backend codepage. + * partnerSystemCodepage: Partner system code page + * reserved: Reserved for later use + + Note: all values, except ``active_unit`` are right stripped string values. + + :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if the RFC call fails. + """ + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_ATTRIBUTES attributes + + result = {} + + if self.is_valid(): + rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + + result = wrapConnectionAttributes(attributes) + result.update({ + 'active_unit': self.active_unit or self.active_transaction + }) + return result + + def is_valid(self): + """Checks an RFC connection. Can be used to check whether a client/server connection + has already been closed, or whether the NW RFC library still "considers" the connection + to be open. + + .. note:: + This does not guarantee that the connection is indeed still alive: + A firewall may silently have closed the connection without notifying + the endpoints. If you want to find out, whether the connection is still alive, + you'll have to use the more expensive RfcPing(). + + :returns: boolean + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_INT isValid + + rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) + + if rc != RFC_OK or errorInfo.code != RFC_OK: + return False + return True + + # def c_handle_test(self, p_handle): + # print("p:handle", p_handle) + # cdef RFC_CONNECTION_HANDLE c_handle = p_handle + # p_handle2 = c_handle + # print("p:handle ", p_handle2) + # print("c:handle", "ok" if c_handle - self._handle == 0 else "error") + + def get_function_description(self, func_name): + """ Returns a function description of a function module. + + :param func_name: Name of the function module whose description + will be returned. + :type func_name: string + + :return: A :class:`FunctionDescription` object. + """ + cdef RFC_ERROR_INFO errorInfo + funcName = fillString(func_name.upper()) + cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + free(funcName) + if not funcDesc: + self._error(&errorInfo) + return wrapFunctionDescription(funcDesc) + + def call(self, func_name, options=None, **params): + """ Invokes a remote-enabled function module via RFC. + + :param func_name: Name of the function module that will be invoked. + :type func_name: string + + :param options: Call options for single remote ABAP function call. Allowed keys: + + - ``not_requested`` Allows to deactivate certain parameters in the function module interface. + This is particularly useful for BAPIs which have many large tables, the Python client is not interested in. + Deactivate those, to reduce network traffic and memory consumption in your application considerably. + + This functionality can be used for input and output parameters. If the parameter is an input, no data for + that parameter will be sent to the backend. If it's an output, the backend will be informed not to return + data for that parameter. + + - ``timeout`` Cancel RFC connection if ongoing RFC call not completed within ``timeout`` seconds. + Timeout can be also set as client connection configuration option, in which case is valid for all RFC calls. + + Examples: https://github.com/SAP/PyRFC/tree/main/examples/timeout + + :type options: dictionary + + :param params: Parameter of the function module. All non optional + IMPORT, CHANGING, and TABLE parameters must be provided. + :type params: keyword arguments + + :return: Dictionary with all EXPORT, CHANGING, and TABLE parameters. + The IMPORT parameters are also given, if :attr:`Connection.config.return_import_params` + is set to ``True``. + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the RFC call fails. + """ + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_ERROR_INFO openErrorInfo + cdef SAP_UC *cName + if type(func_name) is not str: + raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) + cdef SAP_UC *funcName = fillString(func_name) + if self._handle == NULL: + raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") + cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + free(funcName) + if not funcDesc: + self._error(&errorInfo) + cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) + if not funcCont: + self._error(&errorInfo) + cdef int isActive = 0 + options = options or {} + try: # now we have a function module + if 'not_requested' in options: + skip_parameters = options['not_requested'] + if type(skip_parameters) is not list: + skip_parameters = [skip_parameters] + for name in skip_parameters: + cName = fillString(name) + rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) + free(cName) + if rc != RFC_OK: + self._error(&errorInfo) + # set connection timeout, starts before writing input parameters to container + cancel_timer = None + timeout = options.get('timeout', self.__config['timeout']) + if timeout is not None: + cancel_timer = Timer(timeout, cancel_connection, (self,)) + cancel_timer.start() + for name, value in params.iteritems(): + fillFunctionParameter(funcDesc, funcCont, name, value) + # save old handle for troubleshooting + with nogil: + rc = RfcInvoke(self._handle, funcCont, &errorInfo) + if cancel_timer is not None: + cancel_timer.cancel() + # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) + if rc != RFC_OK: + if errorInfo.code in ( + RFC_COMMUNICATION_FAILURE, + RFC_ABAP_RUNTIME_FAILURE, + RFC_ABAP_MESSAGE, + RFC_EXTERNAL_FAILURE + ) or errorInfo.group in ( + ABAP_RUNTIME_FAILURE, + LOGON_FAILURE, + COMMUNICATION_FAILURE, + EXTERNAL_RUNTIME_FAILURE): + # Connection closed, re-open + closed_handle = self.handle + self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) + if openErrorInfo.code != RFC_OK: + self._handle = NULL + # Communication error returned as error + errorInfo = openErrorInfo + elif errorInfo.code == RFC_CANCELED: + errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") + self._error(&errorInfo) + if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: + return wrapResult(funcDesc, funcCont, 0, self.__bconfig) + else: + return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) + finally: + RfcDestroyFunction(funcCont, NULL) + + ########################################################################## + # HELPER METHODS + + def type_desc_get(self, type_name): + """Removes the Type Description from SAP NW RFC Lib cache + + :param type_name: system id (connection parameters sysid) + :type type_name: string + + :returns: error code + """ + cdef RFC_ERROR_INFO errorInfo + typeName = fillString(type_name.upper()) + cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) + free(typeName) + if typeDesc == NULL: + self._error(&errorInfo) + return wrapTypeDescription(typeDesc) + + def type_desc_remove(self, sysid, type_name): + """Removes the Type Description from SAP NW RFC Lib cache + + :param sysid: system id (connection parameters sysid) + :type sysid: string + + :param type_name: Name of the type to be removed + :type func_name: string + + :returns: error code + """ + cdef RFC_ERROR_INFO errorInfo + sysId = fillString(sysid) + typeName = fillString(type_name) + cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) + free(sysId) + free(typeName) + if rc != RFC_OK: + self._error(&errorInfo) + return rc + + def func_desc_remove(self, sysid, func_name): + """Removes the Function Description from SAP NW RFC Lib cache + + :param sysid: system id (connection parameters sysid) + :type sysid: string + + :param func_name: Name of the function module to be removed + :type func_name: string + + :returns: error code + """ + cdef RFC_ERROR_INFO errorInfo + sysId = fillString(sysid) + funcName = fillString(func_name) + cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) + free(sysId) + free(funcName) + if rc != RFC_OK: + self._error(&errorInfo) + return rc + + ########################################################################## + # TRANSACTIONAL / QUEUED RFC + + def _get_transaction_id(self): + """ Returns a unique 24 char transaction ID (GUID).""" + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_TID tid + + if not self.alive: + self._open() + rc = RfcGetTransactionID(self._handle, tid, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + return wrapString(tid, RFC_TID_LN) + + def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): + # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef SAP_UC* queueName + cdef RFC_FUNCTION_DESC_HANDLE funcDesc + cdef RFC_FUNCTION_HANDLE funcCont + + if not self.alive: + self._open() + + tid = fillString(transaction_id) + queueName = NULL + if queue_name: + queueName = fillString(queue_name) + self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) + + if queue_name: + free(queueName) + free(tid) + if self._tHandle == NULL: + self._error(&errorInfo) + self.active_transaction = True + + try: + for func_name, params in calls: + funcName = fillString(func_name) + funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + free(funcName) + if not funcDesc: + self._error(&errorInfo) + funcCont = RfcCreateFunction(funcDesc, &errorInfo) + if not funcCont: + self._error(&errorInfo) + try: + for name, value in params.iteritems(): + fillFunctionParameter(funcDesc, funcCont, name, value) + # Add RFC call to transaction + rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + finally: + RfcDestroyFunction(funcCont, NULL) + # execute + with nogil: + rc = RfcSubmitTransaction(self._tHandle, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + + except RFCError as e: + # clean up actions + RfcDestroyTransaction(self._tHandle, NULL) + raise + + def _destroy_transaction(self): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + if not self.active_transaction: + raise RFCError("No transaction handle for this connection available.") + if not self.alive: + self._open() + rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + self.active_transaction = False + if rc != RFC_OK: + self._error(&errorInfo) + + def _confirm_transaction(self): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + if not self.active_transaction: + raise RFCError("No transaction handle for this connection available.") + if not self.alive: + self._open() + rc = RfcConfirmTransaction(self._tHandle, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + rc = RfcDestroyTransaction(self._tHandle, &errorInfo) + self.active_transaction = False + if rc != RFC_OK: + self._error(&errorInfo) + + ########################################################################## + # BACKGROUND RFC + + def _get_unit_id(self): + """Returns a unique 32 char bgRFC unit ID (GUID).""" + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_UNITID uid + + if not self.alive: + self._open() + rc = RfcGetUnitID(self._handle, uid, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + return wrapString(uid, RFC_UNITID_LN) + + def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): + # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef int queueNameCount + # cdef const_SAP_UC_ptr* queueNames + cdef SAP_UC** queueNames + cdef RFC_UNIT_ATTRIBUTES unitAttr + cdef RFC_UNIT_IDENTIFIER uIdentifier + cdef RFC_FUNCTION_DESC_HANDLE funcDesc + cdef RFC_FUNCTION_HANDLE funcCont + cdef SAP_UC* sapuc + + if not self.alive: + self._open() + + # uid + uid = fillString(unit_id) + # queue + queue_names = queue_names or [] + if len(queue_names) == 0: + queueNameCount = 0 + queueNames = NULL + else: + queueNameCount = int(len(queue_names)) + queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) + for i, queue_name in enumerate(queue_names): + queueNames[i] = fillString(queue_name) + # attributes + # set default values + memsetR(&unitAttr, 0, sizeof(RFC_UNIT_ATTRIBUTES)) + memsetR(&uIdentifier, 0, sizeof(RFC_UNIT_IDENTIFIER)) + # unitAttr.kernelTrace = 0 (short) If != 0, the backend will write kernel traces, while executing this unit. + # unitAttr.satTrace = 0 (short) If != 0, the backend will keep a "history" for this unit. + # unitAttr.unitHistory = 0 (short) Used only for type Q: If != 0, the unit will be written to the queue, but not processed. + # The unit can then be started manually in the ABAP debugger. + # unitAttr.lock = 0 (short) Used only for type Q: If != 0, the unit will be written to the queue, but not processed. + # The unit can then be started manually in the ABAP debugger. + # unitAttr.noCommitCheck = 0 (short) Per default the backend will check during execution of a unit, + # whether one of the unit's function modules triggers an explicit or implicit COMMIT WORK. + # In this case the unit is aborted with an error, because the transactional + # integrity of this unit cannot be guaranteed. + # By setting "noCommitCheck" to true (!=0), this behavior can be suppressed, + # meaning the unit will be executed anyway, + # even if one of it's function modules "misbehaves" and triggers a COMMIT WORK. + # unitAttr.user[0] = '\0' (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. + # unitAttr.client[0] = '\0' (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". + # unitAttr.tCode[0] = '\0' (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + # unitAttr.program[0] = '\0' (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. + # unitAttr.hostname[0] = '\0' (SAP_UC hostname[40+1]; + # Sender hostname. Used only when the external program is server. + # In the client case the nwrfclib fills this automatically. + # unitAttr.sendingDate[0] = '\0' (RFC_DATE sendingDate; + # Sending date in UTC (GMT-0). Used only when the external program is server. + # In the client case the nwrfclib fills this automatically. + # unitAttr.sendingTime[0] = '\0' (RFC_TIME sendingTime; + # Sending time in UTC (GMT-0). Used only when the external program is server. + # In the client case the nwrfclib fills this automatically. + if attributes is not None: + if 'kernel_trace' in attributes: + unitAttr.kernelTrace = attributes['kernel_trace'] + if 'sat_trace' in attributes: + unitAttr.satTrace = attributes['sat_trace'] + if 'unit_history' in attributes: + unitAttr.unitHistory = attributes['unit_history'] + if 'lock' in attributes: + unitAttr.lock = attributes['lock'] + if 'no_commit_check' in attributes: + unitAttr.noCommitCheck = attributes['no_commit_check'] + if 'user' in attributes and attributes['user'] is not None: + # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. + sapuc = fillString(attributes['user'][0:12]) + strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) + free(sapuc) + if 'client' in attributes: + # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". + sapuc = fillString(attributes['client'][0:3]) + strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) + free(sapuc) + if 't_code' in attributes: + # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". + sapuc = fillString(attributes['t_code'][0:20]) + strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) + free(sapuc) + if 'program' in attributes and attributes['program'] is not None: + # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. + sapuc = fillString(attributes['program'][0:40]) + strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) + free(sapuc) + + self._uHandle = RfcCreateUnit(self._handle, uid, queueNames, queueNameCount, &unitAttr, &uIdentifier, &errorInfo) + + # queue (deallocate) + if len(queue_names) > 0: + for i, queue_name in enumerate(queue_names): + free(queueNames[i]) + free(queueNames) + # uid (deallocate) + free(uid) + + if self._uHandle == NULL: + self._error(&errorInfo) + self.active_unit = True + + try: + for func_name, params in calls: + funcName = fillString(func_name) + funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) + free(funcName) + if not funcDesc: + self._error(&errorInfo) + funcCont = RfcCreateFunction(funcDesc, &errorInfo) + if not funcCont: + self._error(&errorInfo) + try: + for name, value in params.iteritems(): + fillFunctionParameter(funcDesc, funcCont, name, value) + # Add RFC call to unit + rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + finally: + RfcDestroyFunction(funcCont, NULL) + # execute + print (" Invocation finished. submitting unit.") + with nogil: + rc = RfcSubmitUnit(self._uHandle, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + + except RFCError as e: + # clean up actions + RfcDestroyUnit(self._uHandle, NULL) + raise + + unit_identifier = wrapUnitIdentifier(uIdentifier) + return unit_identifier["queued"] + + def _get_unit_state(self, unit): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) + cdef RFC_UNIT_STATE state + + if not self.active_unit: + raise RFCError("No unit handle for this connection available.") + if not self.alive: + self._open() + rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + if state not in enum_values(UnitState): + raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") + return UnitState(state).name + + def _destroy_unit(self): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + if not self.active_unit: + raise RFCError("No unit handle for this connection available.") + if not self.alive: + self._open() + rc = RfcDestroyUnit(self._uHandle, &errorInfo) + self.active_unit = False + if rc != RFC_OK: + self._error(&errorInfo) + + def _confirm_unit(self, unit): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) + + if not self.active_unit: + raise RFCError("No unit handle for this connection available.") + if not self.alive: + self._open() + rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) + if rc != RFC_OK: + self._error(&errorInfo) + rc = RfcDestroyUnit(self._uHandle, &errorInfo) + self.active_unit = False + if rc != RFC_OK: + self._error(&errorInfo) + + ########################################################################## + # UNIT RFC + + # a "unit" for the client is a dictionary with up to three key-value pairs: + # * background - boolean, set on initialize_unit() call + # * id - string 24 or 32 chars, set on initialize_unit() call + # * queued - boolean, set on fill_and_submit_unit() call + + def initialize_unit(self, background=True): + """ Initializes a logical unit of work (LUW), shorthand: unit + + .. warning:: + + The background protocol (bgRFC) is not working in the current version. + Please use only tRFC/qRFC protocols. + + :param background: The bgRFC protocol will be used. If set to False, + the t/qRFC protocol will be used. Note that the bgRFC protocol + has extended functionality. Default: True + :type background: boolean + + :returns: A dictionary describing the unit. + """ + if background is True: # use bgRFC + id = self._get_unit_id() + elif background is False: # classic t/qRFC + id = self._get_transaction_id() + else: + raise RFCError("Argument 'background' must be a boolean value.") + return {'background': background, 'id': id, "queued": False} + + def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): + """ Fills a unit with one or more RFC and submits it to the backend. + + Fills a unit for this connection, prepare the invocation + of multiple RFC function modules in it, and submits the unit + to the backend. + + Afterwards, the unit is still attached to the connection object, + until confirm_unit() or destroy_unit() is called. Until one of these + methods are called, no other unit could be filled and submitted. + + :param unit: a unit descriptor as returned by + :meth:`~pyrfc.Connection.initialize_unit`. + :param calls: a list of call descriptions. Each call description is a + tuple that contains the function name as the first element and + the function arguments in form of a dictionary as the second element. + :param queue_names: + If the unit uses the background protocol, various queue names can + be given (leading to a asynchronous unit, type 'Q'). If parameter + is an empty list or None, a synchronous unit (type 'T') is created. + + If the unit does not use the background protocol, the queue name + may be a list with exactly one element, leading to a qRFC, or + an empty list or None, leading to a tRFC. + :type queue_names: list of strings or None (default) + :param attributes: optional argument for attributes of the unit -- only valid if the background protocol + is used. The attributes dict may contain the following keywords: + + =============== ============================= ======================= ========================================================================================== + keyword default type description + =============== ============================= ======================= ========================================================================================== + kernel_trace 0 int If != 0, the backend will write kernel traces, while executing this unit. + sat_trace 0 int If != 0, the backend will write statistic records, while executing this unit. + unit_history 0 int If != 0, the backend will keep a "history" for this unit. + lock 0 int Used only for type Q: If != 0, the unit will be written to the queue, but not processed. + The unit can then be started manually in the ABAP debugger. + no_commit_check 0 int Per default the backend will check during execution of a unit, whether one of the + unit's function modules triggers an explicit or implicit COMMITWORK. + In this case the unit is aborted with an error, because the transactional integrity of + this unit cannot be guaranteed. By setting "no_commit_check" to true (!=0), this behavior + can be suppressed, meaning the unit will be executed anyway, even if one of it's + function modules "misbehaves" and triggers a COMMIT WORK. + user current operating system user String, len |nbsp| 12 Sender User (optional). + client "000" String, len |nbsp| 3 Sender Client ("Mandant") (optional). + t_code "" String, len |nbsp| 20 Sender Transaction Code (optional). + program current executable name String, len |nbsp| 40 Sender Program (optional). + =============== ============================= ======================= ========================================================================================== + + :type attributes: dict or None (default) + :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if an error + occurred. In this case, the unit is destroyed. + """ + + if type(unit) is not dict or 'id' not in unit or 'background' not in unit: + raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") + if not isinstance(calls, Iterable): + raise TypeError("Parameter 'calls' must be iterable.") + if len(calls)==0: + raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") + for func_name, params in calls: + if type(func_name) is not str or type(params) is not dict: + raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") + if self.active_unit: + raise RFCError("There is an active unit for this connection. " + "Use destroy_unit() " + + "or confirm_unit().") + bg = unit['background'] + unit_id = unit['id'] + + if bg is True: + if len(unit_id) != RFC_UNITID_LN: + raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") + unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) + elif bg is False: + if len(unit_id) != RFC_TID_LN: + raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") + if attributes is not None: + raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") + if queue_names is None or type(queue_names) is list and len(queue_names) == 0: + self._create_and_submit_transaction(unit_id, calls) + unit['queued'] = False + elif len(queue_names) == 1: + queue_name = queue_names[0] + self._create_and_submit_transaction(unit_id, calls, queue_name) + unit['queued'] = True + else: + raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") + else: + raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + return unit + + def get_unit_state(self, unit): + """Retrieves the processing status of the given background unit. + + .. note:: + Only available for background units. + + :param unit: a unit descriptor as returned by + :meth:`~pyrfc.Connection.initialize_unit`. + :return: The state of the current bgRFC unit. Possible values are: + RFC_UNIT_NOT_FOUND + RFC_UNIT_IN_PROCESS + RFC_UNIT_COMMITTED + RFC_UNIT_ROLLED_BACK + RFC_UNIT_CONFIRMED + """ + bg = unit['background'] + if bg is True: + return self._get_unit_state(unit) + elif bg is False: + raise RFCError("No state check possible of non-bgRFC units.") + else: + raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + + def destroy_unit(self, unit): + """ Destroy the current unit. + + E.g. if the completed unit could not be recorded in the frontend. + + :param unit: a unit descriptor as returned by + :meth:`~pyrfc.Connection.initialize_unit`. + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection attempt fails. + """ + bg = unit['background'] + if bg is True: + self._destroy_unit() + elif bg is False: + self._destroy_transaction() + else: + raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + + def confirm_unit(self, unit): + """ Confirm the current unit in the backend. + + This also destroys the unit. + + :param unit: a unit descriptor as returned by + :meth:`~pyrfc.Connection.initialize_unit`. + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection attempt fails. + """ + bg = unit['background'] + if bg is True: + self._confirm_unit(unit) + elif bg is False: + self._confirm_transaction() + else: + raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") + + +################################################################################ +# SERVER FUNCTIONALITY +################################################################################ + +# global information about served functions / callbacks +# "function_name": {"funcDescHandle": FunctionDescription object, +# "callback": Python function, +# "server": Server object) +server_functions = {} + +# global information about served functions / callbacks +# "auth_check": Default authorization check function +# "server_log": Server logging flag, default False +server_context = {} + + +def default_auth_check(func_name=False, request_context = None): + request_context = request_context or {} + _server_log(f"authorization check for '{func_name}'", request_context['server_context']) + return RFC_OK + + +def _server_log(origin, log_message): + if server_context["server_log"]: + print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") + + +cdef class ServerConnection: + cdef ConnectionParameters _connection + cdef RFC_SERVER_HANDLE _handle + cdef public bint debug + cdef public bint rstrip + + def __init__(self, **params): + self._connection = ConnectionParameters(**params) + self._handle = NULL + self._open() + + cdef _open(self): + cdef RFC_ERROR_INFO errorInfo + with nogil: + self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) + if errorInfo.code != RFC_OK: + self._handle = NULL + raise wrapError(&errorInfo) + _server_log("Server connection", f"{self._handle}") + + cdef _close(self): + if self._handle != NULL: + _server_log("Server close", self._handle) + with nogil: + RfcShutdownServer(self._handle, 60, NULL) + RfcDestroyServer(self._handle, NULL) + self._handle = NULL + + def open(self): + self._open() + + def close(self): + self._close() + + def __bool__(self): + return self.alive + + @property + def handle(self): + """Server connection handle + + :getter: Returns server connection handle + :type: uitptr_t + """ + return self._handle + + @property + def alive(self): + """Conection alive property + + :getter: Returns True when alive + :type: boolean + """ + return self._handle != NULL + + def __del__(self): + self._close() + self._connection._free() + +cdef RFC_RC metadataLookup( + const SAP_UC* functionName, + RFC_ATTRIBUTES rfcAttributes, + RFC_FUNCTION_DESC_HANDLE *funcDescHandle + ) with gil: + global server_functions + function_name = wrapString(functionName) + if function_name not in server_functions: + _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") + return RFC_NOT_FOUND + func_metadata = server_functions[function_name] + # callback = func_metadata['callback'] + funcDescHandle[0] = func_metadata['func_desc_handle'] + _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") + return RFC_OK + +cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): + cdef RFC_SERVER_CONTEXT context + cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) + if rc != RFC_OK or serverErrorInfo.code != RFC_OK: + return None + + server_context = { + "call_type": UnitCallType(context.type), + "is_stateful": context.isStateful != 0 + } + if context.type != RFC_SYNCHRONOUS: + server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) + if context.type == RFC_BACKGROUND_UNIT: + server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) + + return server_context + +cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_ATTRIBUTES attributes + cdef RFC_FUNCTION_DESC_HANDLE funcDesc + cdef RFC_ABAP_NAME funcName + + global server_functions + + # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 + context = get_server_context(rfcHandle, serverErrorInfo) + if context is None: + err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" + new_error = ExternalRuntimeError( + message=err_msg, + code=RFC_EXTERNAL_FAILURE + ) + fillError(new_error, serverErrorInfo) + return RFC_EXTERNAL_FAILURE + + funcDesc = RfcDescribeFunction(funcHandle, NULL) + RfcGetFunctionName(funcDesc, funcName, NULL) + + func_name = wrapString(funcName) + if func_name not in server_functions: + _server_log("genericHandler", f"No metadata found for function '{function_name}'") + return RFC_NOT_FOUND + + func_data = server_functions[func_name] + callback = func_data['callback'] + server = func_data['server'] + # func_desc = func_data['func_desc_handle'] + + try: + rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) + if rc != RFC_OK: + _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") + if not server.debug: + raise ExternalRuntimeError(message="Invalid connection handle.") + conn_attr = {} + else: + conn_attr = wrapConnectionAttributes(attributes) + _server_log( + "genericHandler", + "User '{user}' from system '{sysId}' client '{client}' host '{partnerHost}' invokes '{func_name}'" + .format(func_name=func_name, **conn_attr) + ) + + # Context of the request. Might later be extended by activeParameter information. + request_context = { + 'connection_attributes': conn_attr, + 'server_context': context + } + + # Authorization check + auth_function = server_context["auth_check"] + rc = auth_function(func_name, request_context) + if rc != RFC_OK: + new_error = ExternalRuntimeError( + message=f"Authentication exception raised by callback function: '{func_name}'", + code=RFC_EXTERNAL_FAILURE + ) + fillError(new_error, serverErrorInfo) + return RFC_EXTERNAL_FAILURE + + # Filter out variables that are of direction u'RFC_EXPORT' + # (these will be set by the callback function) + func_handle_variables = wrapResult(funcDesc, funcHandle, RFC_EXPORT, server.rstrip) + + # Invoke callback function + result = callback(request_context, **func_handle_variables) + + # Return results + if context["call_type"] != UnitCallType.background_unit: + for name, value in result.iteritems(): + fillFunctionParameter(funcDesc, funcHandle, name, value) + + # Server exception handling: cf. SAP NetWeaver RFC SDK 7.50 + # 5.1 Preparing a Server Program for Receiving RFC Requests + except ExternalRuntimeError as e: # System failure + # Parameter: message (optional: msg_type, msg_class, msg_number, msg_v1-v4) + # returns: RFC_EXTERNAL_FAILURE + fillError(e, serverErrorInfo) + serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. + _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") + return RFC_EXTERNAL_FAILURE + except ABAPRuntimeError as e: # ABAP Message + # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 + # returns: RFC_ABAP_MESSAGE + fillError(e, serverErrorInfo) + serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. + _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") + return RFC_ABAP_MESSAGE + except ABAPApplicationError as e: # ABAP Exception in implementing function + # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) + # returns: RFC_ABAP_EXCEPTION + fillError(e, serverErrorInfo) + serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. + _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") + return RFC_ABAP_EXCEPTION + except Exception as ex: + exctype, value = exc_info()[:2] + _server_log( + "genericHandler", + f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" + "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" + "The values of the request were:\n" + f"params: {func_handle_variables}\nrequest_context: {request_context}" + ) + new_error = ExternalRuntimeError( + message="Invalid exception raised by callback function.", + code=RFC_EXTERNAL_FAILURE + ) + fillError(new_error, serverErrorInfo) + return RFC_EXTERNAL_FAILURE + + return RFC_OK + + +cdef class Server: + """ An ABAP server + + An instance of :class:`~pyrfc.Server` allows for installing + Python callback functions and serve requests from SAP systems. + + :param server_params: Parameters for registering Python server. + The parameters may contain the following keywords: + ``GWHOST`, ``GWSERV``, ``PROGRAM_ID``, ``TRACE``, + and ``SAPROUTER``. + + :type server_params: dict + + :param client_params: Parameters for Python client connection. + The parameters may contain the following keywords: + ``GWHOST`, ``GWSERV``, ``PROGRAM_ID``, ``TRACE``, + and ``SAPROUTER``. + + :type server_params: dict + + :param config: Configuration of the instance. Allowed keys are: + + ``debug`` + For testing/debugging operations. If True, the server + behaves more permissive, e.g. allows incoming calls without a + valid connection handle. (default is False) + + :type config: dict or None (default) + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection attempt fails. + """ + cdef public bint debug + cdef public bint rstrip + cdef Connection _client_connection + cdef ServerConnection _server_connection + cdef object _server_thread + + __bgRfcFunction = { + "check": None, + "commit": None, + "rollback": None, + "confirm": None, + "getState": None + } + + def __cinit__(self, server_params, client_params, config=None): + # config parsing + config = config or {} + self.debug = config.get('debug', False) + self.rstrip = config.get('rstrip', True) + server_context["server_log"] = config.get("server_log", False) + server_context["auth_check"] = config.get("auth_check", default_auth_check) + server_context["port"] = config.get("port", 8080) + + self._client_connection = Connection(**client_params) + self._server_connection = ServerConnection(**server_params) + self._server_thread=Thread(target=self.serve) + + @staticmethod + cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + handler = Server.__bgRfcFunction["check"] + if handler is None: + return RCStatus.OK.value + try: + unit_identifier = wrapUnitIdentifier(identifier[0]) + return handler(rfcHandle, unit_identifier).value + except Exception as ex: + _server_log("Error in bgRFC handler onCheck:", ex) + return RCStatus.RFC_EXTERNAL_FAILURE.value + + @staticmethod + cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + handler = Server.__bgRfcFunction["commit"] + if handler is None: + return RCStatus.OK.value + try: + unit_identifier = wrapUnitIdentifier(identifier[0]) + return handler(rfcHandle, unit_identifier).value + except Exception as ex: + _server_log("Error in bgRFC handler onCommit:", ex) + return RCStatus.RFC_EXTERNAL_FAILURE.value + + @staticmethod + cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + handler = Server.__bgRfcFunction["rollback"] + if handler is None: + return RCStatus.OK.value + try: + unit_identifier = wrapUnitIdentifier(identifier[0]) + return handler(rfcHandle, unit_identifier).value + except Exception as ex: + _server_log("Error in bgRFC handler onRollback:", ex) + return RCStatus.RFC_EXTERNAL_FAILURE.value + + @staticmethod + cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: + handler = Server.__bgRfcFunction["confirm"] + if handler is None: + return RCStatus.OK.value + try: + unit_identifier = wrapUnitIdentifier(identifier[0]) + return handler(rfcHandle, unit_identifier).value + except Exception as ex: + _server_log("Error in bgRFC handler onConfirm:", ex) + return RCStatus.RFC_EXTERNAL_FAILURE.value + + @staticmethod + cdef RFC_RC __onGetStateFunction( + RFC_CONNECTION_HANDLE rfcHandle, + const RFC_UNIT_IDENTIFIER *identifier, + RFC_UNIT_STATE *unitState + ) with gil: + handler = Server.__bgRfcFunction["getState"] + if handler is None: + _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") + return RCStatus.RFC_EXTERNAL_FAILURE.value + try: + unit_identifier = wrapUnitIdentifier(identifier[0]) + state = handler(rfcHandle, unit_identifier) + # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 + if state == UnitState.created or state == UnitState.executed: + unitState[0] = RFC_UNIT_IN_PROCESS + elif state == UnitState.committed: + idunitStateentifier[0] = RFC_UNIT_COMMITTED + elif state == UnitState.rolled_back: + unitState[0] = RFC_UNIT_ROLLED_BACK + elif state == UnitState.confirmed: + unitState[0] = RFC_UNIT_CONFIRMED + else: + raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") + return RCStatus.OK.value + except Exception as ex: + _server_log("Error in bgRFC handler onGetState:\n", ex) + return RCStatus.RFC_EXTERNAL_FAILURE.value + + def bgrfc_init(self, sysId, bgRfcFunction): + """Installs the necessary callback functions for processing incoming bgRFC calls. + + These functions need to be implemented by Python application and will be used by the RFC runtime. + When no callback function is provided, the default one is used, + not necessarily matching your application requirements. + + For more info search for the ``RfcInstallBgRfcHandlers`` method in + `SAP NetWeaver RFC SDK Doxygen Documentation `_ + + :param sysId: System ID of the SAP system for which to use this set of transaction handlers, or None + When None value provided, the transaction handlers will be used for bgRFC calls from + any backend system, for which no explicit handlers have been installed. + :type sysId: string or None + + :param bgRfcFunction: Function callbacks + :type bgRfcFunction: dict(str, function) + + * "check": onCheckFunction, + * "commit": onCommitFunction, + * "rollback": onRollbackFunction, + * "confirm": onConfirmFunction, + * "getState": onGetStateFunction, + + :return: error code, zero when no error + """ + for func_name in bgRfcFunction: + if func_name not in Server.__bgRfcFunction: + raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") + if not callable(bgRfcFunction[func_name]): + raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") + Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] + return self.install_bgrfc_handlers(sysId) + + def install_bgrfc_handlers(self, sysId): + ucSysId = fillString(sysId) if sysId is not None else NULL + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc = RfcInstallBgRfcHandlers( + ucSysId, + Server.__onCheckFunction, + Server.__onCommitFunction, + Server.__onRollbackFunction, + Server.__onConfirmFunction, + Server.__onGetStateFunction, + &errorInfo + ) + free(ucSysId) + if rc != RFC_OK or errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + return rc + + def add_function(self, func_name, callback): + """ + Installs a function in the server. + + :param func_name: ABAP remote function module name + :type func_name: string + + :param callback: A callback function that implements the logic. + The function must accept a ``request_context`` parameter and + all IMPORT, CHANGING, and TABLE parameters of the given + ``func_desc``. + :raises: :exc:`TypeError` if a function with the name given is already + installed. + """ + global server_functions + if func_name in server_functions: + raise TypeError(f"Server function '{func_name}' already installed.") + + if not self._client_connection: + self._client_connection.open() + cdef RFC_ERROR_INFO errorInfo + cdef RFC_ABAP_NAME funcName = fillString(func_name) + cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) + self._client_connection.close() + + if errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + + server_functions[func_name] = { + "func_desc_handle": func_desc_handle, + "callback": callback, + "server": self + } + + _server_log("Server function installed", func_name) + _server_log("Server function installed", server_functions[func_name]) + + def serve(self): + """ + Starts the RFC server, waiting for incoming requests and processes them. + + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the server processing fails. + """ + cdef RFC_ERROR_INFO errorInfo + + cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) + if rc != RFC_OK or errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + + rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) + if rc != RFC_OK or errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + _server_log("Server", f"launched {self._server_connection.handle}") + + return rc + + def start(self): + """ + Start the RFC server in new thread, waiting for incoming requests and processes them. + """ + self._server_thread.start() + + def stop(self): + """ + Stop the RFC server thread. + """ + if self._server_thread.is_alive(): + self._server_thread.join() + + def close(self): + """ Explicitly close the registration. + Note that this is usually not necessary as the registration will be closed + automatically upon object destruction. However, if the the object destruction + is delayed by the garbage collection, problems may occur when too many + servers are registered. + """ + self.stop() + self._close() + + def get_server_attributes(self): + """Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server. + + :returns: Dictionary with server state and attributes + :rtype: dict(str, str or int) + + * serverName: This server's name as given when creating the server. + * protocolType: This RFC server's type: + RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER + * registrationCount: The current number of active registrations (in case of a Registered Server) + or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) + * state: Used in state information in order to indicate the current state of an RFC Server. + * currentBusyCount: The number of requests currently being processed. + * peakBusyCount: The maximum number of requests the server has been processing in parallel since it has been created + """ + cdef RFC_RC rc + cdef RFC_SERVER_ATTRIBUTES attributes + cdef RFC_ERROR_INFO errorInfo + + rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) + if rc != RFC_OK or errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) + return { + # This server's name as given when creating the server. + 'serverName': wrapString(attributes.serverName, -1, True) + # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER + , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER + else socket.gethostname() # Own host name + # The current number of active registrations (in case of a Registered Server) + # or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) + , 'registrationCount': attributes.registrationCount + # Used in state information in order to indicate the current state of an RFC Server. + , 'state': rfcServerState + # The number of requests currently being processed. + , 'currentBusyCount': attributes.currentBusyCount + # The maximum number of requests the server has been processing in parallel since it has been created + , 'peakBusyCount': attributes.peakBusyCount + } + + def _close(self): + """ Close the connection (private function) + :raises: :exc:`~pyrfc.RFCError` or a subclass + thereof if the connection cannot be closed cleanly. + """ + # Shutdown server + if self._server_connection: + self._server_connection.close() + # Remove all installed server functions + after_remove = {} + global server_functions + for func_name, func_data in server_functions.items(): + if func_data["server"] != self: + after_remove[func_name] = func_data + server_functions = after_remove + + cdef _error(self, RFC_ERROR_INFO* errorInfo): + """ + Error treatment of a connection. + + :param errorInfo: the errorInfo data given in a RFC that returned an RC > 0. + :return: nothing, raises an error + """ + # TODO: Error treatment server + # Set alive=false if the error is in a certain group + # Before, the alive=false setting depended on the error code. However, the group seems more robust here. + # errorInfo.code in + # RFC_COMMUNICATION_FAILURE, RFC_ABAP_MESSAGE, RFC_ABAP_RUNTIME_FAILURE, RFC_INVALID_HANDLE, RFC_NOT_FOUND, RFC_INVALID_PARAMETER: + # if errorInfo.group in (ABAP_RUNTIME_FAILURE, LOGON_FAILURE, COMMUNICATION_FAILURE, EXTERNAL_RUNTIME_FAILURE): + # self.alive = False + + raise wrapError(errorInfo) + + +cdef RFC_TYPE_DESC_HANDLE fillTypeDescription(type_desc): + """ + :param type_desc: object of class TypeDescription + :return: Handle of RFC_TYPE_DESC_HANDLE + """ + cdef RFC_RC rc = RFC_OK + cdef RFC_ERROR_INFO errorInfo + cdef RFC_TYPE_DESC_HANDLE typeDesc + cdef RFC_FIELD_DESC fieldDesc + cdef SAP_UC* sapuc + + # Set name, nuc_length, and uc_length + sapuc = fillString(type_desc.name) + typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) + free(sapuc) + if typeDesc == NULL: + raise wrapError(&errorInfo) + rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) + if rc != RFC_OK: + RfcDestroyTypeDesc(typeDesc, NULL) + raise wrapError(&errorInfo) + + for field_desc in type_desc.fields: + # Set name + sapuc = fillString(field_desc['name']) + strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) + free(sapuc) + fieldDesc.type = RfcFieldType[field_desc['field_type']].value + fieldDesc.nucLength = field_desc['nuc_length'] + fieldDesc.nucOffset = field_desc['nuc_offset'] + fieldDesc.ucLength = field_desc['uc_length'] + fieldDesc.ucOffset = field_desc['uc_offset'] + fieldDesc.decimals = field_desc['decimals'] + if field_desc['type_description'] is not None: + fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) + else: + fieldDesc.typeDescHandle = NULL + fieldDesc.extendedDescription = NULL + rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) + if rc != RFC_OK: + RfcDestroyTypeDesc(typeDesc, NULL) + raise wrapError(&errorInfo) + + return typeDesc + +cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): + """ + :param func_desc: object of class FunctionDescription + :return: Handle of RFC_FUNCTION_DESC_HANDLE + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_FUNCTION_DESC_HANDLE funcDesc + cdef RFC_PARAMETER_DESC paramDesc + cdef SAP_UC* sapuc + + # Set name + sapuc = fillString(func_desc.name) + funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) + free(sapuc) + if funcDesc == NULL: + raise wrapError(&errorInfo) + + for param_desc in func_desc.parameters: + sapuc = fillString(param_desc['name']) + strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) + free(sapuc) + paramDesc.type = RfcFieldType[param_desc['parameter_type']].value + paramDesc.direction = RfcParameterDirection[param_desc['direction']].value + paramDesc.nucLength = param_desc['nuc_length'] + paramDesc.ucLength = param_desc['uc_length'] + paramDesc.decimals = param_desc['decimals'] + # defaultValue + sapuc = fillString(param_desc['default_value']) + strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) + free(sapuc) + # parameterText + sapuc = fillString(param_desc['parameter_text']) + strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) + free(sapuc) + paramDesc.optional = param_desc['optional'] + if param_desc['type_description'] is not None: + paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) + else: + paramDesc.typeDescHandle = NULL + paramDesc.extendedDescription = NULL + rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) + if rc != RFC_OK: + RfcDestroyFunctionDesc(funcDesc, NULL) + raise wrapError(&errorInfo) + + return funcDesc + +cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: + cdef RFC_UNIT_IDENTIFIER uIdentifier + cdef SAP_UC* sapuc + uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] + if len(unit['id']) != RFC_UNITID_LN: + raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") + sapuc = fillString(unit['id']) + strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) + free(sapuc) + return uIdentifier + + +################################################################################ +# THROUGHPUT FUNCTIONS # +################################################################################ + +cdef class Throughput: + _registry = [] + + cdef RFC_THROUGHPUT_HANDLE _throughput_handle + cdef _connections + + def __init__(self, connections = None): + cdef RFC_ERROR_INFO errorInfo + self._throughput_handle = NULL + self._connections = set() + self._throughput_handle = RfcCreateThroughput(&errorInfo) + if errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + Throughput._registry.append(self) + connections = connections or [] + if type(connections) is not list: + connections = [connections] + for conn in connections: + if not isinstance(conn, Connection): + raise TypeError('Connection object required, received', conn, 'of type', type(conn)) + self.setOnConnection(conn) + + @property + def connections(self): + """Get connections attached to throughput monitoring + + :getter: Connections' instances + :type: set of Connection + """ + return self._connections + + @property + def _handle(self): + """Get throughput object handle + + :getter: Throughput object handle + :type: uintptr_t + """ + return self._throughput_handle + + def setOnConnection(self, Connection connection): + """Attaches a throughput object to a connection to be monitored by the throughput object. + Once attached to a connection, the throughput object collects the data statistics of + function calls invoked via this connection. + + For more info search for the ``RfcSetThroughputOnConnection`` method in + `SAP NetWeaver RFC SDK Doxygen Documentation `_ + + :param connection: Connection instance to be attached to throughput monitoring + :type connection: Connection + + :return: nothing, raises an error + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + self._connections.add(connection) + + @staticmethod + def getFromConnection(Connection connection): + """Returns the currently attached throughput object from a connection, if any. + + For more info search for the ``RfcGetThroughputFromConnection`` method in + `SAP NetWeaver RFC SDK Doxygen Documentation `_ + + :param connection: Connection instance + :type connection: Connection + + :returns: Throughput object the connection is attached to, if any + :rtype: Throughput + + :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) + if errorInfo.code != RFC_OK: + raise wrapError(&errorInfo) + for t in Throughput._registry: + if t._handle == throughput: + return t + return None + + def removeFromConnection(self, Connection connection): + """Removes the throughput object from a connection. + The connection will no longer be monitored. + + :param connection: Connection instance + :type connection: Connection + :returns: Nothing + :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + self._connections.remove(connection) + + def reset(self): + """Resets the data so far collected and aggregated by the throughput object. + + :returns: Nothing + :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + + cdef _destroy(self): + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc + self._registry.clear() + self._connections = None + if self._throughput_handle != NULL: + rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) + self._throughput_handle = NULL + if rc != RFC_OK: + # is ok + pass + + def __del__(self): + self.destroy() + + def __exit__(self, type, value, traceback): + self._destroy() + + def __enter__(self): + return self + + @property + def stats(self): + """Get throughput monitor statistics + + :getter: Throughput monitor counters + :type: dict(str,int) + + * numberOfCalls + * sentBytes + * receivedBytes + * applicationTime + * totalTime + * serializationTime + * deserializationTime + """ + cdef RFC_ERROR_INFO errorInfo + cdef RFC_RC rc + cdef SAP_ULLONG numberOfCalls + cdef SAP_ULLONG sentBytes + cdef SAP_ULLONG receivedBytes + cdef SAP_ULLONG applicationTime + cdef SAP_ULLONG totalTime + cdef SAP_ULLONG serializationTime + cdef SAP_ULLONG deserializationTime + + _stats = {} + + if self._throughput_handle == NULL: + raise RFCError('No connections assigned') + + rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + _stats['numberOfCalls'] = numberOfCalls + + rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + _stats['sentBytes'] = sentBytes + + rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + _stats['receivedBytes'] = receivedBytes + + rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + _stats['applicationTime'] = applicationTime + + rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + _stats['totalTime'] = totalTime + + rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + _stats['serializationTime'] = serializationTime + + rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + _stats['deserializationTime'] = deserializationTime + + return _stats + + +################################################################################ +# FILL FUNCTIONS # +################################################################################ + +cdef fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_FUNCTION_HANDLE container, name, value): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_PARAMETER_DESC paramDesc + cName = fillString(name) + rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) + free(cName) + if rc != RFC_OK: + raise wrapError(&errorInfo) + fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) + +cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_FIELD_DESC fieldDesc + cdef SAP_UC* cName = fillString(name) + rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) + free(cName) + if rc != RFC_OK: + raise wrapError(&errorInfo) + fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) + +cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): + cdef RFC_ERROR_INFO errorInfo + cdef RFC_STRUCTURE_HANDLE lineHandle + cdef unsigned int rowCount = int(len(lines)) + cdef unsigned int i = 0 + while i < rowCount: + lineHandle = RfcAppendNewRow(container, &errorInfo) + if not lineHandle: + raise wrapError(&errorInfo) + line = lines[i] + if type(line) is dict: + for name, value in line.iteritems(): + fillStructureField(typeDesc, lineHandle, name, value) + else: + fillStructureField(typeDesc, lineHandle, '', line) + i += 1 + +cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_STRUCTURE_HANDLE struct + cdef RFC_TABLE_HANDLE table + cdef SAP_UC* cValue + cdef SAP_RAW* bValue + global _LOCALE_RADIX + # print ("fill", wrapString(cName), value, type(value)) + try: + if typ == RFCTYPE_STRUCTURE: + if type(value) is not dict: + raise TypeError('dictionary required for structure parameter, received', str(type(value))) + rc = RfcGetStructure(container, cName, &struct, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + for name, value in value.iteritems(): + fillStructureField(typeDesc, struct, name, value) + elif typ == RFCTYPE_TABLE: + if type(value) is not list: + raise TypeError('list required for table parameter, received', str(type(value))) + rc = RfcGetTable(container, cName, &table, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + fillTable(typeDesc, table, value) + elif typ == RFCTYPE_BYTE: + bValue = fillBytes(value) + rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) + free(bValue) + elif typ == RFCTYPE_XSTRING: + bValue = fillBytes(value) + rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) + free(bValue) + elif typ == RFCTYPE_CHAR: + if type(value) is not str: + raise TypeError('an string is required, received', value, 'of type', type(value)) + cValue = fillString(value) + rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) + free(cValue) + elif typ == RFCTYPE_STRING: + if type(value) is not str: + raise TypeError('an string is required, received', value, 'of type', type(value)) + cValue = fillString(value) + rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + free(cValue) + elif typ == RFCTYPE_NUM: + try: + if value.isdigit(): + cValue = fillString(value) + rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) + free(cValue) + else: + raise + except Exception as ex: + raise TypeError('a numeric string is required, received', value, 'of type', type(value)) + elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + # cast to string prevents rounding errors in NWRFC SDK + try: + if type(value) is float or type(value) is Decimal: + svalue = str(value) + else: + # string passed from application should be locale correct, do nothing + svalue = value + # decimal separator must be "." for the Decimal parsing check + locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] + if locale_radix != ".": + Decimal('.'.join(svalue.rsplit(locale_radix, 1))) + else: + Decimal(svalue) + cValue = fillString(svalue) + except Exception as ex: + raise TypeError('a decimal value required, received', value, 'of type', type(value)) + rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + free(cValue) + elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): + if type(value) is not int: + raise TypeError('an integer required, received', value, 'of type', type(value)) + rc = RfcSetInt(container, cName, value, &errorInfo) + elif typ == RFCTYPE_INT8: + if type(value) is not int: + raise TypeError('an integer required, received', value, 'of type', type(value)) + rc = RfcSetInt8(container, cName, value, &errorInfo) + elif typ == RFCTYPE_UTCLONG: + if type(value) is not str: + raise TypeError('an string is required, received', value, 'of type', type(value)) + cValue = fillString(value) + rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) + free(cValue) + elif typ == RFCTYPE_DATE: + if value: + format_ok = True + if type(value) is date: + cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') + else: + try: + if len(value) != 8: + format_ok = False + else: + if len(value.rstrip()) > 0: + date(int(value[:4]), int(value[4:6]), int(value[6:8])) + cValue = fillString(value) + except Exception as ex: + format_ok = False + if not format_ok: + raise TypeError('date value required, received', value, 'of type', type(value)) + rc = RfcSetDate(container, cName, cValue, &errorInfo) + free(cValue) + else: + rc = RFC_OK + elif typ == RFCTYPE_TIME: + if value: + format_ok = True + if type(value) is time: + cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') + else: + try: + if len(value) != 6: + format_ok = False + else: + if len(value.rstrip()) > 0: + time(int(value[:2]), int(value[2:4]), int(value[4:6])) + cValue = fillString(value) + except Exception as ex: + format_ok = False + + if not format_ok: + raise TypeError('time value required, received', value, 'of type', type(value)) + rc = RfcSetTime(container, cName, cValue, &errorInfo) + free(cValue) + else: + rc = RFC_OK + else: + raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) + except TypeError as e: + # This way the field name will be attached in reverse direction + # to the argument list of the exception. This helps users to find + # mistakes easier in complex mapping scenarios. + e.args += (wrapString(cName), ) + raise + if rc != RFC_OK: + raise wrapError(&errorInfo) + +cdef SAP_RAW* fillBytes(pystr) except NULL: + cdef size_t size = len(pystr) + cdef SAP_RAW* bytes = malloc(size) + memcpy(bytes, pystr, size) + return bytes + +cdef fillError(exception, RFC_ERROR_INFO* errorInfo): + group2error = { + ABAPApplicationError: ABAP_APPLICATION_FAILURE, + ABAPRuntimeError: ABAP_RUNTIME_FAILURE, + LogonError: LOGON_FAILURE, + CommunicationError: COMMUNICATION_FAILURE, + ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, + ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, + ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE + } + if type(exception) not in group2error: + raise RFCError("Not a valid error group.") + + errorInfo.group = group2error.get(type(exception)) + + if exception.message: # fixed length, exactly 512 chars + # str = exception.message[0:512].ljust(512) + str = exception.message[0:512] + sapuc = fillString(str) + strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) + free(sapuc) + errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR + if exception.key: # fixed length, exactly 128 chars + str = exception.key[0:128] + sapuc = fillString(str) + strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) + free(sapuc) + if exception.msg_class: + sapuc = fillString(exception.msg_class[0:20]) + strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) + free(sapuc) + if exception.msg_type: + sapuc = fillString(exception.msg_type[0:1]) + strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) + free(sapuc) + if exception.msg_number: + sapuc = fillString(exception.msg_number[0:3]) + strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) + free(sapuc) + if exception.msg_v1: + sapuc = fillString(exception.msg_v1[0:50]) + strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) + free(sapuc) + if exception.msg_v2: + sapuc = fillString(exception.msg_v2[0:50]) + strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) + free(sapuc) + if exception.msg_v3: + sapuc = fillString(exception.msg_v3[0:50]) + strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) + free(sapuc) + if exception.msg_v4: + sapuc = fillString(exception.msg_v4[0:50]) + strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) + free(sapuc) + +cdef SAP_UC* fillString(pyuc) except NULL: + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + ucbytes = pyuc.encode() + cdef unsigned ucbytes_len = len(ucbytes) + cdef unsigned sapuc_size = ucbytes_len + 1 + cdef SAP_UC* sapuc = mallocU(sapuc_size) + sapuc[0] = 0 + cdef unsigned result_len = 0 + if ucbytes_len > 0: + rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return sapuc + +################################################################################ +# WRAPPER FUNCTIONS # +################################################################################ +# wrapper functions take C values and returns Python values + +cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): + return { + 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') + , 'host': wrapString(attributes.host, 100, True).rstrip('\0') + , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') + , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') + , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') + , 'client': wrapString(attributes.client, 3, True).rstrip('\0') + , 'user': wrapString(attributes.user, 12, True).rstrip('\0') + , 'language': wrapString(attributes.language, 2, True).rstrip('\0') + , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') + , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') + , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') + , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') + , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') + , 'type': wrapString(attributes.type, 1).rstrip('\0') + , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') + , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') + , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') + , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') + , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') + , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') + , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') + , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') + , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') + , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') + , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') + } + + +cdef wrapTypeDescription(RFC_TYPE_DESC_HANDLE typeDesc): + """ Parses a RFC_TYPE_DESC_HANDLE + + :param typeDesc: Handle of RFC_TYPE_DESC_HANDLE + :return: object of class TypeDescription + """ + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_FIELD_DESC fieldDesc + cdef RFC_ABAP_NAME typeName + cdef unsigned nuc_length, uc_length + cdef unsigned i, fieldCount + + rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + name = wrapString(typeName) + rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + type_desc = TypeDescription(name, nuc_length, uc_length) + + rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + for i in range(fieldCount): + rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + field_description = { + 'name': wrapString(fieldDesc.name), + 'field_type': RfcFieldType(fieldDesc.type).name, + 'nuc_length': fieldDesc.nucLength, + 'nuc_offset': fieldDesc.nucOffset, + 'uc_length': fieldDesc.ucLength, + 'uc_offset': fieldDesc.ucOffset, + 'decimals': fieldDesc.decimals + } + if fieldDesc.typeDescHandle is NULL: + field_description['type_description'] = None + else: + field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) + # Add field to object + type_desc.add_field(**field_description) + + return type_desc + +cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_ABAP_NAME functionName + cdef unsigned i, paramCount + cdef RFC_PARAMETER_DESC paramDesc + + rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + name = wrapString(functionName) + func_desc = FunctionDescription(name) + + rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + for i in range(paramCount): + rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + parameter_description = { + 'name': wrapString(paramDesc.name), + 'parameter_type': RfcFieldType(paramDesc.type).name, + 'direction': RfcParameterDirection(paramDesc.direction).name, + 'nuc_length': paramDesc.nucLength, + 'uc_length': paramDesc.ucLength, + 'decimals': paramDesc.decimals, + 'default_value': wrapString(paramDesc.defaultValue), + 'parameter_text': wrapString(paramDesc.parameterText), + 'optional': bool(paramDesc.optional) + # skip: void* extendedDescription; + # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. + } + if paramDesc.typeDescHandle is NULL: + parameter_description['type_description'] = None + else: + parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) + func_desc.add_parameter(**parameter_description) + + return func_desc + + +cdef wrapResult( + RFC_FUNCTION_DESC_HANDLE funcDesc, + RFC_FUNCTION_HANDLE container, + RFC_DIRECTION filter_parameter_direction, + config + ): + """ + :param funcDesc: a C pointer to a function description. + :param container: a C pointer to a function container + :param filter_parameter_direction: A RFC_DIRECTION - parameters with this + direction will be excluded. + :param config (rstrip: right strip strings, dtime: return datetime objects) + :return: + """ + cdef unsigned i, paramCount + cdef RFC_PARAMETER_DESC paramDesc + RfcGetParameterCount(funcDesc, ¶mCount, NULL) + result = {} + for i in range(paramCount): + RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) + if paramDesc.direction != filter_parameter_direction: + result[wrapString(paramDesc.name)] = wrapVariable( + paramDesc.type, + container, + paramDesc.name, + paramDesc.nucLength, + paramDesc.typeDescHandle, + config + ) + return result + +cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): + return { + 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), + 'id': wrapString(uIdentifier.unitID) + } + +cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): + unit_attributes = {} + unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 + unit_attributes['sat_trace'] = uattr.satTrace != 0 + unit_attributes['unit_history'] = uattr.unitHistory != 0 + unit_attributes['lock'] = uattr.lock != 0 + unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 + unit_attributes['user'] = wrapString(uattr.user, 12, True) + unit_attributes['client'] = wrapString(uattr.client, 3, True) + unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) + unit_attributes['program'] = wrapString(uattr.program, 40, True) + unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) + unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) + unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) + return unit_attributes + +cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): + cdef unsigned i, fieldCount + cdef RFC_FIELD_DESC fieldDesc + RfcGetFieldCount(typeDesc, &fieldCount, NULL) + result = {} + for i in range(fieldCount): + RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) + result[wrapString(fieldDesc.name)] = wrapVariable( + fieldDesc.type, + container, + fieldDesc.name, + fieldDesc.nucLength, + fieldDesc.typeDescHandle, + config + ) + if len(result) == 1: + if '' in result: + result = result[''] + return result + +# # Used for debugging tables, cf. wrapTable() +# cdef class TableCursor: +# +# cdef RFC_TYPE_DESC_HANDLE typeDesc +# cdef RFC_TABLE_HANDLE container +# +# def __getitem__(self, i): +# cdef RFC_ERROR_INFO errorInfo +# RfcMoveTo(self.container, i, &errorInfo) +# return wrapStructure(self.typeDesc, self.container) + +cdef wrapTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, config): + cdef RFC_ERROR_INFO errorInfo + cdef unsigned rowCount + # # For debugging in tables (cf. class TableCursor) + # tc = TableCursor() + # tc.typeDesc = typeDesc + # tc.container = container + # return tc + RfcGetRowCount(container, &rowCount, &errorInfo) + table = [None] * rowCount + while rowCount > 0: + rowCount -= 1 + RfcMoveTo(container, rowCount, &errorInfo) + table[rowCount] = wrapStructure(typeDesc, container, config) + RfcDeleteCurrentRow(container, &errorInfo) + return table + +cdef wrapVariable( + RFCTYPE typ, + RFC_FUNCTION_HANDLE container, + SAP_UC* cName, + unsigned cLen, + RFC_TYPE_DESC_HANDLE typeDesc, + config + ): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + cdef RFC_STRUCTURE_HANDLE structure + cdef RFC_TABLE_HANDLE table + cdef RFC_CHAR* charValue + cdef SAP_UC* stringValue + cdef RFC_NUM* numValue + cdef SAP_RAW* byteValue + cdef RFC_FLOAT floatValue + cdef RFC_INT intValue + cdef RFC_INT1 int1Value + cdef RFC_INT2 int2Value + cdef RFC_INT8 int8Value + cdef RFC_DATE dateValue + cdef RFC_TIME timeValue + cdef unsigned resultLen, strLen + if typ == RFCTYPE_STRUCTURE: + rc = RfcGetStructure(container, cName, &structure, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return wrapStructure(typeDesc, structure, config) + elif typ == RFCTYPE_TABLE: + rc = RfcGetTable(container, cName, &table, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return wrapTable(typeDesc, table, config) + elif typ == RFCTYPE_CHAR: + charValue = mallocU(cLen) + try: + rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return wrapString(charValue, cLen, config & _MASK_RSTRIP) + finally: + free(charValue) + elif typ == RFCTYPE_STRING: + rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + try: + stringValue = mallocU(strLen+1) + rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return wrapString(stringValue, resultLen) + finally: + free(stringValue) + elif typ == RFCTYPE_NUM: + numValue = mallocU(cLen) + try: + rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return wrapString(numValue, cLen) + finally: + free(numValue) + elif typ == RFCTYPE_BYTE: + byteValue = malloc(cLen) + try: + rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return byteValue[:cLen] + finally: + free(byteValue) + elif typ == RFCTYPE_XSTRING: + rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + try: + byteValue = malloc(strLen+1) + byteValue[strLen] = 0 + rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return byteValue[:resultLen] + finally: + free(byteValue) + elif typ == RFCTYPE_BCD: + # An upper bound for the length of the _string representation_ + # of the BCD is given by (2*cLen)-1 (each digit is encoded in 4bit, + # the first 4 bit are reserved for the sign) + # Furthermore, a sign char, a decimal separator char may be present + # => (2*cLen)+1 + strLen = 2*cLen + 1 + try: + stringValue = mallocU(strLen+1) + rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + if rc == 23: # Buffer too small, use returned requried result length + # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " + # "trying with {}".format(cLen, strLen, resultLen)) + free(stringValue) + strLen = resultLen + stringValue = mallocU(strLen+1) + rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + finally: + free(stringValue) + elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: + # An upper bound for the length of the _string representation_ + # of the DECF is given by (2*cLen)-1 (each digit is encoded in 4bit, + # the first 4 bit are reserved for the sign) + # Furthermore, a sign char, a decimal separator char may be present + # => (2*cLen)+1 + # and exponent char, sign and exponent + # => +9 + strLen = 2*cLen + 10 + try: + stringValue = mallocU(strLen+1) + rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + if rc == 23: # Buffer too small, use returned requried result length + # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " + # "trying with {}".format(cLen, strLen, resultLen)) + free(stringValue) + strLen = resultLen + stringValue = mallocU(strLen+1) + rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) + finally: + free(stringValue) + elif typ == RFCTYPE_FLOAT: + rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return floatValue + elif typ == RFCTYPE_INT: + rc = RfcGetInt(container, cName, &intValue, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return intValue + elif typ == RFCTYPE_INT1: + rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return int1Value + elif typ == RFCTYPE_INT2: + rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return int2Value + elif typ == RFCTYPE_INT8: + rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + return int8Value + elif typ == RFCTYPE_UTCLONG: + # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) + strLen = 27 # is fixed + try: + stringValue = mallocU(strLen+1) + # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds + rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + utcValue = wrapString(stringValue, resultLen) + # replace the "," separator with "." + return utcValue[:19]+'.'+utcValue[20:] + finally: + free(stringValue) + elif typ == RFCTYPE_DATE: + rc = RfcGetDate(container, cName, dateValue, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + value = wrapString(dateValue, 8) + # return date or None + if config & _MASK_DTIME: + if (value == '00000000') or not value: + return None + return datetime.strptime(value, '%Y%m%d').date() + # return date string or '' + if (value == '00000000') or not value: + return '' + return value + elif typ == RFCTYPE_TIME: + rc = RfcGetTime(container, cName, timeValue, &errorInfo) + if rc != RFC_OK: + raise wrapError(&errorInfo) + value = wrapString(timeValue, 6) + # return time or None + if config & _MASK_DTIME: + if not value: + return None + return datetime.strptime(value, '%H%M%S').time() + # return time string or '' + if not value: + return '' + return value + else: + raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) + +cdef wrapError(RFC_ERROR_INFO* errorInfo): + group2error = { + ABAP_APPLICATION_FAILURE: ABAPApplicationError, + ABAP_RUNTIME_FAILURE: ABAPRuntimeError, + LOGON_FAILURE: LogonError, + COMMUNICATION_FAILURE: CommunicationError, + EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, + EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, + EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError + } + error = group2error[errorInfo.group] + return error( + wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), + wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), + wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), + wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) + ) + +cdef wrapString(const SAP_UC* uc, uclen=-1, rstrip=False): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + if uclen == -1: + uclen = strlenU(uc) + if uclen == 0: + return '' + cdef unsigned utf8_size = uclen * 5 + 1 + cdef char *utf8 = malloc(utf8_size) + utf8[0] = 0 + cdef unsigned result_len = 0 + rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + if rc != RFC_OK: + # raise wrapError(&errorInfo) + raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + utf8[result_len] = 0 + try: + if rstrip: + return utf8[:result_len].rstrip().decode() + else: + return utf8[:result_len].decode() + finally: + free(utf8) + +cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): + cdef RFC_RC rc + cdef RFC_ERROR_INFO errorInfo + if uclen == -1: + uclen = strlenU(uc) + if uclen == 0: + return '' + cdef unsigned utf8_size = uclen * 5 + 1 + cdef char *utf8 = malloc(utf8_size) + utf8[0] = 0 + cdef unsigned result_len = 0 + rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) + if rc != RFC_OK: + # raise wrapError(&errorInfo) + raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) + utf8[result_len] = 0 + try: + if rstrip: + return utf8[:result_len].rstrip().decode() + else: + return utf8[:result_len].decode() + finally: + free(utf8) diff --git a/src/pyrfc/_exception.py b/src/pyrfc/_exception.py index 9569202..fc334e4 100755 --- a/src/pyrfc/_exception.py +++ b/src/pyrfc/_exception.py @@ -5,6 +5,9 @@ """ :mod:`pyrfc`-specific exception classes """ +from enum import Enum, auto +from . _utils import enum_values + class RFCError(Exception): """Exception base class @@ -47,15 +50,14 @@ def __init__( self.msg_v4 = msg_v4 def __str__(self): - code = 28 if self.code is None else self.code - rc_text = RFC_RC(code) if code in [item.value for item in RFC_RC] else "???" + code = 28 if self.code is None else self.code # 28 = RFC_UNKNOWN_ERROR + rc_text = RcCodeText(code).value if code in enum_values(RcCodeText) else "??" return ( f"{rc_text} (rc={self.code}): key={self.key}, message={self.message}" f" [MSG: class={self.msg_class}, type={self.msg_type}, number={self.msg_number}," f" v1-4:={self.msg_v1};{self.msg_v2};{self.msg_v3};{self.msg_v4}]" ) - class ABAPApplicationError(RFCLibError): """ABAP application error @@ -167,3 +169,40 @@ class RFCTypeError(RFCLibError): """ pass + + +class RcCodeText(Enum): + RFC_OK = auto() + RFC_COMMUNICATION_FAILURE = auto() + RFC_LOGON_FAILURE = auto() + RFC_ABAP_RUNTIME_FAILURE = auto() + RFC_ABAP_MESSAGE = auto() + RFC_ABAP_EXCEPTION = auto() + RFC_CLOSED = auto() + RFC_CANCELED = auto() + RFC_TIMEOUT = auto() + RFC_MEMORY_INSUFFICIENT = auto() + RFC_VERSION_MISMATCH = auto() + RFC_INVALID_PROTOCOL = auto() + RFC_SERIALIZATION_FAILURE = auto() + RFC_INVALID_HANDLE = auto() + RFC_RETRY = auto() + RFC_EXTERNAL_FAILURE = auto() + RFC_EXECUTED = auto() + RFC_NOT_FOUND = auto() + RFC_NOT_SUPPORTED = auto() + RFC_ILLEGAL_STATE = auto() + RFC_INVALID_PARAMETER = auto() + RFC_CODEPAGE_CONVERSION_FAILURE = auto() + RFC_CONVERSION_FAILURE = auto() + RFC_BUFFER_TOO_SMALL = auto() + RFC_TABLE_MOVE_BOF = auto() + RFC_TABLE_MOVE_EOF = auto() + RFC_START_SAPGUI_FAILURE = auto() + RFC_ABAP_CLASS_EXCEPTION = auto() + RFC_UNKNOWN_ERROR = auto() + RFC_AUTHORIZATION_FAILURE = auto() + RFC_AUTHENTICATION_FAILURE = auto() + RFC_CRYPTOLIB_FAILURE = auto() + RFC_IO_FAILURE = auto() + RFC_LOCKING_FAILURE = auto() diff --git a/src/pyrfc/_utils.py b/src/pyrfc/_utils.py new file mode 100644 index 0000000..4a21559 --- /dev/null +++ b/src/pyrfc/_utils.py @@ -0,0 +1,16 @@ +import pickle + +def enum_names(enum_obj): + return set(e.name for e in enum_obj) + + +def enum_values(enum_obj): + return set(e.value for e in enum_obj) + + +def py_to_string(obj): + return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) + + +def string_to_py(objstr): + return pickle.loads(objstr) diff --git a/src/pyrfc/client.pyx b/src/pyrfc/client.pyx deleted file mode 100644 index 5f61256..0000000 --- a/src/pyrfc/client.pyx +++ /dev/null @@ -1,1009 +0,0 @@ -from collections.abc import Iterable -from sys import platform -from threading import Timer - -# NOTES ON ERROR HANDLING -# If an error occurs within a connection object, the error may - depending -# on the error code - affect the status of the connection object. -# Therefore, the _error() method is called instead of raising the error -# directly. -# However, updating the connection status is not possible in the -# fill/wrap-functions, as there is no connection object available. But this -# should not be a problem as we do not expect connection-affecting errors if -# no connection is present. -# -# NOTES ON NOGIL: -# NW RFC Lib function call may take a while (e.g. invoking RFC), -# other threads may be blocked meanwhile. To avoid this, some statements -# calling NW RFC Lib functions are executed within a "with nogil:" block, -# thereby releasing the Python global interpreter lock (GIL). - -################################################################################ -# CLIENT CONNECTION -################################################################################ - -cdef class Connection: - """ A connection to an SAP backend system - - Instantiating an :class:`pyrfc.Connection` object will - automatically attempt to open a connection the SAP backend. - - :param config: Configuration of the client connection, valid for all RFC calls of given connection. Allowed keys are: - - * ``dtime`` - ABAP DATE and TIME strings are returned as Python datetime date and time objects, - instead of ABAP date and time strings (default is False) - - * ``rstrip`` - right strips strings returned from RFC call (default is True) - - * ``return_import_params`` - importing parameters are returned by the RFC call (default is False) - - * ``timeout`` - Cancel connection if ongoing RFC calls takes longer than ``timeout`` seconds. - Timeout can be also set as option for particular RFC call, overriding timeout set at connection level. - - Examples: https://github.com/SAP/PyRFC/tree/main/examples/timeout - - - :type config: dict or None (default) - - :param params: SAP connection parameters. The parameters consist of - ``client``, ``user``, ``passwd``, ``lang``, ``trace`` - and additionally one of - - * Direct application server logon: ``ashost``, ``sysnr``. - * Logon with load balancing: ``mshost``, ``msserv``, ``sysid``, - ``group``. - ``msserv`` is needed only, if the service of the message server - is not defined as sapms in /etc/services. - * When logging on with SNC, ``user`` and ``passwd`` are to be replaced by - ``snc_qop``, ``snc_myname``, ``snc_partnername``, and optionally - ``snc_lib``. - (If ``snc_lib`` is not specified, the RFC library uses the "global" GSS library - defined via environment variable SNC_LIB.) - :type params: Keyword parameters - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection attempt fails. - """ - cdef unsigned __bconfig - cdef public dict __config - cdef bint active_transaction - cdef bint active_unit - cdef RFC_CONNECTION_HANDLE _handle - cdef RFC_TRANSACTION_HANDLE _tHandle - cdef RFC_UNIT_HANDLE _uHandle - cdef ConnectionParameters _connection - - @property - def version(self): - """Get SAP NW RFC SDK and PyRFC binding versions - :returns: SAP NW RFC SDK major, minor, patch level and PyRFC binding version - """ - cdef unsigned major = 0 - cdef unsigned minor = 0 - cdef unsigned patchlevel = 0 - RfcGetVersion(&major, &minor, &patchlevel) - return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} - - @property - def options(self): - """Client connection configuration - - :getter: Client connection options - :setter: Set when new connection object created - :type: dict - """ - return self.__config - - @property - def handle(self): - """Get client connection handle - - :getter: Client connection handle - :type: uintptr_t - """ - return self._handle if self._handle is not NULL else None - - @property - def alive(self): - """Conection alive property - - :getter: True when alive - :type: boolean - """ - return self._handle != NULL - - def __init__(self, config=None, **params): - # check and set connection configuration - config = config or {} - for k in config: - if k not in['dtime', 'return_import_params', 'rstrip', 'timeout']: - raise RFCError(f"Connection configuration option '{k}' is not supported") - self.__config = {} - self.__config['dtime'] = config.get('dtime', False) - self.__config['return_import_params'] = config.get('return_import_params', False) - self.__config['rstrip'] = config.get('rstrip', True) - self.__config['timeout'] = config.get('timeout', None) - - # set internal configuration - self.__bconfig = 0 - if self.__config['dtime']: - self.__bconfig |= _MASK_DTIME - if self.__config['return_import_params']: - self.__bconfig |= _MASK_RETURN_IMPORT_PARAMS - if self.__config['rstrip']: - self.__bconfig |= _MASK_RSTRIP - - self._connection = ConnectionParameters(**params) - self._handle = NULL - self.active_transaction = False - self.active_unit = False - self._open() - - def free(self): - """ Explicitly free connection parameters and close the connection. - - Note that this is usually required because the object destruction - can be delayed by the garbage collection and problems may occur - when too many connections are opened. - """ - self.__del__() - - def __del__(self): - self._close() - self._connection._free() - - def __enter__(self): - return self - - def __exit__(self, type, value, traceback): - # Although the _close() method is also called in the destructor, the - # explicit call assures the immediate closing to the connection. - self._close() - - def open(self): - """ Open client the connection - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection cannot be opened. - """ - self._open() - - def reopen(self): - """ Re-open client the connection - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection cannot be re-opened. - """ - self._reopen() - - def close(self): - """ Close the connection - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection cannot be closed cleanly. - """ - self._close() - - def cancel(self): - """ Cancels the ongoing RFC call using `~pyrfc.cancel_connection()` function - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection cannot be cancelled cleanly. - """ - cancel_connection(self) - - def __bool__(self): - return self.alive - - cdef _reopen(self): - self._close() - self._open() - - cdef _open(self): - cdef RFC_ERROR_INFO errorInfo - with nogil: - self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &errorInfo) - if not self._handle: - self._error(&errorInfo) - - def _close(self): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - if self._handle != NULL: - rc = RfcCloseConnection(self._handle, &errorInfo) - self._handle = NULL - if rc != RFC_OK: - self._error(&errorInfo) - - cdef _error(self, RFC_ERROR_INFO* errorInfo): - """ - Error treatment of a connection. - - :param errorInfo: the errorInfo data given in a RFC that returned an RC > 0. - :return: nothing, raises an error - """ - # Set alive=false if the error is in a certain group - # Before, the alive=false setting depended on the error code. However, the group seems more robust here. - # errorInfo.code in - # RFC_COMMUNICATION_FAILURE, RFC_ABAP_MESSAGE, RFC_ABAP_RUNTIME_FAILURE, - # RFC_INVALID_HANDLE, RFC_NOT_FOUND, RFC_INVALID_PARAMETER: - # if errorInfo.group in (ABAP_RUNTIME_FAILURE, LOGON_FAILURE, COMMUNICATION_FAILURE, EXTERNAL_RUNTIME_FAILURE): - # self.alive = False - - raise wrapError(errorInfo) - - def ping(self): - """ Send a RFC Ping through the current connection - - Returns nothing. - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the RFC Ping fails. - """ - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - rc = RfcPing(self._handle, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - - def reset_server_context(self): - """ Resets the SAP server context ("user context / ABAP session context") - associated with the given client connection, but does not close the connection - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof in case resetting the server context fails. - (Better close the connection in that case.). - :exc:`sapnwrf2.CommunicationError` if no conversion - was found for the - """ - - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - rc = RfcResetServerContext(self._handle, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - - def get_connection_attributes(self): - """ Get connection details - - :returns: Mapping of connection information keys: - - * active_unit: True if there is a filled and submitted unit w/o being confirmed or destroyed. - * dest: RFC destination - * host: Own host name - * partnerHost: Partner host name - * sysNumber: R/3 system number - * sysId: R/3 system ID - * client: Client ("Mandant") - * user: User - * language: Language - * trace: Trace level (0-3) - * isoLanguage: 2-byte ISO-Language - * codepage: Own code page - * partnerCodepage: Partner code page - * rfcRole: C/S: RFC Client / RFC Server - * type: 2/3/E/R: R/2,R/3,Ext,Reg.Ext - * partnerType: 2/3/E/R: R/2,R/3,Ext,Reg.Ext - * rel: My system release - * partnerRe: Partner system release - * kernelRel: Partner kernel release - * cpicConvId: CPI-C Conversation ID - * progName: Name calling APAB program (report, module pool) - * partnerBytesPerChar: Bytes per char in backend codepage. - * partnerSystemCodepage: Partner system code page - * reserved: Reserved for later use - - Note: all values, except ``active_unit`` are right stripped string values. - - :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if the RFC call fails. - """ - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_ATTRIBUTES attributes - - result = {} - - if self.is_valid(): - rc = RfcGetConnectionAttributes(self._handle, &attributes, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - - result = wrapConnectionAttributes(attributes) - result.update({ - 'active_unit': self.active_unit or self.active_transaction - }) - return result - - def is_valid(self): - """Checks an RFC connection. Can be used to check whether a client/server connection - has already been closed, or whether the NW RFC library still "considers" the connection - to be open. - - .. note:: - This does not guarantee that the connection is indeed still alive: - A firewall may silently have closed the connection without notifying - the endpoints. If you want to find out, whether the connection is still alive, - you'll have to use the more expensive RfcPing(). - - :returns: boolean - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_INT isValid - - rc = RfcIsConnectionHandleValid(self._handle, &isValid, &errorInfo) - - if rc != RFC_OK or errorInfo.code != RFC_OK: - return False - return True - - # def c_handle_test(self, p_handle): - # print("p:handle", p_handle) - # cdef RFC_CONNECTION_HANDLE c_handle = p_handle - # p_handle2 = c_handle - # print("p:handle ", p_handle2) - # print("c:handle", "ok" if c_handle - self._handle == 0 else "error") - - def get_function_description(self, func_name): - """ Returns a function description of a function module. - - :param func_name: Name of the function module whose description - will be returned. - :type func_name: string - - :return: A :class:`FunctionDescription` object. - """ - cdef RFC_ERROR_INFO errorInfo - funcName = fillString(func_name.upper()) - cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - free(funcName) - if not funcDesc: - self._error(&errorInfo) - return wrapFunctionDescription(funcDesc) - - def call(self, func_name, options=None, **params): - """ Invokes a remote-enabled function module via RFC. - - :param func_name: Name of the function module that will be invoked. - :type func_name: string - - :param options: Call options for single remote ABAP function call. Allowed keys: - - - ``not_requested`` Allows to deactivate certain parameters in the function module interface. - This is particularly useful for BAPIs which have many large tables, the Python client is not interested in. - Deactivate those, to reduce network traffic and memory consumption in your application considerably. - - This functionality can be used for input and output parameters. If the parameter is an input, no data for - that parameter will be sent to the backend. If it's an output, the backend will be informed not to return - data for that parameter. - - - ``timeout`` Cancel RFC connection if ongoing RFC call not completed within ``timeout`` seconds. - Timeout can be also set as client connection configuration option, in which case is valid for all RFC calls. - - Examples: https://github.com/SAP/PyRFC/tree/main/examples/timeout - - :type options: dictionary - - :param params: Parameter of the function module. All non optional - IMPORT, CHANGING, and TABLE parameters must be provided. - :type params: keyword arguments - - :return: Dictionary with all EXPORT, CHANGING, and TABLE parameters. - The IMPORT parameters are also given, if :attr:`Connection.config.return_import_params` - is set to ``True``. - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the RFC call fails. - """ - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_ERROR_INFO openErrorInfo - cdef SAP_UC *cName - if type(func_name) is not str: - raise RFCError("Remote function module name must be unicode string, received:", func_name, type(func_name)) - cdef SAP_UC *funcName = fillString(func_name) - if self._handle == NULL: - raise RFCError(f"Remote function module '{func_name}' invocation rejected because the connection is closed") - cdef RFC_FUNCTION_DESC_HANDLE funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - free(funcName) - if not funcDesc: - self._error(&errorInfo) - cdef RFC_FUNCTION_HANDLE funcCont = RfcCreateFunction(funcDesc, &errorInfo) - if not funcCont: - self._error(&errorInfo) - cdef int isActive = 0 - options = options or {} - try: # now we have a function module - if 'not_requested' in options: - skip_parameters = options['not_requested'] - if type(skip_parameters) is not list: - skip_parameters = [skip_parameters] - for name in skip_parameters: - cName = fillString(name) - rc = RfcSetParameterActive(funcCont, cName, isActive, &errorInfo) - free(cName) - if rc != RFC_OK: - self._error(&errorInfo) - # set connection timeout, starts before writing input parameters to container - cancel_timer = None - timeout = options.get('timeout', self.__config['timeout']) - if timeout is not None: - cancel_timer = Timer(timeout, cancel_connection, (self,)) - cancel_timer.start() - for name, value in params.iteritems(): - fillFunctionParameter(funcDesc, funcCont, name, value) - # save old handle for troubleshooting - with nogil: - rc = RfcInvoke(self._handle, funcCont, &errorInfo) - if cancel_timer is not None: - cancel_timer.cancel() - # print("invoke:", errorInfo.group, rc, self.handle, self.is_valid()) - if rc != RFC_OK: - if errorInfo.code in ( - RFC_COMMUNICATION_FAILURE, - RFC_ABAP_RUNTIME_FAILURE, - RFC_ABAP_MESSAGE, - RFC_EXTERNAL_FAILURE - ) or errorInfo.group in ( - ABAP_RUNTIME_FAILURE, - LOGON_FAILURE, - COMMUNICATION_FAILURE, - EXTERNAL_RUNTIME_FAILURE): - # Connection closed, re-open - closed_handle = self.handle - self._handle = RfcOpenConnection(self._connection._params, self._connection._params_count, &openErrorInfo) - if openErrorInfo.code != RFC_OK: - self._handle = NULL - # Communication error returned as error - errorInfo = openErrorInfo - elif errorInfo.code == RFC_CANCELED: - errorInfo.message = fillString(f"Connection was canceled: {closed_handle}. New handle: {self.handle}") - self._error(&errorInfo) - if self.__bconfig & _MASK_RETURN_IMPORT_PARAMS: - return wrapResult(funcDesc, funcCont, 0, self.__bconfig) - else: - return wrapResult(funcDesc, funcCont, RFC_IMPORT, self.__bconfig) - finally: - RfcDestroyFunction(funcCont, NULL) - - ########################################################################## - # HELPER METHODS - - def type_desc_get(self, type_name): - """Removes the Type Description from SAP NW RFC Lib cache - - :param type_name: system id (connection parameters sysid) - :type type_name: string - - :returns: error code - """ - cdef RFC_ERROR_INFO errorInfo - typeName = fillString(type_name.upper()) - cdef RFC_TYPE_DESC_HANDLE typeDesc = RfcGetTypeDesc(self._handle, typeName, &errorInfo) - free(typeName) - if typeDesc == NULL: - self._error(&errorInfo) - return wrapTypeDescription(typeDesc) - - def type_desc_remove(self, sysid, type_name): - """Removes the Type Description from SAP NW RFC Lib cache - - :param sysid: system id (connection parameters sysid) - :type sysid: string - - :param type_name: Name of the type to be removed - :type func_name: string - - :returns: error code - """ - cdef RFC_ERROR_INFO errorInfo - sysId = fillString(sysid) - typeName = fillString(type_name) - cdef RFC_RC rc = RfcRemoveTypeDesc(sysId, typeName, &errorInfo) - free(sysId) - free(typeName) - if rc != RFC_OK: - self._error(&errorInfo) - return rc - - def func_desc_remove(self, sysid, func_name): - """Removes the Function Description from SAP NW RFC Lib cache - - :param sysid: system id (connection parameters sysid) - :type sysid: string - - :param func_name: Name of the function module to be removed - :type func_name: string - - :returns: error code - """ - cdef RFC_ERROR_INFO errorInfo - sysId = fillString(sysid) - funcName = fillString(func_name) - cdef RFC_RC rc = RfcRemoveFunctionDesc(sysId, funcName, &errorInfo) - free(sysId) - free(funcName) - if rc != RFC_OK: - self._error(&errorInfo) - return rc - - ########################################################################## - # TRANSACTIONAL / QUEUED RFC - - def _get_transaction_id(self): - """ Returns a unique 24 char transaction ID (GUID).""" - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_TID tid - - if not self.alive: - self._open() - rc = RfcGetTransactionID(self._handle, tid, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - return wrapString(tid, RFC_TID_LN) - - def _create_and_submit_transaction(self, transaction_id, calls, queue_name=None): - # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef SAP_UC* queueName - cdef RFC_FUNCTION_DESC_HANDLE funcDesc - cdef RFC_FUNCTION_HANDLE funcCont - - if not self.alive: - self._open() - - tid = fillString(transaction_id) - queueName = NULL - if queue_name: - queueName = fillString(queue_name) - self._tHandle = RfcCreateTransaction(self._handle, tid, queueName, &errorInfo) - - if queue_name: - free(queueName) - free(tid) - if self._tHandle == NULL: - self._error(&errorInfo) - self.active_transaction = True - - try: - for func_name, params in calls: - funcName = fillString(func_name) - funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - free(funcName) - if not funcDesc: - self._error(&errorInfo) - funcCont = RfcCreateFunction(funcDesc, &errorInfo) - if not funcCont: - self._error(&errorInfo) - try: - for name, value in params.iteritems(): - fillFunctionParameter(funcDesc, funcCont, name, value) - # Add RFC call to transaction - rc = RfcInvokeInTransaction(self._tHandle, funcCont, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - finally: - RfcDestroyFunction(funcCont, NULL) - # execute - with nogil: - rc = RfcSubmitTransaction(self._tHandle, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - - except RFCError as e: - # clean up actions - RfcDestroyTransaction(self._tHandle, NULL) - raise - - def _destroy_transaction(self): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - if not self.active_transaction: - raise RFCError("No transaction handle for this connection available.") - if not self.alive: - self._open() - rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - self.active_transaction = False - if rc != RFC_OK: - self._error(&errorInfo) - - def _confirm_transaction(self): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - if not self.active_transaction: - raise RFCError("No transaction handle for this connection available.") - if not self.alive: - self._open() - rc = RfcConfirmTransaction(self._tHandle, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - rc = RfcDestroyTransaction(self._tHandle, &errorInfo) - self.active_transaction = False - if rc != RFC_OK: - self._error(&errorInfo) - - ########################################################################## - # BACKGROUND RFC - - def _get_unit_id(self): - """Returns a unique 32 char bgRFC unit ID (GUID).""" - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_UNITID uid - - if not self.alive: - self._open() - rc = RfcGetUnitID(self._handle, uid, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - return wrapString(uid, RFC_UNITID_LN) - - def _create_and_submit_unit(self, unit_id, calls, queue_names=None, attributes=None): - # Note: no persistence action is taken of maintaining the arguments (cf. Schmidt, Li (2009c), p. 5ff) - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef int queueNameCount - # cdef const_SAP_UC_ptr* queueNames - cdef SAP_UC** queueNames - cdef RFC_UNIT_ATTRIBUTES unitAttr - cdef RFC_UNIT_IDENTIFIER uIdentifier - cdef RFC_FUNCTION_DESC_HANDLE funcDesc - cdef RFC_FUNCTION_HANDLE funcCont - cdef SAP_UC* sapuc - - if not self.alive: - self._open() - - # uid - uid = fillString(unit_id) - # queue - queue_names = queue_names or [] - if len(queue_names) == 0: - queueNameCount = 0 - queueNames = NULL - else: - queueNameCount = int(len(queue_names)) - queueNames = mallocU(queueNameCount * sizeof(SAP_UC*)) - for i, queue_name in enumerate(queue_names): - queueNames[i] = fillString(queue_name) - # attributes - # set default values - memsetR(&unitAttr, 0, sizeof(RFC_UNIT_ATTRIBUTES)) - memsetR(&uIdentifier, 0, sizeof(RFC_UNIT_IDENTIFIER)) - # unitAttr.kernelTrace = 0 (short) If != 0, the backend will write kernel traces, while executing this unit. - # unitAttr.satTrace = 0 (short) If != 0, the backend will keep a "history" for this unit. - # unitAttr.unitHistory = 0 (short) Used only for type Q: If != 0, the unit will be written to the queue, but not processed. - # The unit can then be started manually in the ABAP debugger. - # unitAttr.lock = 0 (short) Used only for type Q: If != 0, the unit will be written to the queue, but not processed. - # The unit can then be started manually in the ABAP debugger. - # unitAttr.noCommitCheck = 0 (short) Per default the backend will check during execution of a unit, - # whether one of the unit's function modules triggers an explicit or implicit COMMIT WORK. - # In this case the unit is aborted with an error, because the transactional - # integrity of this unit cannot be guaranteed. - # By setting "noCommitCheck" to true (!=0), this behavior can be suppressed, - # meaning the unit will be executed anyway, - # even if one of it's function modules "misbehaves" and triggers a COMMIT WORK. - # unitAttr.user[0] = '\0' (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. - # unitAttr.client[0] = '\0' (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". - # unitAttr.tCode[0] = '\0' (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". - # unitAttr.program[0] = '\0' (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. - # unitAttr.hostname[0] = '\0' (SAP_UC hostname[40+1]; - # Sender hostname. Used only when the external program is server. - # In the client case the nwrfclib fills this automatically. - # unitAttr.sendingDate[0] = '\0' (RFC_DATE sendingDate; - # Sending date in UTC (GMT-0). Used only when the external program is server. - # In the client case the nwrfclib fills this automatically. - # unitAttr.sendingTime[0] = '\0' (RFC_TIME sendingTime; - # Sending time in UTC (GMT-0). Used only when the external program is server. - # In the client case the nwrfclib fills this automatically. - if attributes is not None: - if 'kernel_trace' in attributes: - unitAttr.kernelTrace = attributes['kernel_trace'] - if 'sat_trace' in attributes: - unitAttr.satTrace = attributes['sat_trace'] - if 'unit_history' in attributes: - unitAttr.unitHistory = attributes['unit_history'] - if 'lock' in attributes: - unitAttr.lock = attributes['lock'] - if 'no_commit_check' in attributes: - unitAttr.noCommitCheck = attributes['no_commit_check'] - if 'user' in attributes and attributes['user'] is not None: - # (SAP_UC[12+1]) Sender User (optional). Default is current operating system User. - sapuc = fillString(attributes['user'][0:12]) - strncpyU(unitAttr.user, sapuc, len(attributes['user'][0:12]) + 1) - free(sapuc) - if 'client' in attributes: - # (SAP_UC[3+1]) Sender Client ("Mandant") (optional). Default is "000". - sapuc = fillString(attributes['client'][0:3]) - strncpyU(unitAttr.client, sapuc, len(attributes['client'][0:3]) + 1) - free(sapuc) - if 't_code' in attributes: - # (SAP_UC[20+1]) Sender Transaction Code (optional). Default is "". - sapuc = fillString(attributes['t_code'][0:20]) - strncpyU(unitAttr.tCode, sapuc, len(attributes['t_code'][0:20]) + 1) - free(sapuc) - if 'program' in attributes and attributes['program'] is not None: - # (SAP_UC[40+1]) Sender Program (optional). Default is current executable name. - sapuc = fillString(attributes['program'][0:40]) - strncpyU(unitAttr.program, sapuc, len(attributes['program'][0:40]) + 1) - free(sapuc) - - self._uHandle = RfcCreateUnit(self._handle, uid, queueNames, queueNameCount, &unitAttr, &uIdentifier, &errorInfo) - - # queue (deallocate) - if len(queue_names) > 0: - for i, queue_name in enumerate(queue_names): - free(queueNames[i]) - free(queueNames) - # uid (deallocate) - free(uid) - - if self._uHandle == NULL: - self._error(&errorInfo) - self.active_unit = True - - try: - for func_name, params in calls: - funcName = fillString(func_name) - funcDesc = RfcGetFunctionDesc(self._handle, funcName, &errorInfo) - free(funcName) - if not funcDesc: - self._error(&errorInfo) - funcCont = RfcCreateFunction(funcDesc, &errorInfo) - if not funcCont: - self._error(&errorInfo) - try: - for name, value in params.iteritems(): - fillFunctionParameter(funcDesc, funcCont, name, value) - # Add RFC call to unit - rc = RfcInvokeInUnit(self._uHandle, funcCont, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - finally: - RfcDestroyFunction(funcCont, NULL) - # execute - print (" Invocation finished. submitting unit.") - with nogil: - rc = RfcSubmitUnit(self._uHandle, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - - except RFCError as e: - # clean up actions - RfcDestroyUnit(self._uHandle, NULL) - raise - - unit_identifier = wrapUnitIdentifier(uIdentifier) - return unit_identifier["queued"] - - def _get_unit_state(self, unit): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) - cdef RFC_UNIT_STATE state - - if not self.active_unit: - raise RFCError("No unit handle for this connection available.") - if not self.alive: - self._open() - rc = RfcGetUnitState(self._handle, &uIdentifier, &state, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - if state not in enum_values(UnitState): - raise RFCError(f"Unit {unit['id']} has invalid state '{state}'") - return UnitState(state).name - - def _destroy_unit(self): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - if not self.active_unit: - raise RFCError("No unit handle for this connection available.") - if not self.alive: - self._open() - rc = RfcDestroyUnit(self._uHandle, &errorInfo) - self.active_unit = False - if rc != RFC_OK: - self._error(&errorInfo) - - def _confirm_unit(self, unit): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_UNIT_IDENTIFIER uIdentifier = fillUnitIdentifier(unit) - - if not self.active_unit: - raise RFCError("No unit handle for this connection available.") - if not self.alive: - self._open() - rc = RfcConfirmUnit(self._handle, &uIdentifier, &errorInfo) - if rc != RFC_OK: - self._error(&errorInfo) - rc = RfcDestroyUnit(self._uHandle, &errorInfo) - self.active_unit = False - if rc != RFC_OK: - self._error(&errorInfo) - - ########################################################################## - # UNIT RFC - - # a "unit" for the client is a dictionary with up to three key-value pairs: - # * background - boolean, set on initialize_unit() call - # * id - string 24 or 32 chars, set on initialize_unit() call - # * queued - boolean, set on fill_and_submit_unit() call - - def initialize_unit(self, background=True): - """ Initializes a logical unit of work (LUW), shorthand: unit - - .. warning:: - - The background protocol (bgRFC) is not working in the current version. - Please use only tRFC/qRFC protocols. - - :param background: The bgRFC protocol will be used. If set to False, - the t/qRFC protocol will be used. Note that the bgRFC protocol - has extended functionality. Default: True - :type background: boolean - - :returns: A dictionary describing the unit. - """ - if background is True: # use bgRFC - id = self._get_unit_id() - elif background is False: # classic t/qRFC - id = self._get_transaction_id() - else: - raise RFCError("Argument 'background' must be a boolean value.") - return {'background': background, 'id': id, "queued": False} - - def fill_and_submit_unit(self, unit, calls, queue_names=None, attributes=None): - """ Fills a unit with one or more RFC and submits it to the backend. - - Fills a unit for this connection, prepare the invocation - of multiple RFC function modules in it, and submits the unit - to the backend. - - Afterwards, the unit is still attached to the connection object, - until confirm_unit() or destroy_unit() is called. Until one of these - methods are called, no other unit could be filled and submitted. - - :param unit: a unit descriptor as returned by - :meth:`~pyrfc.Connection.initialize_unit`. - :param calls: a list of call descriptions. Each call description is a - tuple that contains the function name as the first element and - the function arguments in form of a dictionary as the second element. - :param queue_names: - If the unit uses the background protocol, various queue names can - be given (leading to a asynchronous unit, type 'Q'). If parameter - is an empty list or None, a synchronous unit (type 'T') is created. - - If the unit does not use the background protocol, the queue name - may be a list with exactly one element, leading to a qRFC, or - an empty list or None, leading to a tRFC. - :type queue_names: list of strings or None (default) - :param attributes: optional argument for attributes of the unit -- only valid if the background protocol - is used. The attributes dict may contain the following keywords: - - =============== ============================= ======================= ========================================================================================== - keyword default type description - =============== ============================= ======================= ========================================================================================== - kernel_trace 0 int If != 0, the backend will write kernel traces, while executing this unit. - sat_trace 0 int If != 0, the backend will write statistic records, while executing this unit. - unit_history 0 int If != 0, the backend will keep a "history" for this unit. - lock 0 int Used only for type Q: If != 0, the unit will be written to the queue, but not processed. - The unit can then be started manually in the ABAP debugger. - no_commit_check 0 int Per default the backend will check during execution of a unit, whether one of the - unit's function modules triggers an explicit or implicit COMMITWORK. - In this case the unit is aborted with an error, because the transactional integrity of - this unit cannot be guaranteed. By setting "no_commit_check" to true (!=0), this behavior - can be suppressed, meaning the unit will be executed anyway, even if one of it's - function modules "misbehaves" and triggers a COMMIT WORK. - user current operating system user String, len |nbsp| 12 Sender User (optional). - client "000" String, len |nbsp| 3 Sender Client ("Mandant") (optional). - t_code "" String, len |nbsp| 20 Sender Transaction Code (optional). - program current executable name String, len |nbsp| 40 Sender Program (optional). - =============== ============================= ======================= ========================================================================================== - - :type attributes: dict or None (default) - :raises: :exc:`~pyrfc.RFCError` or a subclass thereof if an error - occurred. In this case, the unit is destroyed. - """ - - if type(unit) is not dict or 'id' not in unit or 'background' not in unit: - raise TypeError("Parameter 'unit' not valid. Please use initialize_unit() to retrieve a valid unit.") - if not isinstance(calls, Iterable): - raise TypeError("Parameter 'calls' must be iterable.") - if len(calls)==0: - raise TypeError("Parameter 'calls' must contain at least on call description (func_name, params).") - for func_name, params in calls: - if type(func_name) is not str or type(params) is not dict: - raise TypeError("Parameter 'calls' must contain valid call descriptions (func_name, params dict).") - if self.active_unit: - raise RFCError("There is an active unit for this connection. " - "Use destroy_unit() " + - "or confirm_unit().") - bg = unit['background'] - unit_id = unit['id'] - - if bg is True: - if len(unit_id) != RFC_UNITID_LN: - raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_UNITID_LN} chars, found {len(unit_id)}.") - unit['queued'] = self._create_and_submit_unit(unit_id, calls, queue_names, attributes) - elif bg is False: - if len(unit_id) != RFC_TID_LN: - raise TypeError(f"Length of parameter 'unit['id']' must be {RFC_TID_LN} chars, found {len(unit_id)}.") - if attributes is not None: - raise RFCError("Argument 'attributes' not valid. (t/qRFC does not support attributes.)") - if queue_names is None or type(queue_names) is list and len(queue_names) == 0: - self._create_and_submit_transaction(unit_id, calls) - unit['queued'] = False - elif len(queue_names) == 1: - queue_name = queue_names[0] - self._create_and_submit_transaction(unit_id, calls, queue_name) - unit['queued'] = True - else: - raise RFCError("Argument 'queue_names' not valid. (t/qRFC only support one queue name.)") - else: - raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - return unit - - def get_unit_state(self, unit): - """Retrieves the processing status of the given background unit. - - .. note:: - Only available for background units. - - :param unit: a unit descriptor as returned by - :meth:`~pyrfc.Connection.initialize_unit`. - :return: The state of the current bgRFC unit. Possible values are: - RFC_UNIT_NOT_FOUND - RFC_UNIT_IN_PROCESS - RFC_UNIT_COMMITTED - RFC_UNIT_ROLLED_BACK - RFC_UNIT_CONFIRMED - """ - bg = unit['background'] - if bg is True: - return self._get_unit_state(unit) - elif bg is False: - raise RFCError("No state check possible of non-bgRFC units.") - else: - raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - - def destroy_unit(self, unit): - """ Destroy the current unit. - - E.g. if the completed unit could not be recorded in the frontend. - - :param unit: a unit descriptor as returned by - :meth:`~pyrfc.Connection.initialize_unit`. - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection attempt fails. - """ - bg = unit['background'] - if bg is True: - self._destroy_unit() - elif bg is False: - self._destroy_transaction() - else: - raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") - - def confirm_unit(self, unit): - """ Confirm the current unit in the backend. - - This also destroys the unit. - - :param unit: a unit descriptor as returned by - :meth:`~pyrfc.Connection.initialize_unit`. - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection attempt fails. - """ - bg = unit['background'] - if bg is True: - self._confirm_unit(unit) - elif bg is False: - self._confirm_transaction() - else: - raise RFCError("Argument 'unit' not valid. (Is unit['background'] boolean?)") diff --git a/src/pyrfc/config.pyx b/src/pyrfc/config.pyx deleted file mode 100644 index 0dee827..0000000 --- a/src/pyrfc/config.pyx +++ /dev/null @@ -1,85 +0,0 @@ -from locale import localeconv -from enum import Enum, auto - -################################################################################ -# Configuration options -################################################################################ - -# configuration bitmasks, internal use -_MASK_DTIME = 0x01 -_MASK_RETURN_IMPORT_PARAMS = 0x02 -_MASK_RSTRIP = 0x04 - -_LOCALE_RADIX = localeconv()["decimal_point"] - -################################################################################ -# Enumerators, external and internal use -################################################################################ - - -# RFC parameter direction -class RfcParameterDirection(Enum): - RFC_IMPORT = RFC_DIRECTION.RFC_IMPORT - RFC_EXPORT = RFC_DIRECTION.RFC_EXPORT - RFC_CHANGING = RFC_DIRECTION.RFC_CHANGING - RFC_TABLES = RFC_DIRECTION.RFC_TABLES - - -# RFC field type -class RfcFieldType(Enum): - RFCTYPE_CHAR = RFCTYPE.RFCTYPE_CHAR - RFCTYPE_DATE = RFCTYPE.RFCTYPE_DATE - RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD - RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME - RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE - RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE - RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM - RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT - RFCTYPE_INT = RFCTYPE.RFCTYPE_INT - RFCTYPE_INT2 = RFCTYPE.RFCTYPE_INT2 - RFCTYPE_INT1 = RFCTYPE.RFCTYPE_INT1 - RFCTYPE_NULL = RFCTYPE.RFCTYPE_NULL - RFCTYPE_ABAPOBJECT = RFCTYPE.RFCTYPE_ABAPOBJECT - RFCTYPE_STRUCTURE = RFCTYPE.RFCTYPE_STRUCTURE - RFCTYPE_DECF16 = RFCTYPE.RFCTYPE_DECF16 - RFCTYPE_DECF34 = RFCTYPE.RFCTYPE_DECF34 - RFCTYPE_XMLDATA = RFCTYPE.RFCTYPE_XMLDATA - RFCTYPE_STRING = RFCTYPE.RFCTYPE_STRING - RFCTYPE_XSTRING = RFCTYPE.RFCTYPE_XSTRING - RFCTYPE_INT8 = RFCTYPE.RFCTYPE_INT8 - RFCTYPE_UTCLONG = RFCTYPE.RFCTYPE_UTCLONG - RFCTYPE_UTCSECOND = RFCTYPE.RFCTYPE_UTCSECOND - RFCTYPE_UTCMINUTE = RFCTYPE.RFCTYPE_UTCMINUTE - RFCTYPE_DTDAY = RFCTYPE.RFCTYPE_DTDAY - RFCTYPE_DTWEEK = RFCTYPE.RFCTYPE_DTWEEK - RFCTYPE_DTMONTH = RFCTYPE.RFCTYPE_DTMONTH - RFCTYPE_TSECOND = RFCTYPE.RFCTYPE_TSECOND - RFCTYPE_TMINUTE = RFCTYPE.RFCTYPE_TMINUTE - RFCTYPE_CDAY = RFCTYPE.RFCTYPE_CDAY - - -# bgRFC unit state -class UnitState(Enum): - not_found = RFC_UNIT_STATE.RFC_UNIT_NOT_FOUND - in_process = RFC_UNIT_STATE.RFC_UNIT_IN_PROCESS - committed = RFC_UNIT_STATE.RFC_UNIT_COMMITTED - rolled_back = RFC_UNIT_STATE.RFC_UNIT_ROLLED_BACK - confirmed = RFC_UNIT_STATE.RFC_UNIT_CONFIRMED - created = auto() - executed = auto() - - -# bgRFC status -class RCStatus(Enum): - OK = RFC_RC.RFC_OK - RFC_NOT_FOUND = RFC_RC.RFC_NOT_FOUND - RFC_EXTERNAL_FAILURE = RFC_RC.RFC_EXTERNAL_FAILURE - RFC_EXECUTED = RFC_RC.RFC_EXECUTED - - -# bgRFCunit call type -class UnitCallType(Enum): - synchronous = RFC_CALL_TYPE.RFC_SYNCHRONOUS - transactional = RFC_CALL_TYPE.RFC_TRANSACTIONAL - queued = RFC_CALL_TYPE.RFC_QUEUED - background_unit = RFC_CALL_TYPE.RFC_BACKGROUND_UNIT diff --git a/src/pyrfc/csapnwrfc.pxd b/src/pyrfc/csapnwrfc.pxd index 189f771..ad11f41 100755 --- a/src/pyrfc/csapnwrfc.pxd +++ b/src/pyrfc/csapnwrfc.pxd @@ -60,11 +60,11 @@ cdef extern from "sapnwrfc.h": RFCTYPE_XMLDATA RFCTYPE_STRING RFCTYPE_XSTRING - RFCTYPE_INT8 # 8-byte integer + RFCTYPE_INT8 # 8-byte integer RFCTYPE_UTCLONG # timestamp/long, 8-byte integer RFCTYPE_UTCSECOND # timestamp/second, 8-byte integer RFCTYPE_UTCMINUTE # timestamp/minute, 8-byte integer - RFCTYPE_DTDAY # date/day , 4-byte integer + RFCTYPE_DTDAY # date/day , 4-byte integer RFCTYPE_DTWEEK # date/week, 4-byte integer RFCTYPE_DTMONTH # date/month, 4-byte integer RFCTYPE_TSECOND # time/second, 4-byte integer diff --git a/src/pyrfc/data_container.pyx b/src/pyrfc/data_container.pyx deleted file mode 100644 index ccbda5d..0000000 --- a/src/pyrfc/data_container.pyx +++ /dev/null @@ -1,753 +0,0 @@ -from datetime import date, time, datetime -from decimal import Decimal - -################################################################################ -# FILL FUNCTIONS # -################################################################################ - -cdef fillFunctionParameter(RFC_FUNCTION_DESC_HANDLE funcDesc, RFC_FUNCTION_HANDLE container, name, value): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_PARAMETER_DESC paramDesc - cName = fillString(name) - rc = RfcGetParameterDescByName(funcDesc, cName, ¶mDesc, &errorInfo) - free(cName) - if rc != RFC_OK: - raise wrapError(&errorInfo) - fillVariable(paramDesc.type, container, paramDesc.name, value, paramDesc.typeDescHandle) - -cdef fillStructureField(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, name, value): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_FIELD_DESC fieldDesc - cdef SAP_UC* cName = fillString(name) - rc = RfcGetFieldDescByName(typeDesc, cName, &fieldDesc, &errorInfo) - free(cName) - if rc != RFC_OK: - raise wrapError(&errorInfo) - fillVariable(fieldDesc.type, container, fieldDesc.name, value, fieldDesc.typeDescHandle) - -cdef fillTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, lines): - cdef RFC_ERROR_INFO errorInfo - cdef RFC_STRUCTURE_HANDLE lineHandle - cdef unsigned int rowCount = int(len(lines)) - cdef unsigned int i = 0 - while i < rowCount: - lineHandle = RfcAppendNewRow(container, &errorInfo) - if not lineHandle: - raise wrapError(&errorInfo) - line = lines[i] - if type(line) is dict: - for name, value in line.iteritems(): - fillStructureField(typeDesc, lineHandle, name, value) - else: - fillStructureField(typeDesc, lineHandle, '', line) - i += 1 - -cdef fillVariable(RFCTYPE typ, RFC_FUNCTION_HANDLE container, SAP_UC* cName, value, RFC_TYPE_DESC_HANDLE typeDesc): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_STRUCTURE_HANDLE struct - cdef RFC_TABLE_HANDLE table - cdef SAP_UC* cValue - cdef SAP_RAW* bValue - global _LOCALE_RADIX - # print ("fill", wrapString(cName), value, type(value)) - try: - if typ == RFCTYPE_STRUCTURE: - if type(value) is not dict: - raise TypeError('dictionary required for structure parameter, received', str(type(value))) - rc = RfcGetStructure(container, cName, &struct, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - for name, value in value.iteritems(): - fillStructureField(typeDesc, struct, name, value) - elif typ == RFCTYPE_TABLE: - if type(value) is not list: - raise TypeError('list required for table parameter, received', str(type(value))) - rc = RfcGetTable(container, cName, &table, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - fillTable(typeDesc, table, value) - elif typ == RFCTYPE_BYTE: - bValue = fillBytes(value) - rc = RfcSetBytes(container, cName, bValue, int(len(value)), &errorInfo) - free(bValue) - elif typ == RFCTYPE_XSTRING: - bValue = fillBytes(value) - rc = RfcSetXString(container, cName, bValue, int(len(value)), &errorInfo) - free(bValue) - elif typ == RFCTYPE_CHAR: - if type(value) is not str: - raise TypeError('an string is required, received', value, 'of type', type(value)) - cValue = fillString(value) - rc = RfcSetChars(container, cName, cValue, strlenU(cValue), &errorInfo) - free(cValue) - elif typ == RFCTYPE_STRING: - if type(value) is not str: - raise TypeError('an string is required, received', value, 'of type', type(value)) - cValue = fillString(value) - rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - free(cValue) - elif typ == RFCTYPE_NUM: - try: - if value.isdigit(): - cValue = fillString(value) - rc = RfcSetNum(container, cName, cValue, strlenU(cValue), &errorInfo) - free(cValue) - else: - raise - except Exception as ex: - raise TypeError('a numeric string is required, received', value, 'of type', type(value)) - elif typ == RFCTYPE_BCD or typ == RFCTYPE_FLOAT or typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: - # cast to string prevents rounding errors in NWRFC SDK - try: - if type(value) is float or type(value) is Decimal: - svalue = str(value) - else: - # string passed from application should be locale correct, do nothing - svalue = value - # decimal separator must be "." for the Decimal parsing check - locale_radix = _LOCALE_RADIX # localeconv()['decimal_point'] - if locale_radix != ".": - Decimal('.'.join(svalue.rsplit(locale_radix, 1))) - else: - Decimal(svalue) - cValue = fillString(svalue) - except Exception as ex: - raise TypeError('a decimal value required, received', value, 'of type', type(value)) - rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - free(cValue) - elif typ in (RFCTYPE_INT, RFCTYPE_INT1, RFCTYPE_INT2): - if type(value) is not int: - raise TypeError('an integer required, received', value, 'of type', type(value)) - rc = RfcSetInt(container, cName, value, &errorInfo) - elif typ == RFCTYPE_INT8: - if type(value) is not int: - raise TypeError('an integer required, received', value, 'of type', type(value)) - rc = RfcSetInt8(container, cName, value, &errorInfo) - elif typ == RFCTYPE_UTCLONG: - if type(value) is not str: - raise TypeError('an string is required, received', value, 'of type', type(value)) - cValue = fillString(value) - rc = RfcSetString(container, cName, cValue, strlenU(cValue), &errorInfo) - free(cValue) - elif typ == RFCTYPE_DATE: - if value: - format_ok = True - if type(value) is date: - cValue = fillString(f'{value.year:04}{value.month:02}{value.day:02}') - else: - try: - if len(value) != 8: - format_ok = False - else: - if len(value.rstrip()) > 0: - date(int(value[:4]), int(value[4:6]), int(value[6:8])) - cValue = fillString(value) - except Exception as ex: - format_ok = False - if not format_ok: - raise TypeError('date value required, received', value, 'of type', type(value)) - rc = RfcSetDate(container, cName, cValue, &errorInfo) - free(cValue) - else: - rc = RFC_OK - elif typ == RFCTYPE_TIME: - if value: - format_ok = True - if type(value) is time: - cValue = fillString(f'{value.hour:02}{value.minute:02}{value.second:02}') - else: - try: - if len(value) != 6: - format_ok = False - else: - if len(value.rstrip()) > 0: - time(int(value[:2]), int(value[2:4]), int(value[4:6])) - cValue = fillString(value) - except Exception as ex: - format_ok = False - - if not format_ok: - raise TypeError('time value required, received', value, 'of type', type(value)) - rc = RfcSetTime(container, cName, cValue, &errorInfo) - free(cValue) - else: - rc = RFC_OK - else: - raise RFCError('Unknown RFC type %d when filling %s' % (typ, wrapString(cName))) - except TypeError as e: - # This way the field name will be attached in reverse direction - # to the argument list of the exception. This helps users to find - # mistakes easier in complex mapping scenarios. - e.args += (wrapString(cName), ) - raise - if rc != RFC_OK: - raise wrapError(&errorInfo) - -cdef SAP_RAW* fillBytes(pystr) except NULL: - cdef size_t size = len(pystr) - cdef SAP_RAW* bytes = malloc(size) - memcpy(bytes, pystr, size) - return bytes - -cdef fillError(exception, RFC_ERROR_INFO* errorInfo): - group2error = { - ABAPApplicationError: ABAP_APPLICATION_FAILURE, - ABAPRuntimeError: ABAP_RUNTIME_FAILURE, - LogonError: LOGON_FAILURE, - CommunicationError: COMMUNICATION_FAILURE, - ExternalRuntimeError: EXTERNAL_RUNTIME_FAILURE, - ExternalApplicationError: EXTERNAL_APPLICATION_FAILURE, - ExternalAuthorizationError: EXTERNAL_AUTHORIZATION_FAILURE - } - if type(exception) not in group2error: - raise RFCError("Not a valid error group.") - - errorInfo.group = group2error.get(type(exception)) - - if exception.message: # fixed length, exactly 512 chars - # str = exception.message[0:512].ljust(512) - str = exception.message[0:512] - sapuc = fillString(str) - strncpyU(errorInfo.message, sapuc, min(len(str)+1, 512)) - free(sapuc) - errorInfo.code = exception.code if exception.code else RFC_UNKNOWN_ERROR - if exception.key: # fixed length, exactly 128 chars - str = exception.key[0:128] - sapuc = fillString(str) - strncpyU(errorInfo.key, sapuc, min(len(str)+1, 128)) - free(sapuc) - if exception.msg_class: - sapuc = fillString(exception.msg_class[0:20]) - strncpyU(errorInfo.abapMsgClass, sapuc, len(exception.msg_class[0:20]) + 1) - free(sapuc) - if exception.msg_type: - sapuc = fillString(exception.msg_type[0:1]) - strncpyU(errorInfo.abapMsgType, sapuc, len(exception.msg_type[0:1]) + 1) - free(sapuc) - if exception.msg_number: - sapuc = fillString(exception.msg_number[0:3]) - strncpyU(errorInfo.abapMsgNumber, sapuc, len(exception.msg_number[0:3]) + 1) - free(sapuc) - if exception.msg_v1: - sapuc = fillString(exception.msg_v1[0:50]) - strncpyU(errorInfo.abapMsgV1, sapuc, len(exception.msg_v1[0:50]) + 1) - free(sapuc) - if exception.msg_v2: - sapuc = fillString(exception.msg_v2[0:50]) - strncpyU(errorInfo.abapMsgV2, sapuc, len(exception.msg_v2[0:50]) + 1) - free(sapuc) - if exception.msg_v3: - sapuc = fillString(exception.msg_v3[0:50]) - strncpyU(errorInfo.abapMsgV3, sapuc, len(exception.msg_v3[0:50]) + 1) - free(sapuc) - if exception.msg_v4: - sapuc = fillString(exception.msg_v4[0:50]) - strncpyU(errorInfo.abapMsgV4, sapuc, len(exception.msg_v4[0:50]) + 1) - free(sapuc) - -cdef SAP_UC* fillString(pyuc) except NULL: - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - ucbytes = pyuc.encode() - cdef unsigned ucbytes_len = len(ucbytes) - cdef unsigned sapuc_size = ucbytes_len + 1 - cdef SAP_UC* sapuc = mallocU(sapuc_size) - sapuc[0] = 0 - cdef unsigned result_len = 0 - if ucbytes_len > 0: - rc = RfcUTF8ToSAPUC(ucbytes, ucbytes_len, sapuc, &sapuc_size, &result_len, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return sapuc - -################################################################################ -# WRAPPER FUNCTIONS # -################################################################################ -# wrapper functions take C values and returns Python values - -cdef wrapConnectionAttributes(RFC_ATTRIBUTES attributes): - return { - 'dest': wrapString(attributes.dest, 64, True).rstrip('\0') - , 'host': wrapString(attributes.host, 100, True).rstrip('\0') - , 'partnerHost': wrapString(attributes.partnerHost, 100, True).rstrip('\0') - , 'sysNumber': wrapString(attributes.sysNumber, 2, True).rstrip('\0') - , 'sysId': wrapString(attributes.sysId, 8, True).rstrip('\0') - , 'client': wrapString(attributes.client, 3, True).rstrip('\0') - , 'user': wrapString(attributes.user, 12, True).rstrip('\0') - , 'language': wrapString(attributes.language, 2, True).rstrip('\0') - , 'trace': wrapString(attributes.trace, 1, True).rstrip('\0') - , 'isoLanguage': wrapString(attributes.isoLanguage, 2, True).rstrip('\0') - , 'codepage': wrapString(attributes.codepage, 4, True).rstrip('\0') - , 'partnerCodepage': wrapString(attributes.partnerCodepage, 4, True).rstrip('\0') - , 'rfcRole': wrapString(attributes.rfcRole, 1, True).rstrip('\0') - , 'type': wrapString(attributes.type, 1).rstrip('\0') - , 'partnerType': wrapString(attributes.partnerType, 1, True).rstrip('\0') - , 'rel': wrapString(attributes.rel, 4, True).rstrip('\0') - , 'partnerRel': wrapString(attributes.partnerRel, 4, True).rstrip('\0') - , 'kernelRel': wrapString(attributes.kernelRel, 4, True).rstrip('\0') - , 'cpicConvId': wrapString(attributes.cpicConvId, 8, True).rstrip('\0') - , 'progName': wrapString(attributes.progName, 128, True).rstrip('\0') - , 'partnerBytesPerChar': wrapString(attributes.partnerBytesPerChar, 1, True).rstrip('\0') - , 'partnerSystemCodepage': wrapString(attributes.partnerSystemCodepage, 4, True).rstrip('\0') - , 'partnerIP': wrapString(attributes.partnerIP, 15, True).rstrip('\0') - , 'partnerIPv6': wrapString(attributes.partnerIPv6, 45, True).rstrip('\0') - , 'reserved': wrapString(attributes.reserved, 17, True).rstrip('\0') - } - - -cdef wrapTypeDescription(RFC_TYPE_DESC_HANDLE typeDesc): - """ Parses a RFC_TYPE_DESC_HANDLE - - :param typeDesc: Handle of RFC_TYPE_DESC_HANDLE - :return: object of class TypeDescription - """ - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_FIELD_DESC fieldDesc - cdef RFC_ABAP_NAME typeName - cdef unsigned nuc_length, uc_length - cdef unsigned i, fieldCount - - rc = RfcGetTypeName(typeDesc, typeName, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - name = wrapString(typeName) - rc = RfcGetTypeLength(typeDesc, &nuc_length, &uc_length, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - type_desc = TypeDescription(name, nuc_length, uc_length) - - rc = RfcGetFieldCount(typeDesc, &fieldCount, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - for i in range(fieldCount): - rc = RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - field_description = { - 'name': wrapString(fieldDesc.name), - 'field_type': RfcFieldType(fieldDesc.type).name, - 'nuc_length': fieldDesc.nucLength, - 'nuc_offset': fieldDesc.nucOffset, - 'uc_length': fieldDesc.ucLength, - 'uc_offset': fieldDesc.ucOffset, - 'decimals': fieldDesc.decimals - } - if fieldDesc.typeDescHandle is NULL: - field_description['type_description'] = None - else: - field_description['type_description'] = wrapTypeDescription(fieldDesc.typeDescHandle) - # Add field to object - type_desc.add_field(**field_description) - - return type_desc - -cdef wrapFunctionDescription(RFC_FUNCTION_DESC_HANDLE funcDesc): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_ABAP_NAME functionName - cdef unsigned i, paramCount - cdef RFC_PARAMETER_DESC paramDesc - - rc = RfcGetFunctionName(funcDesc, functionName, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - name = wrapString(functionName) - func_desc = FunctionDescription(name) - - rc = RfcGetParameterCount(funcDesc, ¶mCount, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - for i in range(paramCount): - rc = RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - parameter_description = { - 'name': wrapString(paramDesc.name), - 'parameter_type': RfcFieldType(paramDesc.type).name, - 'direction': RfcParameterDirection(paramDesc.direction).name, - 'nuc_length': paramDesc.nucLength, - 'uc_length': paramDesc.ucLength, - 'decimals': paramDesc.decimals, - 'default_value': wrapString(paramDesc.defaultValue), - 'parameter_text': wrapString(paramDesc.parameterText), - 'optional': bool(paramDesc.optional) - # skip: void* extendedDescription; - # This field can be used by the application programmer (i.e. you) to store arbitrary extra information. - } - if paramDesc.typeDescHandle is NULL: - parameter_description['type_description'] = None - else: - parameter_description['type_description'] = wrapTypeDescription(paramDesc.typeDescHandle) - func_desc.add_parameter(**parameter_description) - - return func_desc - - -cdef wrapResult( - RFC_FUNCTION_DESC_HANDLE funcDesc, - RFC_FUNCTION_HANDLE container, - RFC_DIRECTION filter_parameter_direction, - config - ): - """ - :param funcDesc: a C pointer to a function description. - :param container: a C pointer to a function container - :param filter_parameter_direction: A RFC_DIRECTION - parameters with this - direction will be excluded. - :param config (rstrip: right strip strings, dtime: return datetime objects) - :return: - """ - cdef unsigned i, paramCount - cdef RFC_PARAMETER_DESC paramDesc - RfcGetParameterCount(funcDesc, ¶mCount, NULL) - result = {} - for i in range(paramCount): - RfcGetParameterDescByIndex(funcDesc, i, ¶mDesc, NULL) - if paramDesc.direction != filter_parameter_direction: - result[wrapString(paramDesc.name)] = wrapVariable( - paramDesc.type, - container, - paramDesc.name, - paramDesc.nucLength, - paramDesc.typeDescHandle, - config - ) - return result - -cdef wrapUnitIdentifier(RFC_UNIT_IDENTIFIER uIdentifier): - return { - 'queued': "Q" == wrapString(&uIdentifier.unitType, 1), - 'id': wrapString(uIdentifier.unitID) - } - -cdef wrapUnitAttributes(RFC_UNIT_ATTRIBUTES *uattr): - unit_attributes = {} - unit_attributes['kernel_trace'] = uattr.kernelTrace != 0 - unit_attributes['sat_trace'] = uattr.satTrace != 0 - unit_attributes['unit_history'] = uattr.unitHistory != 0 - unit_attributes['lock'] = uattr.lock != 0 - unit_attributes['no_commit_check'] = uattr.noCommitCheck != 0 - unit_attributes['user'] = wrapString(uattr.user, 12, True) - unit_attributes['client'] = wrapString(uattr.client, 3, True) - unit_attributes['t_code'] = wrapString(uattr.tCode, 20, True) - unit_attributes['program'] = wrapString(uattr.program, 40, True) - unit_attributes['hostname'] = wrapString(uattr.hostname, 40, True) - unit_attributes['sending_date'] = wrapString(uattr.sendingDate, 8, True) - unit_attributes['sending_time'] = wrapString(uattr.sendingTime, 6, True) - return unit_attributes - -cdef wrapStructure(RFC_TYPE_DESC_HANDLE typeDesc, RFC_STRUCTURE_HANDLE container, config): - cdef unsigned i, fieldCount - cdef RFC_FIELD_DESC fieldDesc - RfcGetFieldCount(typeDesc, &fieldCount, NULL) - result = {} - for i in range(fieldCount): - RfcGetFieldDescByIndex(typeDesc, i, &fieldDesc, NULL) - result[wrapString(fieldDesc.name)] = wrapVariable( - fieldDesc.type, - container, - fieldDesc.name, - fieldDesc.nucLength, - fieldDesc.typeDescHandle, - config - ) - if len(result) == 1: - if '' in result: - result = result[''] - return result - -# # Used for debugging tables, cf. wrapTable() -# cdef class TableCursor: -# -# cdef RFC_TYPE_DESC_HANDLE typeDesc -# cdef RFC_TABLE_HANDLE container -# -# def __getitem__(self, i): -# cdef RFC_ERROR_INFO errorInfo -# RfcMoveTo(self.container, i, &errorInfo) -# return wrapStructure(self.typeDesc, self.container) - -cdef wrapTable(RFC_TYPE_DESC_HANDLE typeDesc, RFC_TABLE_HANDLE container, config): - cdef RFC_ERROR_INFO errorInfo - cdef unsigned rowCount - # # For debugging in tables (cf. class TableCursor) - # tc = TableCursor() - # tc.typeDesc = typeDesc - # tc.container = container - # return tc - RfcGetRowCount(container, &rowCount, &errorInfo) - table = [None] * rowCount - while rowCount > 0: - rowCount -= 1 - RfcMoveTo(container, rowCount, &errorInfo) - table[rowCount] = wrapStructure(typeDesc, container, config) - RfcDeleteCurrentRow(container, &errorInfo) - return table - -cdef wrapVariable( - RFCTYPE typ, - RFC_FUNCTION_HANDLE container, - SAP_UC* cName, - unsigned cLen, - RFC_TYPE_DESC_HANDLE typeDesc, - config - ): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_STRUCTURE_HANDLE structure - cdef RFC_TABLE_HANDLE table - cdef RFC_CHAR* charValue - cdef SAP_UC* stringValue - cdef RFC_NUM* numValue - cdef SAP_RAW* byteValue - cdef RFC_FLOAT floatValue - cdef RFC_INT intValue - cdef RFC_INT1 int1Value - cdef RFC_INT2 int2Value - cdef RFC_INT8 int8Value - cdef RFC_DATE dateValue - cdef RFC_TIME timeValue - cdef unsigned resultLen, strLen - if typ == RFCTYPE_STRUCTURE: - rc = RfcGetStructure(container, cName, &structure, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return wrapStructure(typeDesc, structure, config) - elif typ == RFCTYPE_TABLE: - rc = RfcGetTable(container, cName, &table, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return wrapTable(typeDesc, table, config) - elif typ == RFCTYPE_CHAR: - charValue = mallocU(cLen) - try: - rc = RfcGetChars(container, cName, charValue, cLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return wrapString(charValue, cLen, config & _MASK_RSTRIP) - finally: - free(charValue) - elif typ == RFCTYPE_STRING: - rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - try: - stringValue = mallocU(strLen+1) - rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return wrapString(stringValue, resultLen) - finally: - free(stringValue) - elif typ == RFCTYPE_NUM: - numValue = mallocU(cLen) - try: - rc = RfcGetNum(container, cName, numValue, cLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return wrapString(numValue, cLen) - finally: - free(numValue) - elif typ == RFCTYPE_BYTE: - byteValue = malloc(cLen) - try: - rc = RfcGetBytes(container, cName, byteValue, cLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return byteValue[:cLen] - finally: - free(byteValue) - elif typ == RFCTYPE_XSTRING: - rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - try: - byteValue = malloc(strLen+1) - byteValue[strLen] = 0 - rc = RfcGetXString(container, cName, byteValue, strLen, &resultLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return byteValue[:resultLen] - finally: - free(byteValue) - elif typ == RFCTYPE_BCD: - # An upper bound for the length of the _string representation_ - # of the BCD is given by (2*cLen)-1 (each digit is encoded in 4bit, - # the first 4 bit are reserved for the sign) - # Furthermore, a sign char, a decimal separator char may be present - # => (2*cLen)+1 - strLen = 2*cLen + 1 - try: - stringValue = mallocU(strLen+1) - rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - if rc == 23: # Buffer too small, use returned requried result length - # print("Warning: Buffer for BCD (cLen={}, buffer={}) too small: " - # "trying with {}".format(cLen, strLen, resultLen)) - free(stringValue) - strLen = resultLen - stringValue = mallocU(strLen+1) - rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) - finally: - free(stringValue) - elif typ == RFCTYPE_DECF16 or typ == RFCTYPE_DECF34: - # An upper bound for the length of the _string representation_ - # of the DECF is given by (2*cLen)-1 (each digit is encoded in 4bit, - # the first 4 bit are reserved for the sign) - # Furthermore, a sign char, a decimal separator char may be present - # => (2*cLen)+1 - # and exponent char, sign and exponent - # => +9 - strLen = 2*cLen + 10 - try: - stringValue = mallocU(strLen+1) - rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - if rc == 23: # Buffer too small, use returned requried result length - # print("Warning: Buffer for DECF (cLen={}, buffer={}) too small: " - # "trying with {}".format(cLen, strLen, resultLen)) - free(stringValue) - strLen = resultLen - stringValue = mallocU(strLen+1) - rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return Decimal(wrapString(stringValue, -1, config & _MASK_RSTRIP)) - finally: - free(stringValue) - elif typ == RFCTYPE_FLOAT: - rc = RfcGetFloat(container, cName, &floatValue, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return floatValue - elif typ == RFCTYPE_INT: - rc = RfcGetInt(container, cName, &intValue, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return intValue - elif typ == RFCTYPE_INT1: - rc = RfcGetInt1(container, cName, &int1Value, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return int1Value - elif typ == RFCTYPE_INT2: - rc = RfcGetInt2(container, cName, &int2Value, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return int2Value - elif typ == RFCTYPE_INT8: - rc = RfcGetInt8(container, cName, &int8Value, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return int8Value - elif typ == RFCTYPE_UTCLONG: - # rc = RfcGetStringLength(container, cName, &strLen, &errorInfo) - strLen = 27 # is fixed - try: - stringValue = mallocU(strLen+1) - # textual representation from NWRFC SDK because clients' systems unlikely support nanoseconds - rc = RfcGetString(container, cName, stringValue, strLen+1, &resultLen, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - utcValue = wrapString(stringValue, resultLen) - # replace the "," separator with "." - return utcValue[:19]+'.'+utcValue[20:] - finally: - free(stringValue) - elif typ == RFCTYPE_DATE: - rc = RfcGetDate(container, cName, dateValue, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - value = wrapString(dateValue, 8) - # return date or None - if config & _MASK_DTIME: - if (value == '00000000') or not value: - return None - return datetime.strptime(value, '%Y%m%d').date() - # return date string or '' - if (value == '00000000') or not value: - return '' - return value - elif typ == RFCTYPE_TIME: - rc = RfcGetTime(container, cName, timeValue, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - value = wrapString(timeValue, 6) - # return time or None - if config & _MASK_DTIME: - if not value: - return None - return datetime.strptime(value, '%H%M%S').time() - # return time string or '' - if not value: - return '' - return value - else: - raise RFCError('Unknown RFC type %d when wrapping %s' % (typ, wrapString(cName))) - -cdef wrapError(RFC_ERROR_INFO* errorInfo): - group2error = { - ABAP_APPLICATION_FAILURE: ABAPApplicationError, - ABAP_RUNTIME_FAILURE: ABAPRuntimeError, - LOGON_FAILURE: LogonError, - COMMUNICATION_FAILURE: CommunicationError, - EXTERNAL_RUNTIME_FAILURE: ExternalRuntimeError, - EXTERNAL_APPLICATION_FAILURE: ExternalApplicationError, - EXTERNAL_AUTHORIZATION_FAILURE: ExternalAuthorizationError - } - error = group2error[errorInfo.group] - return error( - wrapString(errorInfo.message), errorInfo.code, wrapString(errorInfo.key), - wrapString(errorInfo.abapMsgClass), wrapString(errorInfo.abapMsgType), wrapString(errorInfo.abapMsgNumber), - wrapString(errorInfo.abapMsgV1), wrapString(errorInfo.abapMsgV2), - wrapString(errorInfo.abapMsgV3), wrapString(errorInfo.abapMsgV4) - ) - -cdef wrapString(const SAP_UC* uc, uclen=-1, rstrip=False): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - if uclen == -1: - uclen = strlenU(uc) - if uclen == 0: - return '' - cdef unsigned utf8_size = uclen * 5 + 1 - cdef char *utf8 = malloc(utf8_size) - utf8[0] = 0 - cdef unsigned result_len = 0 - rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - if rc != RFC_OK: - # raise wrapError(&errorInfo) - raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) - utf8[result_len] = 0 - try: - if rstrip: - return utf8[:result_len].rstrip().decode() - else: - return utf8[:result_len].decode() - finally: - free(utf8) - -cdef wrapString(SAP_UC* uc, uclen=-1, rstrip=True): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - if uclen == -1: - uclen = strlenU(uc) - if uclen == 0: - return '' - cdef unsigned utf8_size = uclen * 5 + 1 - cdef char *utf8 = malloc(utf8_size) - utf8[0] = 0 - cdef unsigned result_len = 0 - rc = RfcSAPUCToUTF8(uc, uclen, utf8, &utf8_size, &result_len, &errorInfo) - if rc != RFC_OK: - # raise wrapError(&errorInfo) - raise RFCError('wrapString uclen: %u utf8_size: %u' % (uclen, utf8_size)) - utf8[result_len] = 0 - try: - if rstrip: - return utf8[:result_len].rstrip().decode() - else: - return utf8[:result_len].decode() - finally: - free(utf8) diff --git a/src/pyrfc/nwrfcsdk.pyx b/src/pyrfc/nwrfcsdk.pyx deleted file mode 100644 index 65ae46a..0000000 --- a/src/pyrfc/nwrfcsdk.pyx +++ /dev/null @@ -1,391 +0,0 @@ -from locale import localeconv -from os.path import isfile, join -import pickle -from sys import platform -from threading import Thread - -################################################################################ -# NW RFC SDK FUNCTIONALITY -################################################################################ - - -def get_nwrfclib_version(): - """Get SAP NW RFC Lib version - :returns: tuple of major, minor and patch level and OS platform - """ - cdef unsigned major = 0 - cdef unsigned minor = 0 - cdef unsigned patchlevel = 0 - RfcGetVersion(&major, &minor, &patchlevel) - return {'major': major, 'minor': minor, 'patchLevel': patchlevel, 'platform': platform} - - -def set_ini_file_directory(path_name): - """Sets the directory in which to search for the sapnwrfc.ini file - - :param path_name: Directory in which to search for the sapnwrfc.ini file. - :type path_name: string - - :return: nothing, raises an error - """ - if type(path_name) is not str: - raise TypeError('sapnwrfc.ini path is not a string:', path_name) - cdef RFC_ERROR_INFO errorInfo - cdef SAP_UC pathName [512] - if not isfile(join(path_name, "sapnwrfc.ini")): - raise TypeError('sapnwrfc.ini not found in:', path_name) - pathName = fillString(path_name) - cdef RFC_RC rc = RfcSetIniPath(pathName, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - - -def reload_ini_file(): - """Reloads the contents of the sapnwrfc.ini file into memory. - - Searches the directory given by ``RfcSetIniPath()`` (or the current working directory) - for the file sapnwrfc.ini and loads its contents into memory. Reloading the sapnwrfc.ini - file is only necessary after the file has been manually edited. - If you want to use a sapnwrfc.ini file in a different location, consider using ``RfcSetIniPath()``. - - Note: If a file with the name ``sapnwrfc.ini`` does not exist in the given directory, - this is not considered an error! Default settings are used in this case. - - :return: nothing, raises an error - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc = RfcReloadIniFile (&errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - - -def language_iso_to_sap(lang_iso): - """Language code conversion of ISO code to SAP code. - - :param lang_iso: Language ISO code - :type lang_iso: string - - :return: SAP language code of char 1 type - - :raises: :exc:`~pyrfc.RFCError` or a subclass - if ISO to SAP code conversion fails. - """ - cdef SAP_UC *uclang_iso = fillString(lang_iso) - cdef SAP_UC uclang_sap[8] - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc = RfcLanguageIsoToSap(uclang_iso, uclang_sap, &errorInfo) - free(uclang_iso) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return wrapString(uclang_sap, 1) - - -def language_sap_to_iso(lang_sap): - """Language code conversion of SAP code to ISO code. - - :param lang_sap: Language SAP code - :type lang_sap: string - - :return: ISO language code - - :raises: :exc:`~pyrfc.RFCError` or a subclass - if SAP to ISO code conversion fails. - """ - cdef SAP_UC *uclang_sap = fillString(lang_sap) - cdef SAP_UC uclang_iso[16] - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc = RfcLanguageSapToIso(uclang_sap, uclang_iso, &errorInfo) - free(uclang_sap) - if rc != RFC_OK: - raise wrapError(&errorInfo) - return wrapString(uclang_iso, 2) - - -def set_cryptolib_path(path_name): - """Sets the absolute path to the sapcrypto library to enable TLS encryption via Websocket Rfc. - - The parameter path_name needs also to contain the name of the library. - This function has the same effect as the sapnwrfc.ini parameter TLS_SAPCRYPTOLIB. - This API cannot reset a new path to the library during runtime. Once set, the path is definitive. - - :param path_name: Absolute path to crypto library - :type path_name: string - - :return: nothing, raises an error - """ - if type(path_name) is not str: - raise TypeError('sapnwrfc.ini path is not a string:', path_name) - cdef RFC_ERROR_INFO errorInfo - cdef SAP_UC pathName [512] - if not isfile(path_name): - raise TypeError('Crypto library not found:', path_name) - pathName = fillString(path_name) - cdef RFC_RC rc = RfcLoadCryptoLibrary(pathName, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - - -def set_locale_radix(value=None): - """Sets the locale radix for decimal conversions. - - :param value: Locale radix like ``.`` or ``,`` - :type path_name: string - - :return: New radix set - """ - global _LOCALE_RADIX - if value is None: - value = localeconv()['decimal_point'] - _LOCALE_RADIX = value - return _LOCALE_RADIX - - -cdef _cancel_connection(client_connection): - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - if client_connection.handle is not None: - rc = RfcCancel(client_connection.handle, &errorInfo) - if rc != RFC_OK or errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - - -def cancel_connection(client_connection): - """Immediately cancels the RFC call which is currently being called over the given RFC connection - and closes the connection. Can be used only on an RFC client connection. - - RFC call cancellation with timeout can be done automatically, without using this method explicitely. - The ``timeout`` option can be at connection level, when creating connection instance, or at RFC call level, as - RFC ``Connection.call()`` option. Either way, the connection will be cancelled if RFC call takes longer than ``timeout`` seconds. - - :param client_connection: RFC client connection instance to be cancelled - :type client_connection: Connection - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection cannot be cancelled cleanly. - """ - Thread(target=_cancel_connection, args=(client_connection,)).start() - - -def enum_names(enum_obj): - return set(e.name for e in enum_obj) - - -def enum_values(enum_obj): - return set(e.value for e in enum_obj) - - -def py_to_string(obj): - return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) - - -def string_to_py(objstr): - return pickle.loads(objstr) - - -################################################################################ -# CONNECTION PARAMETERS -################################################################################ - - -cdef class ConnectionParameters: - """Connection parameters instance in SAP unicode format - - :param args: Connection parameters like ASHOST="ABC" etc - :type args: positional - - :returns: Nothing - """ - cdef unsigned _params_count - cdef RFC_CONNECTION_PARAMETER *_params - - def __cinit__(self, **params): - self._params_count = len(params) - if self._params_count < 1: - raise RFCError("Connection parameters missing") - self._params = malloc(self._params_count * sizeof(RFC_CONNECTION_PARAMETER)) - cdef int i = 0 - for name, value in params.iteritems(): - self._params[i].name = fillString(name) - self._params[i].value = fillString(value) - i += 1 - - def __del__(self): - self._free() - - def _free(self): - if self._params_count > 0: - for i in range(self._params_count): - free(self._params[i].name) - free( self._params[i].value) - free(self._params) - self._params_count = 0 - -################################################################################ -# Type Description -################################################################################ - - -class TypeDescription(object): - """ A type description - - This class wraps the RFC_TYPE_DESC_HANDLE as e.g. contained in - a parameter description of a function description. - - :param name: Name of the type. - :param nuc_length: Length of the type in non unicode systems. - :param uc_length: Length of the type in unicode systems. - - *Attributes and methods* - - **name** - The name of the function. - - **nuc_length** - The length in bytes if chars are non unicode. - - **uc_length** - The length in bytes if chars are unicode. - - **fields** - The fields as a list of dicts. - - """ - def __init__(self, name, nuc_length, uc_length): - self.fields = [] - if len(name)<1 or len(name)>30: - raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") - for int_field in [nuc_length, uc_length]: - if type(int_field) not in [int, long]: - raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") - self.name = name - self.nuc_length = nuc_length - self.uc_length = uc_length - - def add_field(self, name, field_type, nuc_length, uc_length, nuc_offset, - uc_offset, decimals=0, type_description=None): - """ Adds a field to the type description. - - :param name: Field name - :type name: string (30) - :param field_type: RfcFieldType enum name - :type field_type: string - :param nuc_length: NUC length - :type nuc_length: int - :param uc_length: UC length - :type uc_length: int - :param nuc_offset: NUC offset. - :type nuc_offset: int - :param uc_offset: UC offset. - :type uc_offset: int - :param decimals: Decimals (default=0) - :type decimals: int - :param type_description: An object of class TypeDescription or None (default=None) - :type type_description: object of class TypeDescription - """ - if len(name)<1: - return None - if len(name)>30: - raise TypeError(f"field 'name' (string) '{name}' should be from 1-30 chars.") - if field_type not in enum_names(RfcFieldType): - raise TypeError(f"'field_type' (string) '{field_type}' must be in {enum_names(RfcFieldType)}") - for int_field in [nuc_length, nuc_offset, uc_length, uc_offset]: - if not isinstance(int_field, (int, long)): - raise TypeError(f"field '{name}' length '{int_field}' must be of type integer") - self.fields.append({ - 'name': name, - 'field_type': field_type, - 'nuc_length': nuc_length, - 'nuc_offset': nuc_offset, - 'uc_length': uc_length, - 'uc_offset': uc_offset, - 'decimals': decimals, - 'type_description': type_description - }) - - def __repr__(self): - return f"" - -################################################################################ -# Function Description -################################################################################ - - -class FunctionDescription(object): - """ A function description - - This class wraps the RFC_FUNCTION_DESC_HANDLE as e.g. returned by - RfcGetFunctionDesc() and used for server functionality. - - .. WARNING:: - - Actually, the function description does not support exceptions - (cf. RfcAddException() etc.) - - :param name: Name of the function. - - - *Attributes and methods* - - **name** - The name of the function. - - **parameters** - The parameters as a list of dicts. - - """ - def __init__(self, name): - self.name = name - self.parameters = [] - - def add_parameter(self, name, parameter_type, direction, nuc_length, - uc_length, decimals=0, default_value="", parameter_text="", - optional=False, type_description=None): - """ Adds a parameter to the function description. - - :param name: Parameter name - :type name: string (30) - :param parameter_type: RfcFieldType enum name - :type parameter_type: string - :param direction: RfcParameterDirection enum name - :type direction: string - :param nuc_length: NUC length - :type nuc_length: int - :param uc_length: UC length - :type uc_length: int - :param decimals: Decimals (default=0) - :type decimals: int - :param default_value: Default value (default="") - :type default_value: string (30) - :param parameter_text: Parameter text (default="") - :type parameter_text: string (79) - :param optional: Is the parameter optional (default=False) - :type optional: bool - :param type_description: An object of class TypeDescription or None (default=None) - :type type_description: object of class TypeDescription - """ - if len(name)<1 or len(name)>30: - raise TypeError(f"field 'name' (string) {name} should be from 1-30 chars.") - if parameter_type not in enum_names(RfcFieldType): - raise TypeError(f"'parameter_type' (string) '{parameter_type}' must be in {enum_names(RfcFieldType)}") - if direction not in enum_names(RfcParameterDirection): - raise TypeError(f"'direction' (string) '{direction}' must be in '{enum_names(RfcParameterDirection)}'") - if len(default_value)>30: - raise TypeError(f"'default_value' (string) '{default_value}' must not exceed 30 chars.") - if len(parameter_text)>79: - raise TypeError("'parameter_text' (string) '{parameter_text}' must not exceed 79 chars.") - self.parameters.append({ - 'name': name, - 'parameter_type': parameter_type, - 'direction': direction, - 'nuc_length': nuc_length, - 'uc_length': uc_length, - 'decimals': decimals, - 'default_value': default_value, - 'parameter_text': parameter_text, - 'optional': optional, - 'type_description': type_description - }) - - def __repr__(self): - return f"" diff --git a/src/pyrfc/server.pyx b/src/pyrfc/server.pyx deleted file mode 100644 index f89dcd0..0000000 --- a/src/pyrfc/server.pyx +++ /dev/null @@ -1,685 +0,0 @@ -from sys import exc_info -from threading import Thread -import socket - -################################################################################ -# SERVER FUNCTIONALITY -################################################################################ - -# global information about served functions / callbacks -# "function_name": {"funcDescHandle": FunctionDescription object, -# "callback": Python function, -# "server": Server object) -server_functions = {} - -# global information about served functions / callbacks -# "auth_check": Default authorization check function -# "server_log": Server logging flag, default False -server_context = {} - - -def default_auth_check(func_name=False, request_context = None): - request_context = request_context or {} - _server_log(f"authorization check for '{func_name}'", request_context['server_context']) - return RFC_OK - - -def _server_log(origin, log_message): - if server_context["server_log"]: - print (f"[{datetime.utcnow()} UTC] {origin} '{log_message}'") - - -cdef class ServerConnection: - cdef ConnectionParameters _connection - cdef RFC_SERVER_HANDLE _handle - cdef public bint debug - cdef public bint rstrip - - def __init__(self, **params): - self._connection = ConnectionParameters(**params) - self._handle = NULL - self._open() - - cdef _open(self): - cdef RFC_ERROR_INFO errorInfo - with nogil: - self._handle = RfcCreateServer(self._connection._params, self._connection._params_count, &errorInfo) - if errorInfo.code != RFC_OK: - self._handle = NULL - raise wrapError(&errorInfo) - _server_log("Server connection", f"{self._handle}") - - cdef _close(self): - if self._handle != NULL: - _server_log("Server close", self._handle) - with nogil: - RfcShutdownServer(self._handle, 60, NULL) - RfcDestroyServer(self._handle, NULL) - self._handle = NULL - - def open(self): - self._open() - - def close(self): - self._close() - - def __bool__(self): - return self.alive - - @property - def handle(self): - """Server connection handle - - :getter: Returns server connection handle - :type: uitptr_t - """ - return self._handle - - @property - def alive(self): - """Conection alive property - - :getter: Returns True when alive - :type: boolean - """ - return self._handle != NULL - - def __del__(self): - self._close() - self._connection._free() - -cdef RFC_RC metadataLookup( - const SAP_UC* functionName, - RFC_ATTRIBUTES rfcAttributes, - RFC_FUNCTION_DESC_HANDLE *funcDescHandle - ) with gil: - global server_functions - function_name = wrapString(functionName) - if function_name not in server_functions: - _server_log("metadataLookup", f"No metadata found for function '{function_name}'.") - return RFC_NOT_FOUND - func_metadata = server_functions[function_name] - # callback = func_metadata['callback'] - funcDescHandle[0] = func_metadata['func_desc_handle'] - _server_log("metadataLookup", f"Function '{function_name}' handle {funcDescHandle[0]}.") - return RFC_OK - -cdef get_server_context(RFC_CONNECTION_HANDLE rfcHandle, RFC_ERROR_INFO* serverErrorInfo): - cdef RFC_SERVER_CONTEXT context - cdef RFC_RC rc = RfcGetServerContext(rfcHandle, &context, serverErrorInfo) - if rc != RFC_OK or serverErrorInfo.code != RFC_OK: - return None - - server_context = { - "call_type": UnitCallType(context.type), - "is_stateful": context.isStateful != 0 - } - if context.type != RFC_SYNCHRONOUS: - server_context["unit_identifier"] = wrapUnitIdentifier(context.unitIdentifier[0]) - if context.type == RFC_BACKGROUND_UNIT: - server_context ["unit_attributes"] = wrapUnitAttributes(context.unitAttributes) - - return server_context - -cdef RFC_RC genericHandler(RFC_CONNECTION_HANDLE rfcHandle, RFC_FUNCTION_HANDLE funcHandle, RFC_ERROR_INFO* serverErrorInfo) with gil: - cdef RFC_RC rc - cdef RFC_ERROR_INFO errorInfo - cdef RFC_ATTRIBUTES attributes - cdef RFC_FUNCTION_DESC_HANDLE funcDesc - cdef RFC_ABAP_NAME funcName - - global server_functions - - # section 5.6.2 of SAP NWRFC SDK Programming Guide 7.50 - context = get_server_context(rfcHandle, serverErrorInfo) - if context is None: - err_msg = f"Error code {serverErrorInfo.code} when getting server context for connection '{rfcHandle}'" - new_error = ExternalRuntimeError( - message=err_msg, - code=RFC_EXTERNAL_FAILURE - ) - fillError(new_error, serverErrorInfo) - return RFC_EXTERNAL_FAILURE - - funcDesc = RfcDescribeFunction(funcHandle, NULL) - RfcGetFunctionName(funcDesc, funcName, NULL) - - func_name = wrapString(funcName) - if func_name not in server_functions: - _server_log("genericHandler", f"No metadata found for function '{function_name}'") - return RFC_NOT_FOUND - - func_data = server_functions[func_name] - callback = func_data['callback'] - server = func_data['server'] - # func_desc = func_data['func_desc_handle'] - - try: - rc = RfcGetConnectionAttributes(rfcHandle, &attributes, &errorInfo) - if rc != RFC_OK: - _server_log("genericHandler", f"Request for '{func_name}': Error while retrieving connection attributes (rc={rc}).") - if not server.debug: - raise ExternalRuntimeError(message="Invalid connection handle.") - conn_attr = {} - else: - conn_attr = wrapConnectionAttributes(attributes) - _server_log( - "genericHandler", - "User '{user}' from system '{sysId}' client '{client}' host '{partnerHost}' invokes '{func_name}'" - .format(func_name=func_name, **conn_attr) - ) - - # Context of the request. Might later be extended by activeParameter information. - request_context = { - 'connection_attributes': conn_attr, - 'server_context': context - } - - # Authorization check - auth_function = server_context["auth_check"] - rc = auth_function(func_name, request_context) - if rc != RFC_OK: - new_error = ExternalRuntimeError( - message=f"Authentication exception raised by callback function: '{func_name}'", - code=RFC_EXTERNAL_FAILURE - ) - fillError(new_error, serverErrorInfo) - return RFC_EXTERNAL_FAILURE - - # Filter out variables that are of direction u'RFC_EXPORT' - # (these will be set by the callback function) - func_handle_variables = wrapResult(funcDesc, funcHandle, RFC_EXPORT, server.rstrip) - - # Invoke callback function - result = callback(request_context, **func_handle_variables) - - # Return results - if context["call_type"] != UnitCallType.background_unit: - for name, value in result.iteritems(): - fillFunctionParameter(funcDesc, funcHandle, name, value) - - # Server exception handling: cf. SAP NetWeaver RFC SDK 7.50 - # 5.1 Preparing a Server Program for Receiving RFC Requests - except ExternalRuntimeError as e: # System failure - # Parameter: message (optional: msg_type, msg_class, msg_number, msg_v1-v4) - # returns: RFC_EXTERNAL_FAILURE - fillError(e, serverErrorInfo) - serverErrorInfo.code = RFC_EXTERNAL_FAILURE # Overwrite code, if set. - _server_log("genericHandler", f"Request for '{func_name}' raises ExternalRuntimeError {e} - code set to RFC_EXTERNAL_FAILURE.") - return RFC_EXTERNAL_FAILURE - except ABAPRuntimeError as e: # ABAP Message - # Parameter: msg_type, msg_class, msg_number, msg_v1-v4 - # returns: RFC_ABAP_MESSAGE - fillError(e, serverErrorInfo) - serverErrorInfo.code = RFC_ABAP_MESSAGE # Overwrite code, if set. - _server_log("genericHandler", f"Request for '{func_name}' raises ABAPRuntimeError {e} - code set to RFC_ABAP_MESSAGE.") - return RFC_ABAP_MESSAGE - except ABAPApplicationError as e: # ABAP Exception in implementing function - # Parameter: key (optional: msg_type, msg_class, msg_number, msg_v1-v4) - # returns: RFC_ABAP_EXCEPTION - fillError(e, serverErrorInfo) - serverErrorInfo.code = RFC_ABAP_EXCEPTION # Overwrite code, if set. - _server_log("genericHandler", f"Request for '{func_name}' raises ABAPApplicationError {e} - code set to RFC_ABAP_EXCEPTION.") - return RFC_ABAP_EXCEPTION - except Exception as ex: - exctype, value = exc_info()[:2] - _server_log( - "genericHandler", - f"Request for '{func_name}' raises an invalid exception:\n Exception: {exctype}\n Values: {value}\n" - "Callback functions may only raise ABAPApplicationError, ABAPRuntimeError, or ExternalRuntimeError.\n" - "The values of the request were:\n" - f"params: {func_handle_variables}\nrequest_context: {request_context}" - ) - new_error = ExternalRuntimeError( - message="Invalid exception raised by callback function.", - code=RFC_EXTERNAL_FAILURE - ) - fillError(new_error, serverErrorInfo) - return RFC_EXTERNAL_FAILURE - - return RFC_OK - - -cdef class Server: - """ An ABAP server - - An instance of :class:`~pyrfc.Server` allows for installing - Python callback functions and serve requests from SAP systems. - - :param server_params: Parameters for registering Python server. - The parameters may contain the following keywords: - ``GWHOST`, ``GWSERV``, ``PROGRAM_ID``, ``TRACE``, - and ``SAPROUTER``. - - :type server_params: dict - - :param client_params: Parameters for Python client connection. - The parameters may contain the following keywords: - ``GWHOST`, ``GWSERV``, ``PROGRAM_ID``, ``TRACE``, - and ``SAPROUTER``. - - :type server_params: dict - - :param config: Configuration of the instance. Allowed keys are: - - ``debug`` - For testing/debugging operations. If True, the server - behaves more permissive, e.g. allows incoming calls without a - valid connection handle. (default is False) - - :type config: dict or None (default) - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection attempt fails. - """ - cdef public bint debug - cdef public bint rstrip - cdef Connection _client_connection - cdef ServerConnection _server_connection - cdef object _server_thread - - __bgRfcFunction = { - "check": None, - "commit": None, - "rollback": None, - "confirm": None, - "getState": None - } - - def __cinit__(self, server_params, client_params, config=None): - # config parsing - config = config or {} - self.debug = config.get('debug', False) - self.rstrip = config.get('rstrip', True) - server_context["server_log"] = config.get("server_log", False) - server_context["auth_check"] = config.get("auth_check", default_auth_check) - server_context["port"] = config.get("port", 8080) - - self._client_connection = Connection(**client_params) - self._server_connection = ServerConnection(**server_params) - self._server_thread=Thread(target=self.serve) - - @staticmethod - cdef RFC_RC __onCheckFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - handler = Server.__bgRfcFunction["check"] - if handler is None: - return RCStatus.OK.value - try: - unit_identifier = wrapUnitIdentifier(identifier[0]) - return handler(rfcHandle, unit_identifier).value - except Exception as ex: - _server_log("Error in bgRFC handler onCheck:", ex) - return RCStatus.RFC_EXTERNAL_FAILURE.value - - @staticmethod - cdef RFC_RC __onCommitFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - handler = Server.__bgRfcFunction["commit"] - if handler is None: - return RCStatus.OK.value - try: - unit_identifier = wrapUnitIdentifier(identifier[0]) - return handler(rfcHandle, unit_identifier).value - except Exception as ex: - _server_log("Error in bgRFC handler onCommit:", ex) - return RCStatus.RFC_EXTERNAL_FAILURE.value - - @staticmethod - cdef RFC_RC __onRollbackFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - handler = Server.__bgRfcFunction["rollback"] - if handler is None: - return RCStatus.OK.value - try: - unit_identifier = wrapUnitIdentifier(identifier[0]) - return handler(rfcHandle, unit_identifier).value - except Exception as ex: - _server_log("Error in bgRFC handler onRollback:", ex) - return RCStatus.RFC_EXTERNAL_FAILURE.value - - @staticmethod - cdef RFC_RC __onConfirmFunction(RFC_CONNECTION_HANDLE rfcHandle, const RFC_UNIT_IDENTIFIER *identifier) with gil: - handler = Server.__bgRfcFunction["confirm"] - if handler is None: - return RCStatus.OK.value - try: - unit_identifier = wrapUnitIdentifier(identifier[0]) - return handler(rfcHandle, unit_identifier).value - except Exception as ex: - _server_log("Error in bgRFC handler onConfirm:", ex) - return RCStatus.RFC_EXTERNAL_FAILURE.value - - @staticmethod - cdef RFC_RC __onGetStateFunction( - RFC_CONNECTION_HANDLE rfcHandle, - const RFC_UNIT_IDENTIFIER *identifier, - RFC_UNIT_STATE *unitState - ) with gil: - handler = Server.__bgRfcFunction["getState"] - if handler is None: - _server_log("bgRFC handler onGetState is not registered for server connection handle '{rfcHandle}'") - return RCStatus.RFC_EXTERNAL_FAILURE.value - try: - unit_identifier = wrapUnitIdentifier(identifier[0]) - state = handler(rfcHandle, unit_identifier) - # section 5.6.3 pg 84 of SAP NWRFC SDK Programming Guide 7.50 - if state == UnitState.created or state == UnitState.executed: - unitState[0] = RFC_UNIT_IN_PROCESS - elif state == UnitState.committed: - idunitStateentifier[0] = RFC_UNIT_COMMITTED - elif state == UnitState.rolled_back: - unitState[0] = RFC_UNIT_ROLLED_BACK - elif state == UnitState.confirmed: - unitState[0] = RFC_UNIT_CONFIRMED - else: - raise Exception(f"TID {unit_identifier['id']} invalid state '{state}'") - return RCStatus.OK.value - except Exception as ex: - _server_log("Error in bgRFC handler onGetState:\n", ex) - return RCStatus.RFC_EXTERNAL_FAILURE.value - - def bgrfc_init(self, sysId, bgRfcFunction): - """Installs the necessary callback functions for processing incoming bgRFC calls. - - These functions need to be implemented by Python application and will be used by the RFC runtime. - When no callback function is provided, the default one is used, - not necessarily matching your application requirements. - - For more info search for the ``RfcInstallBgRfcHandlers`` method in - `SAP NetWeaver RFC SDK Doxygen Documentation `_ - - :param sysId: System ID of the SAP system for which to use this set of transaction handlers, or None - When None value provided, the transaction handlers will be used for bgRFC calls from - any backend system, for which no explicit handlers have been installed. - :type sysId: string or None - - :param bgRfcFunction: Function callbacks - :type bgRfcFunction: dict(str, function) - - * "check": onCheckFunction, - * "commit": onCommitFunction, - * "rollback": onRollbackFunction, - * "confirm": onConfirmFunction, - * "getState": onGetStateFunction, - - :return: error code, zero when no error - """ - for func_name in bgRfcFunction: - if func_name not in Server.__bgRfcFunction: - raise TypeError(f"BgRfc callback function key not supported: '{func_name}'") - if not callable(bgRfcFunction[func_name]): - raise TypeError(f"BgRfc callback function referenced by '{func_name}' is not callable: '{bgRfcFunction[func_name]}'") - Server.__bgRfcFunction[func_name] = bgRfcFunction[func_name] - return self.install_bgrfc_handlers(sysId) - - def install_bgrfc_handlers(self, sysId): - ucSysId = fillString(sysId) if sysId is not None else NULL - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc = RfcInstallBgRfcHandlers( - ucSysId, - Server.__onCheckFunction, - Server.__onCommitFunction, - Server.__onRollbackFunction, - Server.__onConfirmFunction, - Server.__onGetStateFunction, - &errorInfo - ) - free(ucSysId) - if rc != RFC_OK or errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - return rc - - def add_function(self, func_name, callback): - """ - Installs a function in the server. - - :param func_name: ABAP remote function module name - :type func_name: string - - :param callback: A callback function that implements the logic. - The function must accept a ``request_context`` parameter and - all IMPORT, CHANGING, and TABLE parameters of the given - ``func_desc``. - :raises: :exc:`TypeError` if a function with the name given is already - installed. - """ - global server_functions - if func_name in server_functions: - raise TypeError(f"Server function '{func_name}' already installed.") - - if not self._client_connection: - self._client_connection.open() - cdef RFC_ERROR_INFO errorInfo - cdef RFC_ABAP_NAME funcName = fillString(func_name) - cdef RFC_FUNCTION_DESC_HANDLE func_desc_handle = RfcGetFunctionDesc(self._client_connection._handle, funcName, &errorInfo) - self._client_connection.close() - - if errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - - server_functions[func_name] = { - "func_desc_handle": func_desc_handle, - "callback": callback, - "server": self - } - - _server_log("Server function installed", func_name) - _server_log("Server function installed", server_functions[func_name]) - - def serve(self): - """ - Starts the RFC server, waiting for incoming requests and processes them. - - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the server processing fails. - """ - cdef RFC_ERROR_INFO errorInfo - - cdef RFC_RC rc = RfcInstallGenericServerFunction(genericHandler, metadataLookup, &errorInfo) - if rc != RFC_OK or errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - - rc = RfcLaunchServer(self._server_connection._handle, &errorInfo) - if rc != RFC_OK or errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - _server_log("Server", f"launched {self._server_connection.handle}") - - return rc - - def start(self): - """ - Start the RFC server in new thread, waiting for incoming requests and processes them. - """ - self._server_thread.start() - - def stop(self): - """ - Stop the RFC server thread. - """ - if self._server_thread.is_alive(): - self._server_thread.join() - - def close(self): - """ Explicitly close the registration. - Note that this is usually not necessary as the registration will be closed - automatically upon object destruction. However, if the the object destruction - is delayed by the garbage collection, problems may occur when too many - servers are registered. - """ - self.stop() - self._close() - - def get_server_attributes(self): - """Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server. - - :returns: Dictionary with server state and attributes - :rtype: dict(str, str or int) - - * serverName: This server's name as given when creating the server. - * protocolType: This RFC server's type: - RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER - * registrationCount: The current number of active registrations (in case of a Registered Server) - or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) - * state: Used in state information in order to indicate the current state of an RFC Server. - * currentBusyCount: The number of requests currently being processed. - * peakBusyCount: The maximum number of requests the server has been processing in parallel since it has been created - """ - cdef RFC_RC rc - cdef RFC_SERVER_ATTRIBUTES attributes - cdef RFC_ERROR_INFO errorInfo - - rc = RfcGetServerAttributes(self._server_connection._handle, &attributes, &errorInfo) - if rc != RFC_OK or errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - rfcServerState = wrapString(RfcGetServerStateAsString(attributes.state), -1, True) - return { - # This server's name as given when creating the server. - 'serverName': wrapString(attributes.serverName, -1, True) - # This RFC server's type. Will be one of RFC_MULTI_COUNT_REGISTERED_SERVER or RFC_TCP_SOCKET_SERVER - , 'protocolType': "multi count" if attributes.type == RFC_MULTI_COUNT_REGISTERED_SERVER - else socket.gethostname() # Own host name - # The current number of active registrations (in case of a Registered Server) - # or the maximum number of parallel connections the server will accept (in case of a TCP Socket Server) - , 'registrationCount': attributes.registrationCount - # Used in state information in order to indicate the current state of an RFC Server. - , 'state': rfcServerState - # The number of requests currently being processed. - , 'currentBusyCount': attributes.currentBusyCount - # The maximum number of requests the server has been processing in parallel since it has been created - , 'peakBusyCount': attributes.peakBusyCount - } - - def _close(self): - """ Close the connection (private function) - :raises: :exc:`~pyrfc.RFCError` or a subclass - thereof if the connection cannot be closed cleanly. - """ - # Shutdown server - if self._server_connection: - self._server_connection.close() - # Remove all installed server functions - after_remove = {} - global server_functions - for func_name, func_data in server_functions.items(): - if func_data["server"] != self: - after_remove[func_name] = func_data - server_functions = after_remove - - cdef _error(self, RFC_ERROR_INFO* errorInfo): - """ - Error treatment of a connection. - - :param errorInfo: the errorInfo data given in a RFC that returned an RC > 0. - :return: nothing, raises an error - """ - # TODO: Error treatment server - # Set alive=false if the error is in a certain group - # Before, the alive=false setting depended on the error code. However, the group seems more robust here. - # errorInfo.code in - # RFC_COMMUNICATION_FAILURE, RFC_ABAP_MESSAGE, RFC_ABAP_RUNTIME_FAILURE, RFC_INVALID_HANDLE, RFC_NOT_FOUND, RFC_INVALID_PARAMETER: - # if errorInfo.group in (ABAP_RUNTIME_FAILURE, LOGON_FAILURE, COMMUNICATION_FAILURE, EXTERNAL_RUNTIME_FAILURE): - # self.alive = False - - raise wrapError(errorInfo) - - -cdef RFC_TYPE_DESC_HANDLE fillTypeDescription(type_desc): - """ - :param type_desc: object of class TypeDescription - :return: Handle of RFC_TYPE_DESC_HANDLE - """ - cdef RFC_RC rc = RFC_OK - cdef RFC_ERROR_INFO errorInfo - cdef RFC_TYPE_DESC_HANDLE typeDesc - cdef RFC_FIELD_DESC fieldDesc - cdef SAP_UC* sapuc - - # Set name, nuc_length, and uc_length - sapuc = fillString(type_desc.name) - typeDesc = RfcCreateTypeDesc(sapuc, &errorInfo) - free(sapuc) - if typeDesc == NULL: - raise wrapError(&errorInfo) - rc = RfcSetTypeLength(typeDesc, type_desc.nuc_length, type_desc.uc_length, &errorInfo) - if rc != RFC_OK: - RfcDestroyTypeDesc(typeDesc, NULL) - raise wrapError(&errorInfo) - - for field_desc in type_desc.fields: - # Set name - sapuc = fillString(field_desc['name']) - strncpyU(fieldDesc.name, sapuc, len(field_desc['name']) + 1) - free(sapuc) - fieldDesc.type = RfcFieldType[field_desc['field_type']].value - fieldDesc.nucLength = field_desc['nuc_length'] - fieldDesc.nucOffset = field_desc['nuc_offset'] - fieldDesc.ucLength = field_desc['uc_length'] - fieldDesc.ucOffset = field_desc['uc_offset'] - fieldDesc.decimals = field_desc['decimals'] - if field_desc['type_description'] is not None: - fieldDesc.typeDescHandle = fillTypeDescription(field_desc['type_description']) - else: - fieldDesc.typeDescHandle = NULL - fieldDesc.extendedDescription = NULL - rc = RfcAddTypeField(typeDesc, &fieldDesc, &errorInfo) - if rc != RFC_OK: - RfcDestroyTypeDesc(typeDesc, NULL) - raise wrapError(&errorInfo) - - return typeDesc - -cdef RFC_FUNCTION_DESC_HANDLE fillFunctionDescription(func_desc): - """ - :param func_desc: object of class FunctionDescription - :return: Handle of RFC_FUNCTION_DESC_HANDLE - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_FUNCTION_DESC_HANDLE funcDesc - cdef RFC_PARAMETER_DESC paramDesc - cdef SAP_UC* sapuc - - # Set name - sapuc = fillString(func_desc.name) - funcDesc = RfcCreateFunctionDesc(sapuc, &errorInfo) - free(sapuc) - if funcDesc == NULL: - raise wrapError(&errorInfo) - - for param_desc in func_desc.parameters: - sapuc = fillString(param_desc['name']) - strncpyU(paramDesc.name, sapuc, len(param_desc['name']) + 1) - free(sapuc) - paramDesc.type = RfcFieldType[param_desc['parameter_type']].value - paramDesc.direction = RfcParameterDirection[param_desc['direction']].value - paramDesc.nucLength = param_desc['nuc_length'] - paramDesc.ucLength = param_desc['uc_length'] - paramDesc.decimals = param_desc['decimals'] - # defaultValue - sapuc = fillString(param_desc['default_value']) - strncpyU(paramDesc.defaultValue, sapuc, len(param_desc['default_value']) + 1) - free(sapuc) - # parameterText - sapuc = fillString(param_desc['parameter_text']) - strncpyU(paramDesc.parameterText, sapuc, len(param_desc['parameter_text']) + 1) - free(sapuc) - paramDesc.optional = param_desc['optional'] - if param_desc['type_description'] is not None: - paramDesc.typeDescHandle = fillTypeDescription(param_desc['type_description']) - else: - paramDesc.typeDescHandle = NULL - paramDesc.extendedDescription = NULL - rc = RfcAddParameter(funcDesc, ¶mDesc, &errorInfo) - if rc != RFC_OK: - RfcDestroyFunctionDesc(funcDesc, NULL) - raise wrapError(&errorInfo) - - return funcDesc - -cdef RFC_UNIT_IDENTIFIER fillUnitIdentifier(unit) except *: - cdef RFC_UNIT_IDENTIFIER uIdentifier - cdef SAP_UC* sapuc - uIdentifier.unitType = fillString("Q" if unit['queued'] else "T")[0] - if len(unit['id']) != RFC_UNITID_LN: - raise RFCError(f"Invalid length of unit['id'] (should be {RFC_UNITID_LN}, but found {len(unit['id'])}).") - sapuc = fillString(unit['id']) - strncpyU(uIdentifier.unitID, sapuc, RFC_UNITID_LN + 1) - free(sapuc) - return uIdentifier diff --git a/src/pyrfc/throughput.pyx b/src/pyrfc/throughput.pyx deleted file mode 100644 index 4edff09..0000000 --- a/src/pyrfc/throughput.pyx +++ /dev/null @@ -1,201 +0,0 @@ - -################################################################################ -# THROUGHPUT FUNCTIONS # -################################################################################ - -cdef class Throughput: - _registry = [] - - cdef RFC_THROUGHPUT_HANDLE _throughput_handle - cdef _connections - - def __init__(self, connections = None): - cdef RFC_ERROR_INFO errorInfo - self._throughput_handle = NULL - self._connections = set() - self._throughput_handle = RfcCreateThroughput(&errorInfo) - if errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - Throughput._registry.append(self) - connections = connections or [] - if type(connections) is not list: - connections = [connections] - for conn in connections: - if not isinstance(conn, Connection): - raise TypeError('Connection object required, received', conn, 'of type', type(conn)) - self.setOnConnection(conn) - - @property - def connections(self): - """Get connections attached to throughput monitoring - - :getter: Connections' instances - :type: set of Connection - """ - return self._connections - - @property - def _handle(self): - """Get throughput object handle - - :getter: Throughput object handle - :type: uintptr_t - """ - return self._throughput_handle - - def setOnConnection(self, Connection connection): - """Attaches a throughput object to a connection to be monitored by the throughput object. - Once attached to a connection, the throughput object collects the data statistics of - function calls invoked via this connection. - - For more info search for the ``RfcSetThroughputOnConnection`` method in - `SAP NetWeaver RFC SDK Doxygen Documentation `_ - - :param connection: Connection instance to be attached to throughput monitoring - :type connection: Connection - - :return: nothing, raises an error - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc = RfcSetThroughputOnConnection(connection._handle, self._throughput_handle, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - self._connections.add(connection) - - @staticmethod - def getFromConnection(Connection connection): - """Returns the currently attached throughput object from a connection, if any. - - For more info search for the ``RfcGetThroughputFromConnection`` method in - `SAP NetWeaver RFC SDK Doxygen Documentation `_ - - :param connection: Connection instance - :type connection: Connection - - :returns: Throughput object the connection is attached to, if any - :rtype: Throughput - - :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_THROUGHPUT_HANDLE throughput = RfcGetThroughputFromConnection(connection._handle, &errorInfo) - if errorInfo.code != RFC_OK: - raise wrapError(&errorInfo) - for t in Throughput._registry: - if t._handle == throughput: - return t - return None - - def removeFromConnection(self, Connection connection): - """Removes the throughput object from a connection. - The connection will no longer be monitored. - - :param connection: Connection instance - :type connection: Connection - :returns: Nothing - :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc = RfcRemoveThroughputFromConnection(connection._handle, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - self._connections.remove(connection) - - def reset(self): - """Resets the data so far collected and aggregated by the throughput object. - - :returns: Nothing - :raises: :exc:`~pyrfc.RFCError` or a subclass in case of error - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc = RfcResetThroughput(self._throughput_handle, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - - cdef _destroy(self): - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc - self._registry.clear() - self._connections = None - if self._throughput_handle != NULL: - rc = RfcDestroyThroughput(self._throughput_handle, &errorInfo) - self._throughput_handle = NULL - if rc != RFC_OK: - # is ok - pass - - def __del__(self): - self.destroy() - - def __exit__(self, type, value, traceback): - self._destroy() - - def __enter__(self): - return self - - @property - def stats(self): - """Get throughput monitor statistics - - :getter: Throughput monitor counters - :type: dict(str,int) - - * numberOfCalls - * sentBytes - * receivedBytes - * applicationTime - * totalTime - * serializationTime - * deserializationTime - """ - cdef RFC_ERROR_INFO errorInfo - cdef RFC_RC rc - cdef SAP_ULLONG numberOfCalls - cdef SAP_ULLONG sentBytes - cdef SAP_ULLONG receivedBytes - cdef SAP_ULLONG applicationTime - cdef SAP_ULLONG totalTime - cdef SAP_ULLONG serializationTime - cdef SAP_ULLONG deserializationTime - - _stats = {} - - if self._throughput_handle == NULL: - raise RFCError('No connections assigned') - - rc = RfcGetNumberOfCalls (self._throughput_handle, &numberOfCalls, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - _stats['numberOfCalls'] = numberOfCalls - - rc = RfcGetSentBytes (self._throughput_handle, &sentBytes, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - _stats['sentBytes'] = sentBytes - - rc = RfcGetReceivedBytes (self._throughput_handle, &receivedBytes, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - _stats['receivedBytes'] = receivedBytes - - rc = RfcGetApplicationTime (self._throughput_handle, &applicationTime, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - _stats['applicationTime'] = applicationTime - - rc = RfcGetTotalTime (self._throughput_handle, &totalTime, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - _stats['totalTime'] = totalTime - - rc = RfcGetSerializationTime (self._throughput_handle, &serializationTime, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - _stats['serializationTime'] = serializationTime - - rc = RfcGetDeserializationTime (self._throughput_handle, &deserializationTime, &errorInfo) - if rc != RFC_OK: - raise wrapError(&errorInfo) - _stats['deserializationTime'] = deserializationTime - - return _stats diff --git a/tests/test_errors_abap.py b/tests/test_errors_abap.py index ae7212d..6788f03 100755 --- a/tests/test_errors_abap.py +++ b/tests/test_errors_abap.py @@ -133,7 +133,7 @@ def test_RFC_RAISE_ERROR_AbapRuntimeError_E36(self): assert self.conn.alive is True error = ex.value assert error.code == 4 - assert "Division by 0" in error.message + assert "Division by 0" in str(error.message) def test_RFC_RAISE_ERROR_AbapRuntimeError_E51(self): # '51_E': 'ABAPRuntimeError-3-BLOCKED_COMMIT-A database commit was blocked by the application.-True''] == @@ -144,6 +144,18 @@ def test_RFC_RAISE_ERROR_AbapRuntimeError_E51(self): assert error.code == 3 assert error.key == "BLOCKED_COMMIT" + def test_pyrfc_exc_string(self): + with pytest.raises(ABAPApplicationError)as ex: + self.conn.call("RFC_READ_TABLE", QUERY_TABLE="T008X", DELIMITER=".") + error = ex.value + assert error.code == 5 + assert error.key == "TABLE_NOT_AVAILABLE" + assert error.message == "ID:SV Type:E Number:029 T008X" + assert error.msg_type == "E" + assert error.msg_number == "029" + assert error.msg_v1 == "T008X" + assert str(error) == "5 (rc=5): key=TABLE_NOT_AVAILABLE, message=ID:SV Type:E Number:029 T008X [MSG: class=SV, type=E, number=029, v1-4:=T008X;;;]" + # def test_RFC_RAISE_ERROR_ExternalRuntimeError(self): # # Comment: cf. result_print of the error_test.py # # '11_E': 'ExternalRuntimeError-17-RFC_NOT_FOUND-Function RFCPING not found-True',