diff --git a/CITATION.cff b/CITATION.cff index 7c0139c..f11819d 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -5,7 +5,7 @@ authors: given-names: "Otto" orcid: "https://orcid.org/0000-0002-3363-9287" title: "Pyreadstat" -version: 1.2.2 +version: 1.2.3 doi: 10.5281/zenodo.6612282 date-released: 2018-09-24 url: "https://github.com/Roche/pyreadstat" diff --git a/README.md b/README.md index 72d12d9..92f1da2 100644 --- a/README.md +++ b/README.md @@ -194,9 +194,7 @@ You can also install from the github repo directly (without cloning). Use the fl pip install git+https://github.com/Roche/pyreadstat.git ``` -You need a working C compiler. If working in python 2.7 you will need -cython version >= 0.28 installed (see later Python 2.7 support). For python 3, cython -is not necessary if compiling on unix, but if installed it will be used. +You need a working C compiler and cython >=3.0.0. ### Compiling on Windows and Mac @@ -870,17 +868,9 @@ Converting data types from foreign applications into python some times also brin ## Python 2.7 support. -Python 2.7 is not actively supported. If it works, we are happy about that. But if it does not, and the -bug is specific for python 2.7 (cannot be reproduced in python 3), the issue is not going to be solved. - -At the moment of writing this document Python 2.7 does not work for windows. -It does work for Mac and Linux. In Mac and Linux, files cannot be opened -if the path contains international (non-ascii) characters. As mentioned -before this bug is not going to be repaired (There is not such issue on -Python 3). - -Starting on version 1.0.6 wheels are not produced for Python 2.7 anymore, -but you can still compile on linux and mac. +As version 1.2.3 Python 2.7 is not supported. In previous versions it was possible to compile it for +mac and linux but not for windows, but no wheels were provided. In linux and mac it will fail if + the path file contains non-ascii characters. ## Change log diff --git a/change_log.md b/change_log.md index 4a080ba..960d311 100644 --- a/change_log.md +++ b/change_log.md @@ -1,4 +1,8 @@ -# 1.2.1 (github, pypi and conda 2023.06.01) +# 1.2.3 (github, pypi and conda 2023.07.xx) +* changes introduced for compatibility with cython 3.0.0. Cython 0.29 no longer supported. + Python 2.7 no longer supported. + +# 1.2.2 (github, pypi and conda 2023.06.01) * added num_rows to multiprocessing to allow processing of xport, por and sav files not having the number of rows in the metadata. diff --git a/docs/conf.py b/docs/conf.py index f1b63bd..04c0b53 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ # The short X.Y version version = '' # The full version, including alpha/beta/rc tags -release = '1.2.2' +release = '1.2.3' # -- General configuration --------------------------------------------------- diff --git a/pyreadstat/__init__.py b/pyreadstat/__init__.py index 60fe2d7..441d3b3 100644 --- a/pyreadstat/__init__.py +++ b/pyreadstat/__init__.py @@ -20,5 +20,5 @@ from .pyreadstat import read_file_in_chunks, read_file_multiprocessing from ._readstat_parser import ReadstatError, metadata_container -__version__ = "1.2.2" +__version__ = "1.2.3" diff --git a/pyreadstat/_readstat_parser.c b/pyreadstat/_readstat_parser.c index b562556..6d4300f 100644 --- a/pyreadstat/_readstat_parser.c +++ b/pyreadstat/_readstat_parser.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 3.0.0 */ /* BEGIN: Cython Metadata { @@ -13,7 +13,6 @@ "-DHAVE_ZLIB=1" ], "include_dirs": [ - "./pyreadstat", "pyreadstat", "src", "src/stata", @@ -78,20 +77,32 @@ END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "3_0_0" +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030000F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -110,9 +121,7 @@ END: Cython Metadata */ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -120,12 +129,18 @@ END: Cython Metadata */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -150,27 +165,159 @@ END: Cython Metadata */ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS @@ -193,25 +340,29 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -220,10 +371,7 @@ END: Cython Metadata */ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS @@ -232,7 +380,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -250,27 +398,60 @@ END: Cython Metadata */ #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -295,6 +476,17 @@ END: Cython Metadata */ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -308,13 +500,16 @@ END: Cython Metadata */ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -326,24 +521,47 @@ END: Cython Metadata */ #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -353,13 +571,26 @@ END: Cython Metadata */ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -375,26 +606,113 @@ END: Cython Metadata */ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject *co=NULL, *result=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(p))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; + if (!(empty = PyTuple_New(0))) goto end; + result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); + end: + Py_XDECREF((PyObject*) co); + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -408,6 +726,12 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -422,30 +746,53 @@ END: Cython Metadata */ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -454,6 +801,22 @@ END: Cython Metadata */ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -484,6 +847,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -496,34 +881,86 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_PEP393_ENABLED 1 - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #endif #else #define CYTHON_PEP393_ENABLED 0 @@ -533,11 +970,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -548,14 +985,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -584,8 +1027,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -604,6 +1053,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -615,6 +1066,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -627,15 +1081,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 @@ -655,8 +1104,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { } __Pyx_PyAsyncMethodsStruct; #endif -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif #endif #include #ifdef NAN @@ -679,7 +1130,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -693,13 +1153,64 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include #include -#include #include "readstat.h" #include "readstat_io_unistd.h" #include "conditional_includes.h" #include #include #include "datetime.h" + + /* Backport for Python 2.x */ + #if PY_MAJOR_VERSION < 3 + #ifndef PyDateTime_DELTA_GET_DAYS + #define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days) + #endif + #ifndef PyDateTime_DELTA_GET_SECONDS + #define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds) + #endif + #ifndef PyDateTime_DELTA_GET_MICROSECONDS + #define PyDateTime_DELTA_GET_MICROSECONDS(o) (((PyDateTime_Delta*)o)->microseconds) + #endif + #endif + + /* Backport for Python < 3.6 */ + #if PY_VERSION_HEX < 0x030600a4 + #ifndef PyDateTime_TIME_GET_FOLD + #define PyDateTime_TIME_GET_FOLD(o) ((void)(o), 0) + #endif + #ifndef PyDateTime_DATE_GET_FOLD + #define PyDateTime_DATE_GET_FOLD(o) ((void)(o), 0) + #endif + #endif + + /* Backport for Python < 3.6 */ + #if PY_VERSION_HEX < 0x030600a4 + #define __Pyx_DateTime_DateTimeWithFold(year, month, day, hour, minute, second, microsecond, tz, fold) ((void)(fold), PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI->DateTimeType)) + #define __Pyx_DateTime_TimeWithFold(hour, minute, second, microsecond, tz, fold) ((void)(fold), PyDateTimeAPI->Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI->TimeType)) + #else /* For Python 3.6+ so that we can pass tz */ + #define __Pyx_DateTime_DateTimeWithFold(year, month, day, hour, minute, second, microsecond, tz, fold) PyDateTimeAPI->DateTime_FromDateAndTimeAndFold(year, month, day, hour, minute, second, microsecond, tz, fold, PyDateTimeAPI->DateTimeType) + #define __Pyx_DateTime_TimeWithFold(hour, minute, second, microsecond, tz, fold) PyDateTimeAPI->Time_FromTimeAndFold(hour, minute, second, microsecond, tz, fold, PyDateTimeAPI->TimeType) + #endif + + /* Backport for Python < 3.7 */ + #if PY_VERSION_HEX < 0x030700b1 + #define __Pyx_TimeZone_UTC NULL + #define __Pyx_TimeZone_FromOffsetAndName(offset, name) ((void)(offset), (void)(name), (PyObject*)NULL) + #else + #define __Pyx_TimeZone_UTC PyDateTime_TimeZone_UTC + #define __Pyx_TimeZone_FromOffsetAndName(offset, name) PyTimeZone_FromOffsetAndName(offset, name) + #endif + + /* Backport for Python < 3.10 */ + #if PY_VERSION_HEX < 0x030a00a1 + #ifndef PyDateTime_TIME_GET_TZINFO + #define PyDateTime_TIME_GET_TZINFO(o) ((((PyDateTime_Time*)o)->hastzinfo) ? ((PyDateTime_Time*)o)->tzinfo : Py_None) + #endif + #ifndef PyDateTime_DATE_GET_TZINFO + #define PyDateTime_DATE_GET_TZINFO(o) ((((PyDateTime_DateTime*)o)->hastzinfo) ? ((PyDateTime_DateTime*)o)->tzinfo : Py_None) + #endif + #endif + #include #ifdef _OPENMP #include @@ -769,9 +1280,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -779,11 +1290,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -797,6 +1319,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -808,7 +1331,52 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -830,7 +1398,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -895,35 +1463,105 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { "pyreadstat/_readstat_parser.pyx", - "stringsource", + "", "datetime.pxd", "type.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container; +struct __pyx_opt_args_7cpython_8datetime_time_new; +struct __pyx_opt_args_7cpython_8datetime_datetime_new; +struct __pyx_opt_args_7cpython_8datetime_timezone_new; +struct __pyx_opt_args_7cpython_8datetime_datetime_from_timestamp; -/* "pyreadstat/_readstat_parser.pxd":23 - * # Definitions of enum types +/* "cpython/datetime.pxd":292 + * # Create time object using DateTime CAPI factory function + * # Note, there are no range checks for any of the arguments. + * cdef inline time time_new(int hour, int minute, int second, int microsecond, object tz, int fold=0): # <<<<<<<<<<<<<< + * return __Pyx_DateTime_TimeWithFold(hour, minute, second, microsecond, tz, fold) * - * ctypedef enum py_file_format: # <<<<<<<<<<<<<< - * FILE_FORMAT_SAS - * FILE_FORMAT_SPSS + */ +struct __pyx_opt_args_7cpython_8datetime_time_new { + int __pyx_n; + int fold; +}; + +/* "cpython/datetime.pxd":297 + * # Create datetime object using DateTime CAPI factory function. + * # Note, there are no range checks for any of the arguments. + * cdef inline datetime datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz, int fold=0): # <<<<<<<<<<<<<< + * return __Pyx_DateTime_DateTimeWithFold(year, month, day, hour, minute, second, microsecond, tz, fold) + * + */ +struct __pyx_opt_args_7cpython_8datetime_datetime_new { + int __pyx_n; + int fold; +}; + +/* "cpython/datetime.pxd":306 + * + * # Create timedelta object using DateTime CAPI factory function. + * cdef inline object timezone_new(object offset, object name=None): # <<<<<<<<<<<<<< + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') + */ +struct __pyx_opt_args_7cpython_8datetime_timezone_new { + int __pyx_n; + PyObject *name; +}; + +/* "cpython/datetime.pxd":312 + * + * # Create datetime object using DB API constructor. + * cdef inline datetime datetime_from_timestamp(timestamp, tz=None): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.DateTime_FromTimestamp( + * PyDateTimeAPI.DateTimeType, (timestamp, tz) if tz is not None else (timestamp,), NULL) + */ +struct __pyx_opt_args_7cpython_8datetime_datetime_from_timestamp { + int __pyx_n; + PyObject *tz; +}; + +/* "pyreadstat/_readstat_parser.pxd":22 + * + * # Definitions of enum types + * ctypedef enum py_file_extension: # <<<<<<<<<<<<<< + * FILE_EXT_SAV + * FILE_EXT_SAS7BDAT + */ +enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension { + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAV, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BDAT, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_DTA, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_XPORT, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_POR, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BCAT +}; +typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension; + +/* "pyreadstat/_readstat_parser.pxd":30 + * FILE_EXT_SAS7BCAT + * + * ctypedef enum py_file_format: # <<<<<<<<<<<<<< + * FILE_FORMAT_SAS + * FILE_FORMAT_SPSS */ enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_format { __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS, @@ -932,7 +1570,7 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_t_10pyreadstat_16_readstat_parser_py_file_format; -/* "pyreadstat/_readstat_parser.pxd":28 +/* "pyreadstat/_readstat_parser.pxd":35 * FILE_FORMAT_STATA * * ctypedef enum py_datetime_format: # <<<<<<<<<<<<<< @@ -947,7 +1585,7 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format; -/* "pyreadstat/_readstat_parser.pxd":34 +/* "pyreadstat/_readstat_parser.pxd":41 * DATE_FORMAT_TIME * * ctypedef enum py_variable_format: # <<<<<<<<<<<<<< @@ -962,7 +1600,7 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format; -/* "pyreadstat/_readstat_parser.pxd":42 +/* "pyreadstat/_readstat_parser.pxd":49 * # Definitions of extension types * * cdef class data_container: # <<<<<<<<<<<<<< @@ -1008,6 +1646,7 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { int no_datetime_conversion; }; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1016,11 +1655,11 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1030,28 +1669,40 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1062,6 +1713,10 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1073,39 +1728,30 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* KeywordStringCheck.proto */ -static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ @@ -1117,7 +1763,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) @@ -1133,9 +1779,90 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -1151,28 +1878,33 @@ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* s return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* None.proto */ +/* ModFloat[double].proto */ static CYTHON_INLINE double __Pyx_mod_double(double, double); /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1181,28 +1913,17 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif +#endif +#endif /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ @@ -1254,18 +1975,18 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ +#define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} +} while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) @@ -1273,12 +1994,47 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - -/* None.proto */ +/* RaiseUnboundLocalError.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +/* UnicodeConcatInPlace.proto */ +# if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_REFNANNY + #define __Pyx_PyUnicode_ConcatInPlace(left, right) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right, __pyx_refnanny) + #else + #define __Pyx_PyUnicode_ConcatInPlace(left, right) __Pyx_PyUnicode_ConcatInPlaceImpl(&left, right) + #endif + static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right + #if CYTHON_REFNANNY + , void* __pyx_refnanny + #endif + ); +#else +#define __Pyx_PyUnicode_ConcatInPlace __Pyx_PyUnicode_Concat +#endif +#define __Pyx_PyUnicode_ConcatInPlaceSafe(left, right) ((unlikely((left) == Py_None) || unlikely((right) == Py_None)) ?\ + PyNumber_InPlaceAdd(left, right) : __Pyx_PyUnicode_ConcatInPlace(left, right)) + +/* StrConcatInPlace.proto */ +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyStr_Concat __Pyx_PyUnicode_Concat + #define __Pyx_PyStr_ConcatInPlace __Pyx_PyUnicode_ConcatInPlace +#else + #define __Pyx_PyStr_Concat PyNumber_Add + #define __Pyx_PyStr_ConcatInPlace PyNumber_InPlaceAdd +#endif +#define __Pyx_PyStr_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyStr_Concat(a, b)) +#define __Pyx_PyStr_ConcatInPlaceSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_InPlaceAdd(a, b) : __Pyx_PyStr_ConcatInPlace(a, b)) + +/* PyObject_Str.proto */ +#define __Pyx_PyObject_Str(obj)\ + (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { @@ -1325,6 +2081,9 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice( PyObject** py_start, PyObject** py_stop, PyObject** py_slice, int has_cstart, int has_cstop, int wraparound); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* dict_getitem_default.proto */ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); @@ -1353,6 +2112,9 @@ static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction * #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif +/* PyObjectCall2Args.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* PyObjectGetMethod.proto */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); @@ -1362,15 +2124,6 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name /* append.proto */ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - /* StrEquals.proto */ #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals @@ -1398,7 +2151,7 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif @@ -1433,7 +2186,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1448,14 +2201,6 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1483,6 +2228,28 @@ static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { #endif } +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -1497,21 +2264,28 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_0 +#define __PYX_HAVE_RT_ImportType_proto_3_0_0 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_0 { + __Pyx_ImportType_CheckSize_Error_3_0_0 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_0 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_0 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size); #endif /* Import.proto */ @@ -1520,24 +2294,72 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ImportDottedModuleRelFirst.proto */ +static PyObject *__Pyx_ImportDottedModuleRelFirst(PyObject *name, PyObject *parts_tuple); + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + /* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif /* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED 1 +#define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { +#if PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif #if PY_VERSION_HEX < 0x030500A0 PyObject *func_weakreflist; #endif @@ -1548,7 +2370,9 @@ typedef struct { PyObject *func_globals; PyObject *func_code; PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 PyObject *func_classobj; +#endif void *defaults; int defaults_pyobjects; size_t defaults_size; // used by FusedFunction for copying defaults @@ -1557,14 +2381,17 @@ typedef struct { PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; + PyObject *func_is_coroutine; } __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *self, + PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); @@ -1574,7 +2401,18 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); -static int __pyx_CyFunction_init(void); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, @@ -1597,12 +2435,25 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); +/* PyObjectLookupSpecial.proto */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); +#else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); +/* Py3UpdateBases.proto */ +static PyObject* __Pyx_PEP560_update_bases(PyObject *bases); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1611,6 +2462,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1624,13 +2476,14 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif @@ -1661,17 +2514,34 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ @@ -1686,42 +2556,59 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4date_4year_year(PyDateTime_Date *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4date_5month_month(PyDateTime_Date *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4date_3day_day(PyDateTime_Date *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_4hour_hour(PyDateTime_Time *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_6minute_minute(PyDateTime_Time *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_6second_second(PyDateTime_Time *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_11microsecond_microsecond(PyDateTime_Time *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_4time_6tzinfo_tzinfo(PyDateTime_Time *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_4fold_fold(PyDateTime_Time *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_4year_year(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_5month_month(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_3day_day(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_4hour_hour(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_6minute_minute(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_6second_second(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_11microsecond_microsecond(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_8datetime_6tzinfo_tzinfo(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_4fold_fold(PyDateTime_DateTime *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_9timedelta_3day_day(PyDateTime_Delta *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_9timedelta_6second_second(PyDateTime_Delta *__pyx_v_self); /* proto*/ +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_9timedelta_11microsecond_microsecond(PyDateTime_Delta *__pyx_v_self); /* proto*/ + +/* Module declarations from "libc.stddef" */ -/* Module declarations from 'libc.stddef' */ +/* Module declarations from "pyreadstat.readstat_api" */ -/* Module declarations from 'pyreadstat.readstat_api' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "cpython.type" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.version" */ -/* Module declarations from 'datetime' */ +/* Module declarations from "datetime" */ -/* Module declarations from 'cpython.datetime' */ -static PyTypeObject *__pyx_ptype_7cpython_8datetime_date = 0; -static PyTypeObject *__pyx_ptype_7cpython_8datetime_time = 0; -static PyTypeObject *__pyx_ptype_7cpython_8datetime_datetime = 0; -static PyTypeObject *__pyx_ptype_7cpython_8datetime_timedelta = 0; -static PyTypeObject *__pyx_ptype_7cpython_8datetime_tzinfo = 0; +/* Module declarations from "cpython.datetime" */ static CYTHON_INLINE void __pyx_f_7cpython_8datetime_import_datetime(void); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_new(int, int, int, int, int, int, int, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_timedelta_new(int, int, int); /*proto*/ +static CYTHON_INLINE PyDateTime_DateTime *__pyx_f_7cpython_8datetime_datetime_new(int, int, int, int, int, int, int, PyObject *, struct __pyx_opt_args_7cpython_8datetime_datetime_new *__pyx_optional_args); /*proto*/ +static CYTHON_INLINE PyDateTime_Delta *__pyx_f_7cpython_8datetime_timedelta_new(int, int, int); /*proto*/ -/* Module declarations from 'cpython.exc' */ +/* Module declarations from "cpython.exc" */ -/* Module declarations from 'libc.math' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'pyreadstat._readstat_parser' */ -static PyTypeObject *__pyx_ptype_10pyreadstat_16_readstat_parser_data_container = 0; +/* Module declarations from "pyreadstat._readstat_parser" */ static PyObject *__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types = 0; static PyObject *__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats = 0; static PyObject *__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats = 0; @@ -1746,17 +2633,20 @@ static int __pyx_f_10pyreadstat_16_readstat_parser_handle_value(int, readstat_va static int __pyx_f_10pyreadstat_16_readstat_parser_handle_value_label(char *, readstat_value_t, char *, void *); /*proto*/ static int __pyx_f_10pyreadstat_16_readstat_parser_handle_note(int, char *, void *); /*proto*/ static void __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_error_t); /*proto*/ -static void __pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser(char *, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *, readstat_error_t (readstat_parser_t *, char const *, void *), long, long); /*proto*/ +static void __pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser(char *, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension, long, long); /*proto*/ static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_data_container_to_dict(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *); /*proto*/ static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_dict_to_pandas_dataframe(PyObject *, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *); /*proto*/ static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_data_container_extract_metadata(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *); /*proto*/ static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(readstat_value_t, int, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *); /*proto*/ static int __pyx_f_10pyreadstat_16_readstat_parser_handle_open(char const *, void *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "pyreadstat._readstat_parser" extern int __pyx_module_is_main_pyreadstat___readstat_parser; int __pyx_module_is_main_pyreadstat___readstat_parser = 0; -/* Implementation of 'pyreadstat._readstat_parser' */ +/* Implementation of "pyreadstat._readstat_parser" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_range; @@ -1764,8 +2654,13 @@ static PyObject *__pyx_builtin_chr; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_zip; static PyObject *__pyx_builtin_UnicodeError; +static PyObject *__pyx_builtin_RuntimeError; +/* #### Code section: string_decls ### */ static const char __pyx_k_d[] = "%d"; -static const char __pyx_k__3[] = ""; +static const char __pyx_k__2[] = ""; +static const char __pyx_k__8[] = "."; +static const char __pyx_k__9[] = "*"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_hi[] = "hi"; static const char __pyx_k_lo[] = "lo"; static const char __pyx_k_np[] = "np"; @@ -1776,6 +2671,7 @@ static const char __pyx_k_tC[] = "%tC"; static const char __pyx_k_tc[] = "%tc"; static const char __pyx_k_td[] = "%td"; static const char __pyx_k_TOD[] = "TOD"; +static const char __pyx_k__15[] = "?"; static const char __pyx_k_chr[] = "chr"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_get[] = "get"; @@ -1797,6 +2693,7 @@ static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "name"; static const char __pyx_k_path[] = "path"; static const char __pyx_k_self[] = "self"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_time[] = "time"; static const char __pyx_k_warn[] = "warn"; @@ -1822,6 +2719,7 @@ static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_right[] = "right"; static const char __pyx_k_scale[] = "scale"; +static const char __pyx_k_super[] = "super"; static const char __pyx_k_utf_8[] = "utf-8"; static const char __pyx_k_ADATE8[] = "ADATE8"; static const char __pyx_k_DATE11[] = "DATE11"; @@ -1838,8 +2736,10 @@ static const char __pyx_k_YYMMDD[] = "YYMMDD"; static const char __pyx_k_append[] = "append"; static const char __pyx_k_astype[] = "astype"; static const char __pyx_k_center[] = "center"; +static const char __pyx_k_dict_2[] = "__dict__"; static const char __pyx_k_double[] = "double"; static const char __pyx_k_dtypes[] = "dtypes"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; @@ -1878,6 +2778,7 @@ static const char __pyx_k_YYMMDDN[] = "YYMMDDN"; static const char __pyx_k_YYMMDDP[] = "YYMMDDP"; static const char __pyx_k_YYMMDDS[] = "YYMMDDS"; static const char __pyx_k_columns[] = "columns"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_float64[] = "float64"; static const char __pyx_k_nominal[] = "nominal"; static const char __pyx_k_ordinal[] = "ordinal"; @@ -1908,6 +2809,7 @@ static const char __pyx_k_fsencode[] = "fsencode"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_pyx_capi[] = "__pyx_capi__"; static const char __pyx_k_qualname[] = "__qualname__"; +static const char __pyx_k_set_name[] = "__set_name__"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_warnings[] = "warnings"; static const char __pyx_k_DATETIME8[] = "DATETIME8"; @@ -1925,7 +2827,9 @@ static const char __pyx_k_MMDDYYS10[] = "MMDDYYS10"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_from_dict[] = "from_dict"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_metaclass[] = "__metaclass__"; +static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_DATETIME17[] = "DATETIME17"; static const char __pyx_k_DATETIME18[] = "DATETIME18"; @@ -1942,19 +2846,26 @@ static const char __pyx_k_table_name[] = "table_name"; static const char __pyx_k_tcHH_MM_SS[] = "%tcHH:MM:SS"; static const char __pyx_k_OrderedDict[] = "OrderedDict"; static const char __pyx_k_collections[] = "collections"; +static const char __pyx_k_mro_entries[] = "__mro_entries__"; static const char __pyx_k_number_rows[] = "number_rows"; static const char __pyx_k_spss_origin[] = "spss_origin"; static const char __pyx_k_to_datetime[] = "to_datetime"; static const char __pyx_k_DATETIME23_2[] = "DATETIME23.2"; +static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_UnicodeError[] = "UnicodeError"; static const char __pyx_k_column_names[] = "column_names"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_stata_origin[] = "stata_origin"; +static const char __pyx_k_stringsource[] = ""; static const char __pyx_k_tdCCYY_NN_DD[] = "%tdCCYY-NN-DD"; static const char __pyx_k_undetermined[] = "undetermined"; static const char __pyx_k_value_labels[] = "value_labels"; static const char __pyx_k_ReadstatError[] = "ReadstatError"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_column_labels[] = "column_labels"; static const char __pyx_k_file_encoding[] = "file_encoding"; +static const char __pyx_k_init_subclass[] = "__init_subclass__"; static const char __pyx_k_output_format[] = "output_format"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_data_container[] = "data_container"; @@ -1974,6 +2885,7 @@ static const char __pyx_k_spss_date_formats[] = "spss_date_formats"; static const char __pyx_k_spss_time_formats[] = "spss_time_formats"; static const char __pyx_k_stata_all_formats[] = "stata_all_formats"; static const char __pyx_k_variable_to_label[] = "variable_to_label"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_metadata_container[] = "metadata_container"; static const char __pyx_k_stata_date_formats[] = "stata_date_formats"; @@ -1995,11539 +2907,14296 @@ static const char __pyx_k_readstat_to_numpy_types[] = "readstat_to_numpy_types"; static const char __pyx_k_readstat_variable_types[] = "readstat_variable_types"; static const char __pyx_k_metadata_container___init[] = "metadata_container.__init__"; static const char __pyx_k_pyreadstat__readstat_parser[] = "pyreadstat._readstat_parser"; +static const char __pyx_k_data_container___reduce_cython[] = "data_container.__reduce_cython__"; static const char __pyx_k_Just_defining_a_custom_exceptio[] = "\n Just defining a custom exception to raise when readstat gives an error return code.\n "; static const char __pyx_k_This_class_holds_metadata_we_wa[] = "\n This class holds metadata we want to give back to python\n "; static const char __pyx_k_pyreadstat__readstat_parser_pyx[] = "pyreadstat/_readstat_parser.pyx"; static const char __pyx_k_Failed_convert_C_to_python_value[] = "Failed convert C to python value"; static const char __pyx_k_Failed_to_read_number_of_variabl[] = "Failed to read number of variables"; static const char __pyx_k_STRING_type_with_value_s_with_da[] = "STRING type with value '%s' with date type in column '%s'"; +static const char __pyx_k_Time_zones_are_not_available_fro[] = "Time zones are not available from the C-API."; static const char __pyx_k_column_0_is_duplicated_renamed_t[] = "column '{0}' is duplicated, renamed to '{1}'"; +static const char __pyx_k_data_container___setstate_cython[] = "data_container.__setstate_cython__"; static const char __pyx_k_file_path_could_not_be_encoded_w[] = "file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly."; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_output_format_must_be_one_of_all[] = "output format must be one of {allowed_formats}, '{output_format}' was given"; static const char __pyx_k_path_must_be_either_str_or_bytes[] = "path must be either str or bytes"; +static const char __pyx_k_path_must_be_str_bytes_or_unicod[] = "path must be str, bytes or unicode"; static const char __pyx_k_Just_defining_a_custom_exceptio_2[] = "\n Just defining a custom exception to raise when pyreadstat raises an exception.\n "; -static PyObject *__pyx_n_s_ADATE; -static PyObject *__pyx_n_s_ADATE10; -static PyObject *__pyx_n_s_ADATE8; -static PyObject *__pyx_n_s_B8601DA; -static PyObject *__pyx_n_s_B8601DN; -static PyObject *__pyx_n_s_B8601DT; -static PyObject *__pyx_n_s_B8601TM; -static PyObject *__pyx_n_s_DATE; -static PyObject *__pyx_n_s_DATE11; -static PyObject *__pyx_n_s_DATE12; -static PyObject *__pyx_n_s_DATE8; -static PyObject *__pyx_n_s_DATE9; -static PyObject *__pyx_n_s_DATEAMPM; -static PyObject *__pyx_n_s_DATETIME; -static PyObject *__pyx_n_s_DATETIME17; -static PyObject *__pyx_n_s_DATETIME18; -static PyObject *__pyx_n_s_DATETIME19; -static PyObject *__pyx_n_s_DATETIME20; -static PyObject *__pyx_n_s_DATETIME21; -static PyObject *__pyx_n_s_DATETIME22; -static PyObject *__pyx_kp_s_DATETIME23_2; -static PyObject *__pyx_n_s_DATETIME8; -static PyObject *__pyx_n_s_DDMMYY; -static PyObject *__pyx_n_s_DDMMYYB; -static PyObject *__pyx_n_s_DDMMYYB10; -static PyObject *__pyx_n_s_DDMMYYC; -static PyObject *__pyx_n_s_DDMMYYC10; -static PyObject *__pyx_n_s_DDMMYYD; -static PyObject *__pyx_n_s_DDMMYYD10; -static PyObject *__pyx_n_s_DDMMYYN6; -static PyObject *__pyx_n_s_DDMMYYN8; -static PyObject *__pyx_n_s_DDMMYYP; -static PyObject *__pyx_n_s_DDMMYYP10; -static PyObject *__pyx_n_s_DDMMYYS; -static PyObject *__pyx_n_s_DDMMYYS10; -static PyObject *__pyx_n_s_DTDATE; -static PyObject *__pyx_n_s_DTIME; -static PyObject *__pyx_n_s_DataFrame; -static PyObject *__pyx_n_s_E8601DA; -static PyObject *__pyx_n_s_E8601DT; -static PyObject *__pyx_n_s_E8601TM; -static PyObject *__pyx_n_s_EDATE; -static PyObject *__pyx_n_s_EDATE10; -static PyObject *__pyx_n_s_EDATE8; -static PyObject *__pyx_kp_s_Failed_convert_C_to_python_value; -static PyObject *__pyx_kp_s_Failed_to_read_number_of_variabl; -static PyObject *__pyx_kp_s_File_0_does_not_exist; -static PyObject *__pyx_n_s_HHMM; -static PyObject *__pyx_n_s_IS8601DA; -static PyObject *__pyx_n_s_IS8601DT; -static PyObject *__pyx_n_s_IS8601TM; -static PyObject *__pyx_n_s_JDATE; -static PyObject *__pyx_n_s_JDATE5; -static PyObject *__pyx_n_s_JDATE7; -static PyObject *__pyx_kp_s_Just_defining_a_custom_exceptio; -static PyObject *__pyx_kp_s_Just_defining_a_custom_exceptio_2; -static PyObject *__pyx_kp_s_M8_ns; -static PyObject *__pyx_n_s_MDYAMPM; -static PyObject *__pyx_n_s_MMDDYY; -static PyObject *__pyx_n_s_MMDDYYB; -static PyObject *__pyx_n_s_MMDDYYB10; -static PyObject *__pyx_n_s_MMDDYYC; -static PyObject *__pyx_n_s_MMDDYYC10; -static PyObject *__pyx_n_s_MMDDYYD; -static PyObject *__pyx_n_s_MMDDYYD10; -static PyObject *__pyx_n_s_MMDDYYN6; -static PyObject *__pyx_n_s_MMDDYYN8; -static PyObject *__pyx_n_s_MMDDYYP; -static PyObject *__pyx_n_s_MMDDYYP10; -static PyObject *__pyx_n_s_MMDDYYS; -static PyObject *__pyx_n_s_MMDDYYS10; -static PyObject *__pyx_n_s_NULL; -static PyObject *__pyx_n_s_OrderedDict; -static PyObject *__pyx_n_s_PyreadstatError; -static PyObject *__pyx_n_s_ReadstatError; -static PyObject *__pyx_n_s_SDATE; -static PyObject *__pyx_n_s_SDATE10; -static PyObject *__pyx_n_s_SDATE8; -static PyObject *__pyx_kp_s_STRING_type_with_value_s_with_da; -static PyObject *__pyx_n_s_TIME; -static PyObject *__pyx_kp_s_TIME11_2; -static PyObject *__pyx_n_s_TIME20; -static PyObject *__pyx_kp_s_TIME20_3; -static PyObject *__pyx_n_s_TIME5; -static PyObject *__pyx_n_s_TIME8; -static PyObject *__pyx_n_s_TIMEAMPM; -static PyObject *__pyx_n_s_TOD; -static PyObject *__pyx_kp_s_This_class_holds_metadata_we_wa; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_n_s_UnicodeError; -static PyObject *__pyx_kp_s_Unknown_file_format; -static PyObject *__pyx_kp_s_Unkown_data_type; -static PyObject *__pyx_n_s_WEEKDATE; -static PyObject *__pyx_n_s_WEEKDATX; -static PyObject *__pyx_n_s_YMDHMS16; -static PyObject *__pyx_n_s_YMDHMS19; -static PyObject *__pyx_kp_s_YMDHMS19_2; -static PyObject *__pyx_n_s_YMDHMS20; -static PyObject *__pyx_n_s_YYMMDD; -static PyObject *__pyx_n_s_YYMMDD10; -static PyObject *__pyx_n_s_YYMMDDB; -static PyObject *__pyx_n_s_YYMMDDD; -static PyObject *__pyx_n_s_YYMMDDN; -static PyObject *__pyx_n_s_YYMMDDP; -static PyObject *__pyx_n_s_YYMMDDS; -static PyObject *__pyx_kp_s__3; -static PyObject *__pyx_n_s_allowed_formats; -static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_astype; -static PyObject *__pyx_n_s_center; -static PyObject *__pyx_n_s_chr; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_collections; -static PyObject *__pyx_kp_s_column_0_is_duplicated_renamed_t; -static PyObject *__pyx_n_s_column_labels; -static PyObject *__pyx_n_s_column_names; -static PyObject *__pyx_n_s_column_names_to_labels; -static PyObject *__pyx_n_s_columns; -static PyObject *__pyx_n_s_copy; -static PyObject *__pyx_kp_s_d; -static PyObject *__pyx_n_s_data_container; -static PyObject *__pyx_n_s_date; -static PyObject *__pyx_n_s_dict; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_double; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_dtypes; -static PyObject *__pyx_n_s_duplicated; -static PyObject *__pyx_n_s_empty; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_expanduser; -static PyObject *__pyx_n_s_file_encoding; -static PyObject *__pyx_n_s_file_label; -static PyObject *__pyx_kp_s_file_path_could_not_be_encoded_w; -static PyObject *__pyx_n_s_fill; -static PyObject *__pyx_n_s_float; -static PyObject *__pyx_n_s_float64; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_from_dict; -static PyObject *__pyx_n_s_fsdecode; -static PyObject *__pyx_n_s_fsencode; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_getfilesystemencoding; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_n_s_hi; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_int16; -static PyObject *__pyx_n_s_int32; -static PyObject *__pyx_n_s_int64; -static PyObject *__pyx_n_s_int8; -static PyObject *__pyx_n_s_isfile; -static PyObject *__pyx_n_s_items; -static PyObject *__pyx_n_s_left; -static PyObject *__pyx_n_s_lo; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_metadata_container; -static PyObject *__pyx_n_s_metadata_container___init; -static PyObject *__pyx_n_s_missing_ranges; -static PyObject *__pyx_n_s_missing_user_values; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_nan; -static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; -static PyObject *__pyx_n_s_nominal; -static PyObject *__pyx_n_s_notes; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_nt; -static PyObject *__pyx_n_s_number_columns; -static PyObject *__pyx_n_s_number_rows; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_n_s_object; -static PyObject *__pyx_n_s_ordinal; -static PyObject *__pyx_n_s_original_variable_types; -static PyObject *__pyx_n_s_os; -static PyObject *__pyx_n_s_output_format; -static PyObject *__pyx_kp_s_output_format_must_be_one_of_all; -static PyObject *__pyx_n_s_pandas; -static PyObject *__pyx_n_s_path; -static PyObject *__pyx_kp_s_path_must_be_either_str_or_bytes; -static PyObject *__pyx_n_s_pd; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_pyreadstat__readstat_parser; -static PyObject *__pyx_kp_s_pyreadstat__readstat_parser_pyx; -static PyObject *__pyx_n_s_pyx_capi; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_readstat_to_numpy_types; -static PyObject *__pyx_n_s_readstat_variable_types; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_right; -static PyObject *__pyx_n_s_sas_all_formats; -static PyObject *__pyx_n_s_sas_date_formats; -static PyObject *__pyx_n_s_sas_datetime_formats; -static PyObject *__pyx_n_s_sas_origin; -static PyObject *__pyx_n_s_sas_time_formats; -static PyObject *__pyx_n_s_scale; -static PyObject *__pyx_n_s_self; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_spss_all_formats; -static PyObject *__pyx_n_s_spss_date_formats; -static PyObject *__pyx_n_s_spss_datetime_formats; -static PyObject *__pyx_n_s_spss_origin; -static PyObject *__pyx_n_s_spss_time_formats; -static PyObject *__pyx_n_s_stata_all_formats; -static PyObject *__pyx_n_s_stata_date_formats; -static PyObject *__pyx_n_s_stata_datetime_formats; -static PyObject *__pyx_n_s_stata_origin; -static PyObject *__pyx_n_s_stata_time_formats; -static PyObject *__pyx_n_s_string; -static PyObject *__pyx_n_s_surrogateescape; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_kp_s_tC; -static PyObject *__pyx_n_s_table_name; -static PyObject *__pyx_kp_s_tc; -static PyObject *__pyx_kp_s_tcHH_MM; -static PyObject *__pyx_kp_s_tcHH_MM_SS; -static PyObject *__pyx_kp_s_td; -static PyObject *__pyx_kp_s_tdCCYY_NN_DD; -static PyObject *__pyx_kp_s_tdD_m_Y; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_time; -static PyObject *__pyx_n_s_to_datetime; -static PyObject *__pyx_n_s_tolist; -static PyObject *__pyx_n_s_undetermined; -static PyObject *__pyx_n_s_unknown; -static PyObject *__pyx_kp_s_utf_8; -static PyObject *__pyx_n_s_value_labels; -static PyObject *__pyx_n_s_variable_alignment; -static PyObject *__pyx_n_s_variable_display_width; -static PyObject *__pyx_n_s_variable_measure; -static PyObject *__pyx_n_s_variable_storage_width; -static PyObject *__pyx_n_s_variable_to_label; -static PyObject *__pyx_n_s_variable_value_labels; -static PyObject *__pyx_n_s_warn; -static PyObject *__pyx_n_s_warnings; -static PyObject *__pyx_n_s_zip; +/* #### Code section: decls ### */ static int __pyx_pf_10pyreadstat_16_readstat_parser_14data_container___cinit__(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_14data_container_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_14data_container_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_18metadata_container___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_tp_new_10pyreadstat_16_readstat_parser_data_container(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_100000; -static PyObject *__pyx_tuple_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_codeobj__10; -/* Late includes */ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, 0, 0, 0, 0}; +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_8datetime_date; + PyTypeObject *__pyx_ptype_7cpython_8datetime_time; + PyTypeObject *__pyx_ptype_7cpython_8datetime_datetime; + PyTypeObject *__pyx_ptype_7cpython_8datetime_timedelta; + PyTypeObject *__pyx_ptype_7cpython_8datetime_tzinfo; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type_10pyreadstat_16_readstat_parser_data_container; + #endif + PyTypeObject *__pyx_ptype_10pyreadstat_16_readstat_parser_data_container; + PyObject *__pyx_n_s_ADATE; + PyObject *__pyx_n_s_ADATE10; + PyObject *__pyx_n_s_ADATE8; + PyObject *__pyx_n_s_B8601DA; + PyObject *__pyx_n_s_B8601DN; + PyObject *__pyx_n_s_B8601DT; + PyObject *__pyx_n_s_B8601TM; + PyObject *__pyx_n_s_DATE; + PyObject *__pyx_n_s_DATE11; + PyObject *__pyx_n_s_DATE12; + PyObject *__pyx_n_s_DATE8; + PyObject *__pyx_n_s_DATE9; + PyObject *__pyx_n_s_DATEAMPM; + PyObject *__pyx_n_s_DATETIME; + PyObject *__pyx_n_s_DATETIME17; + PyObject *__pyx_n_s_DATETIME18; + PyObject *__pyx_n_s_DATETIME19; + PyObject *__pyx_n_s_DATETIME20; + PyObject *__pyx_n_s_DATETIME21; + PyObject *__pyx_n_s_DATETIME22; + PyObject *__pyx_kp_s_DATETIME23_2; + PyObject *__pyx_n_s_DATETIME8; + PyObject *__pyx_n_s_DDMMYY; + PyObject *__pyx_n_s_DDMMYYB; + PyObject *__pyx_n_s_DDMMYYB10; + PyObject *__pyx_n_s_DDMMYYC; + PyObject *__pyx_n_s_DDMMYYC10; + PyObject *__pyx_n_s_DDMMYYD; + PyObject *__pyx_n_s_DDMMYYD10; + PyObject *__pyx_n_s_DDMMYYN6; + PyObject *__pyx_n_s_DDMMYYN8; + PyObject *__pyx_n_s_DDMMYYP; + PyObject *__pyx_n_s_DDMMYYP10; + PyObject *__pyx_n_s_DDMMYYS; + PyObject *__pyx_n_s_DDMMYYS10; + PyObject *__pyx_n_s_DTDATE; + PyObject *__pyx_n_s_DTIME; + PyObject *__pyx_n_s_DataFrame; + PyObject *__pyx_n_s_E8601DA; + PyObject *__pyx_n_s_E8601DT; + PyObject *__pyx_n_s_E8601TM; + PyObject *__pyx_n_s_EDATE; + PyObject *__pyx_n_s_EDATE10; + PyObject *__pyx_n_s_EDATE8; + PyObject *__pyx_kp_s_Failed_convert_C_to_python_value; + PyObject *__pyx_kp_s_Failed_to_read_number_of_variabl; + PyObject *__pyx_kp_s_File_0_does_not_exist; + PyObject *__pyx_n_s_HHMM; + PyObject *__pyx_n_s_IS8601DA; + PyObject *__pyx_n_s_IS8601DT; + PyObject *__pyx_n_s_IS8601TM; + PyObject *__pyx_n_s_JDATE; + PyObject *__pyx_n_s_JDATE5; + PyObject *__pyx_n_s_JDATE7; + PyObject *__pyx_kp_s_Just_defining_a_custom_exceptio; + PyObject *__pyx_kp_s_Just_defining_a_custom_exceptio_2; + PyObject *__pyx_kp_s_M8_ns; + PyObject *__pyx_n_s_MDYAMPM; + PyObject *__pyx_n_s_MMDDYY; + PyObject *__pyx_n_s_MMDDYYB; + PyObject *__pyx_n_s_MMDDYYB10; + PyObject *__pyx_n_s_MMDDYYC; + PyObject *__pyx_n_s_MMDDYYC10; + PyObject *__pyx_n_s_MMDDYYD; + PyObject *__pyx_n_s_MMDDYYD10; + PyObject *__pyx_n_s_MMDDYYN6; + PyObject *__pyx_n_s_MMDDYYN8; + PyObject *__pyx_n_s_MMDDYYP; + PyObject *__pyx_n_s_MMDDYYP10; + PyObject *__pyx_n_s_MMDDYYS; + PyObject *__pyx_n_s_MMDDYYS10; + PyObject *__pyx_n_s_NULL; + PyObject *__pyx_n_s_OrderedDict; + PyObject *__pyx_n_s_PyreadstatError; + PyObject *__pyx_n_s_ReadstatError; + PyObject *__pyx_n_s_RuntimeError; + PyObject *__pyx_n_s_SDATE; + PyObject *__pyx_n_s_SDATE10; + PyObject *__pyx_n_s_SDATE8; + PyObject *__pyx_kp_s_STRING_type_with_value_s_with_da; + PyObject *__pyx_n_s_TIME; + PyObject *__pyx_kp_s_TIME11_2; + PyObject *__pyx_n_s_TIME20; + PyObject *__pyx_kp_s_TIME20_3; + PyObject *__pyx_n_s_TIME5; + PyObject *__pyx_n_s_TIME8; + PyObject *__pyx_n_s_TIMEAMPM; + PyObject *__pyx_n_s_TOD; + PyObject *__pyx_kp_s_This_class_holds_metadata_we_wa; + PyObject *__pyx_kp_s_Time_zones_are_not_available_fro; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_n_s_UnicodeError; + PyObject *__pyx_kp_s_Unknown_file_format; + PyObject *__pyx_kp_s_Unkown_data_type; + PyObject *__pyx_n_s_WEEKDATE; + PyObject *__pyx_n_s_WEEKDATX; + PyObject *__pyx_n_s_YMDHMS16; + PyObject *__pyx_n_s_YMDHMS19; + PyObject *__pyx_kp_s_YMDHMS19_2; + PyObject *__pyx_n_s_YMDHMS20; + PyObject *__pyx_n_s_YYMMDD; + PyObject *__pyx_n_s_YYMMDD10; + PyObject *__pyx_n_s_YYMMDDB; + PyObject *__pyx_n_s_YYMMDDD; + PyObject *__pyx_n_s_YYMMDDN; + PyObject *__pyx_n_s_YYMMDDP; + PyObject *__pyx_n_s_YYMMDDS; + PyObject *__pyx_n_s__15; + PyObject *__pyx_kp_s__2; + PyObject *__pyx_kp_u__8; + PyObject *__pyx_n_s__9; + PyObject *__pyx_n_s_allowed_formats; + PyObject *__pyx_n_s_append; + PyObject *__pyx_n_s_astype; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_center; + PyObject *__pyx_n_s_chr; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_collections; + PyObject *__pyx_kp_s_column_0_is_duplicated_renamed_t; + PyObject *__pyx_n_s_column_labels; + PyObject *__pyx_n_s_column_names; + PyObject *__pyx_n_s_column_names_to_labels; + PyObject *__pyx_n_s_columns; + PyObject *__pyx_n_s_copy; + PyObject *__pyx_kp_s_d; + PyObject *__pyx_n_s_data_container; + PyObject *__pyx_n_s_data_container___reduce_cython; + PyObject *__pyx_n_s_data_container___setstate_cython; + PyObject *__pyx_n_s_date; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_n_s_dict_2; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_doc; + PyObject *__pyx_n_s_double; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_dtypes; + PyObject *__pyx_n_s_duplicated; + PyObject *__pyx_n_s_empty; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_expanduser; + PyObject *__pyx_n_s_file_encoding; + PyObject *__pyx_n_s_file_label; + PyObject *__pyx_kp_s_file_path_could_not_be_encoded_w; + PyObject *__pyx_n_s_fill; + PyObject *__pyx_n_s_float; + PyObject *__pyx_n_s_float64; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_from_dict; + PyObject *__pyx_n_s_fsdecode; + PyObject *__pyx_n_s_fsencode; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_get; + PyObject *__pyx_n_s_getfilesystemencoding; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_n_s_hi; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_init; + PyObject *__pyx_n_s_init_subclass; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int16; + PyObject *__pyx_n_s_int32; + PyObject *__pyx_n_s_int64; + PyObject *__pyx_n_s_int8; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_isfile; + PyObject *__pyx_n_s_items; + PyObject *__pyx_n_s_left; + PyObject *__pyx_n_s_lo; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_metaclass; + PyObject *__pyx_n_s_metadata_container; + PyObject *__pyx_n_s_metadata_container___init; + PyObject *__pyx_n_s_missing_ranges; + PyObject *__pyx_n_s_missing_user_values; + PyObject *__pyx_n_s_module; + PyObject *__pyx_n_s_mro_entries; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_nan; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_nominal; + PyObject *__pyx_n_s_notes; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nt; + PyObject *__pyx_n_s_number_columns; + PyObject *__pyx_n_s_number_rows; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_n_s_object; + PyObject *__pyx_n_s_ordinal; + PyObject *__pyx_n_s_original_variable_types; + PyObject *__pyx_n_s_os; + PyObject *__pyx_n_s_output_format; + PyObject *__pyx_kp_s_output_format_must_be_one_of_all; + PyObject *__pyx_n_s_pandas; + PyObject *__pyx_n_s_path; + PyObject *__pyx_kp_s_path_must_be_either_str_or_bytes; + PyObject *__pyx_kp_s_path_must_be_str_bytes_or_unicod; + PyObject *__pyx_n_s_pd; + PyObject *__pyx_n_s_prepare; + PyObject *__pyx_n_s_pyreadstat__readstat_parser; + PyObject *__pyx_kp_s_pyreadstat__readstat_parser_pyx; + PyObject *__pyx_n_s_pyx_capi; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_qualname; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_readstat_to_numpy_types; + PyObject *__pyx_n_s_readstat_variable_types; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_right; + PyObject *__pyx_n_s_sas_all_formats; + PyObject *__pyx_n_s_sas_date_formats; + PyObject *__pyx_n_s_sas_datetime_formats; + PyObject *__pyx_n_s_sas_origin; + PyObject *__pyx_n_s_sas_time_formats; + PyObject *__pyx_n_s_scale; + PyObject *__pyx_n_s_self; + PyObject *__pyx_n_s_set_name; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_spss_all_formats; + PyObject *__pyx_n_s_spss_date_formats; + PyObject *__pyx_n_s_spss_datetime_formats; + PyObject *__pyx_n_s_spss_origin; + PyObject *__pyx_n_s_spss_time_formats; + PyObject *__pyx_n_s_stata_all_formats; + PyObject *__pyx_n_s_stata_date_formats; + PyObject *__pyx_n_s_stata_datetime_formats; + PyObject *__pyx_n_s_stata_origin; + PyObject *__pyx_n_s_stata_time_formats; + PyObject *__pyx_n_s_string; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_super; + PyObject *__pyx_n_s_surrogateescape; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_kp_s_tC; + PyObject *__pyx_n_s_table_name; + PyObject *__pyx_kp_s_tc; + PyObject *__pyx_kp_s_tcHH_MM; + PyObject *__pyx_kp_s_tcHH_MM_SS; + PyObject *__pyx_kp_s_td; + PyObject *__pyx_kp_s_tdCCYY_NN_DD; + PyObject *__pyx_kp_s_tdD_m_Y; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_time; + PyObject *__pyx_n_s_to_datetime; + PyObject *__pyx_n_s_tolist; + PyObject *__pyx_n_s_undetermined; + PyObject *__pyx_n_s_unknown; + PyObject *__pyx_kp_s_utf_8; + PyObject *__pyx_n_s_value_labels; + PyObject *__pyx_n_s_variable_alignment; + PyObject *__pyx_n_s_variable_display_width; + PyObject *__pyx_n_s_variable_measure; + PyObject *__pyx_n_s_variable_storage_width; + PyObject *__pyx_n_s_variable_to_label; + PyObject *__pyx_n_s_variable_value_labels; + PyObject *__pyx_n_s_warn; + PyObject *__pyx_n_s_warnings; + PyObject *__pyx_n_s_zip; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_100000; + PyObject *__pyx_tuple_; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__5; + PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__7; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__12; + PyObject *__pyx_codeobj__11; + PyObject *__pyx_codeobj__13; + PyObject *__pyx_codeobj__14; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif -/* "pyreadstat/_readstat_parser.pyx":80 - * """ - * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.n_obs = 0 - * self.n_vars = 0 - */ +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) -/* Python wrapper */ -static int __pyx_pw_10pyreadstat_16_readstat_parser_14data_container_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_10pyreadstat_16_readstat_parser_14data_container_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_8datetime_date); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_8datetime_time); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_8datetime_datetime); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_8datetime_timedelta); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_8datetime_tzinfo); + Py_CLEAR(clear_module_state->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container); + Py_CLEAR(clear_module_state->__pyx_type_10pyreadstat_16_readstat_parser_data_container); + Py_CLEAR(clear_module_state->__pyx_n_s_ADATE); + Py_CLEAR(clear_module_state->__pyx_n_s_ADATE10); + Py_CLEAR(clear_module_state->__pyx_n_s_ADATE8); + Py_CLEAR(clear_module_state->__pyx_n_s_B8601DA); + Py_CLEAR(clear_module_state->__pyx_n_s_B8601DN); + Py_CLEAR(clear_module_state->__pyx_n_s_B8601DT); + Py_CLEAR(clear_module_state->__pyx_n_s_B8601TM); + Py_CLEAR(clear_module_state->__pyx_n_s_DATE); + Py_CLEAR(clear_module_state->__pyx_n_s_DATE11); + Py_CLEAR(clear_module_state->__pyx_n_s_DATE12); + Py_CLEAR(clear_module_state->__pyx_n_s_DATE8); + Py_CLEAR(clear_module_state->__pyx_n_s_DATE9); + Py_CLEAR(clear_module_state->__pyx_n_s_DATEAMPM); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME17); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME18); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME19); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME20); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME21); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME22); + Py_CLEAR(clear_module_state->__pyx_kp_s_DATETIME23_2); + Py_CLEAR(clear_module_state->__pyx_n_s_DATETIME8); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYY); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYB); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYB10); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYC); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYC10); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYD); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYD10); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYN6); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYN8); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYP); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYP10); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYS); + Py_CLEAR(clear_module_state->__pyx_n_s_DDMMYYS10); + Py_CLEAR(clear_module_state->__pyx_n_s_DTDATE); + Py_CLEAR(clear_module_state->__pyx_n_s_DTIME); + Py_CLEAR(clear_module_state->__pyx_n_s_DataFrame); + Py_CLEAR(clear_module_state->__pyx_n_s_E8601DA); + Py_CLEAR(clear_module_state->__pyx_n_s_E8601DT); + Py_CLEAR(clear_module_state->__pyx_n_s_E8601TM); + Py_CLEAR(clear_module_state->__pyx_n_s_EDATE); + Py_CLEAR(clear_module_state->__pyx_n_s_EDATE10); + Py_CLEAR(clear_module_state->__pyx_n_s_EDATE8); + Py_CLEAR(clear_module_state->__pyx_kp_s_Failed_convert_C_to_python_value); + Py_CLEAR(clear_module_state->__pyx_kp_s_Failed_to_read_number_of_variabl); + Py_CLEAR(clear_module_state->__pyx_kp_s_File_0_does_not_exist); + Py_CLEAR(clear_module_state->__pyx_n_s_HHMM); + Py_CLEAR(clear_module_state->__pyx_n_s_IS8601DA); + Py_CLEAR(clear_module_state->__pyx_n_s_IS8601DT); + Py_CLEAR(clear_module_state->__pyx_n_s_IS8601TM); + Py_CLEAR(clear_module_state->__pyx_n_s_JDATE); + Py_CLEAR(clear_module_state->__pyx_n_s_JDATE5); + Py_CLEAR(clear_module_state->__pyx_n_s_JDATE7); + Py_CLEAR(clear_module_state->__pyx_kp_s_Just_defining_a_custom_exceptio); + Py_CLEAR(clear_module_state->__pyx_kp_s_Just_defining_a_custom_exceptio_2); + Py_CLEAR(clear_module_state->__pyx_kp_s_M8_ns); + Py_CLEAR(clear_module_state->__pyx_n_s_MDYAMPM); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYY); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYB); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYB10); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYC); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYC10); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYD); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYD10); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYN6); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYN8); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYP); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYP10); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYS); + Py_CLEAR(clear_module_state->__pyx_n_s_MMDDYYS10); + Py_CLEAR(clear_module_state->__pyx_n_s_NULL); + Py_CLEAR(clear_module_state->__pyx_n_s_OrderedDict); + Py_CLEAR(clear_module_state->__pyx_n_s_PyreadstatError); + Py_CLEAR(clear_module_state->__pyx_n_s_ReadstatError); + Py_CLEAR(clear_module_state->__pyx_n_s_RuntimeError); + Py_CLEAR(clear_module_state->__pyx_n_s_SDATE); + Py_CLEAR(clear_module_state->__pyx_n_s_SDATE10); + Py_CLEAR(clear_module_state->__pyx_n_s_SDATE8); + Py_CLEAR(clear_module_state->__pyx_kp_s_STRING_type_with_value_s_with_da); + Py_CLEAR(clear_module_state->__pyx_n_s_TIME); + Py_CLEAR(clear_module_state->__pyx_kp_s_TIME11_2); + Py_CLEAR(clear_module_state->__pyx_n_s_TIME20); + Py_CLEAR(clear_module_state->__pyx_kp_s_TIME20_3); + Py_CLEAR(clear_module_state->__pyx_n_s_TIME5); + Py_CLEAR(clear_module_state->__pyx_n_s_TIME8); + Py_CLEAR(clear_module_state->__pyx_n_s_TIMEAMPM); + Py_CLEAR(clear_module_state->__pyx_n_s_TOD); + Py_CLEAR(clear_module_state->__pyx_kp_s_This_class_holds_metadata_we_wa); + Py_CLEAR(clear_module_state->__pyx_kp_s_Time_zones_are_not_available_fro); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_n_s_UnicodeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unknown_file_format); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unkown_data_type); + Py_CLEAR(clear_module_state->__pyx_n_s_WEEKDATE); + Py_CLEAR(clear_module_state->__pyx_n_s_WEEKDATX); + Py_CLEAR(clear_module_state->__pyx_n_s_YMDHMS16); + Py_CLEAR(clear_module_state->__pyx_n_s_YMDHMS19); + Py_CLEAR(clear_module_state->__pyx_kp_s_YMDHMS19_2); + Py_CLEAR(clear_module_state->__pyx_n_s_YMDHMS20); + Py_CLEAR(clear_module_state->__pyx_n_s_YYMMDD); + Py_CLEAR(clear_module_state->__pyx_n_s_YYMMDD10); + Py_CLEAR(clear_module_state->__pyx_n_s_YYMMDDB); + Py_CLEAR(clear_module_state->__pyx_n_s_YYMMDDD); + Py_CLEAR(clear_module_state->__pyx_n_s_YYMMDDN); + Py_CLEAR(clear_module_state->__pyx_n_s_YYMMDDP); + Py_CLEAR(clear_module_state->__pyx_n_s_YYMMDDS); + Py_CLEAR(clear_module_state->__pyx_n_s__15); + Py_CLEAR(clear_module_state->__pyx_kp_s__2); + Py_CLEAR(clear_module_state->__pyx_kp_u__8); + Py_CLEAR(clear_module_state->__pyx_n_s__9); + Py_CLEAR(clear_module_state->__pyx_n_s_allowed_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_append); + Py_CLEAR(clear_module_state->__pyx_n_s_astype); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_center); + Py_CLEAR(clear_module_state->__pyx_n_s_chr); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_collections); + Py_CLEAR(clear_module_state->__pyx_kp_s_column_0_is_duplicated_renamed_t); + Py_CLEAR(clear_module_state->__pyx_n_s_column_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_column_names); + Py_CLEAR(clear_module_state->__pyx_n_s_column_names_to_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_columns); + Py_CLEAR(clear_module_state->__pyx_n_s_copy); + Py_CLEAR(clear_module_state->__pyx_kp_s_d); + Py_CLEAR(clear_module_state->__pyx_n_s_data_container); + Py_CLEAR(clear_module_state->__pyx_n_s_data_container___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_data_container___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_date); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_dict_2); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_doc); + Py_CLEAR(clear_module_state->__pyx_n_s_double); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtypes); + Py_CLEAR(clear_module_state->__pyx_n_s_duplicated); + Py_CLEAR(clear_module_state->__pyx_n_s_empty); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_expanduser); + Py_CLEAR(clear_module_state->__pyx_n_s_file_encoding); + Py_CLEAR(clear_module_state->__pyx_n_s_file_label); + Py_CLEAR(clear_module_state->__pyx_kp_s_file_path_could_not_be_encoded_w); + Py_CLEAR(clear_module_state->__pyx_n_s_fill); + Py_CLEAR(clear_module_state->__pyx_n_s_float); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_from_dict); + Py_CLEAR(clear_module_state->__pyx_n_s_fsdecode); + Py_CLEAR(clear_module_state->__pyx_n_s_fsencode); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_get); + Py_CLEAR(clear_module_state->__pyx_n_s_getfilesystemencoding); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_n_s_hi); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_init); + Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int16); + Py_CLEAR(clear_module_state->__pyx_n_s_int32); + Py_CLEAR(clear_module_state->__pyx_n_s_int64); + Py_CLEAR(clear_module_state->__pyx_n_s_int8); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_isfile); + Py_CLEAR(clear_module_state->__pyx_n_s_items); + Py_CLEAR(clear_module_state->__pyx_n_s_left); + Py_CLEAR(clear_module_state->__pyx_n_s_lo); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_metaclass); + Py_CLEAR(clear_module_state->__pyx_n_s_metadata_container); + Py_CLEAR(clear_module_state->__pyx_n_s_metadata_container___init); + Py_CLEAR(clear_module_state->__pyx_n_s_missing_ranges); + Py_CLEAR(clear_module_state->__pyx_n_s_missing_user_values); + Py_CLEAR(clear_module_state->__pyx_n_s_module); + Py_CLEAR(clear_module_state->__pyx_n_s_mro_entries); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_nan); + Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_CLEAR(clear_module_state->__pyx_n_s_nominal); + Py_CLEAR(clear_module_state->__pyx_n_s_notes); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nt); + Py_CLEAR(clear_module_state->__pyx_n_s_number_columns); + Py_CLEAR(clear_module_state->__pyx_n_s_number_rows); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_n_s_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ordinal); + Py_CLEAR(clear_module_state->__pyx_n_s_original_variable_types); + Py_CLEAR(clear_module_state->__pyx_n_s_os); + Py_CLEAR(clear_module_state->__pyx_n_s_output_format); + Py_CLEAR(clear_module_state->__pyx_kp_s_output_format_must_be_one_of_all); + Py_CLEAR(clear_module_state->__pyx_n_s_pandas); + Py_CLEAR(clear_module_state->__pyx_n_s_path); + Py_CLEAR(clear_module_state->__pyx_kp_s_path_must_be_either_str_or_bytes); + Py_CLEAR(clear_module_state->__pyx_kp_s_path_must_be_str_bytes_or_unicod); + Py_CLEAR(clear_module_state->__pyx_n_s_pd); + Py_CLEAR(clear_module_state->__pyx_n_s_prepare); + Py_CLEAR(clear_module_state->__pyx_n_s_pyreadstat__readstat_parser); + Py_CLEAR(clear_module_state->__pyx_kp_s_pyreadstat__readstat_parser_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_capi); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_qualname); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_readstat_to_numpy_types); + Py_CLEAR(clear_module_state->__pyx_n_s_readstat_variable_types); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_right); + Py_CLEAR(clear_module_state->__pyx_n_s_sas_all_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_sas_date_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_sas_datetime_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_sas_origin); + Py_CLEAR(clear_module_state->__pyx_n_s_sas_time_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_scale); + Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_n_s_set_name); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_spss_all_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_spss_date_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_spss_datetime_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_spss_origin); + Py_CLEAR(clear_module_state->__pyx_n_s_spss_time_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_stata_all_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_stata_date_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_stata_datetime_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_stata_origin); + Py_CLEAR(clear_module_state->__pyx_n_s_stata_time_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_string); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_super); + Py_CLEAR(clear_module_state->__pyx_n_s_surrogateescape); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_kp_s_tC); + Py_CLEAR(clear_module_state->__pyx_n_s_table_name); + Py_CLEAR(clear_module_state->__pyx_kp_s_tc); + Py_CLEAR(clear_module_state->__pyx_kp_s_tcHH_MM); + Py_CLEAR(clear_module_state->__pyx_kp_s_tcHH_MM_SS); + Py_CLEAR(clear_module_state->__pyx_kp_s_td); + Py_CLEAR(clear_module_state->__pyx_kp_s_tdCCYY_NN_DD); + Py_CLEAR(clear_module_state->__pyx_kp_s_tdD_m_Y); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_time); + Py_CLEAR(clear_module_state->__pyx_n_s_to_datetime); + Py_CLEAR(clear_module_state->__pyx_n_s_tolist); + Py_CLEAR(clear_module_state->__pyx_n_s_undetermined); + Py_CLEAR(clear_module_state->__pyx_n_s_unknown); + Py_CLEAR(clear_module_state->__pyx_kp_s_utf_8); + Py_CLEAR(clear_module_state->__pyx_n_s_value_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_alignment); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_display_width); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_measure); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_storage_width); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_to_label); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_value_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_warn); + Py_CLEAR(clear_module_state->__pyx_n_s_warnings); + Py_CLEAR(clear_module_state->__pyx_n_s_zip); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_100000); + Py_CLEAR(clear_module_state->__pyx_tuple_); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__5); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__7); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_codeobj__11); + Py_CLEAR(clear_module_state->__pyx_codeobj__13); + Py_CLEAR(clear_module_state->__pyx_codeobj__14); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_8datetime_date); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_8datetime_time); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_8datetime_datetime); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_8datetime_timedelta); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_8datetime_tzinfo); + Py_VISIT(traverse_module_state->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container); + Py_VISIT(traverse_module_state->__pyx_type_10pyreadstat_16_readstat_parser_data_container); + Py_VISIT(traverse_module_state->__pyx_n_s_ADATE); + Py_VISIT(traverse_module_state->__pyx_n_s_ADATE10); + Py_VISIT(traverse_module_state->__pyx_n_s_ADATE8); + Py_VISIT(traverse_module_state->__pyx_n_s_B8601DA); + Py_VISIT(traverse_module_state->__pyx_n_s_B8601DN); + Py_VISIT(traverse_module_state->__pyx_n_s_B8601DT); + Py_VISIT(traverse_module_state->__pyx_n_s_B8601TM); + Py_VISIT(traverse_module_state->__pyx_n_s_DATE); + Py_VISIT(traverse_module_state->__pyx_n_s_DATE11); + Py_VISIT(traverse_module_state->__pyx_n_s_DATE12); + Py_VISIT(traverse_module_state->__pyx_n_s_DATE8); + Py_VISIT(traverse_module_state->__pyx_n_s_DATE9); + Py_VISIT(traverse_module_state->__pyx_n_s_DATEAMPM); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME17); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME18); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME19); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME20); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME21); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME22); + Py_VISIT(traverse_module_state->__pyx_kp_s_DATETIME23_2); + Py_VISIT(traverse_module_state->__pyx_n_s_DATETIME8); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYY); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYB); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYB10); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYC); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYC10); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYD); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYD10); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYN6); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYN8); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYP); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYP10); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYS); + Py_VISIT(traverse_module_state->__pyx_n_s_DDMMYYS10); + Py_VISIT(traverse_module_state->__pyx_n_s_DTDATE); + Py_VISIT(traverse_module_state->__pyx_n_s_DTIME); + Py_VISIT(traverse_module_state->__pyx_n_s_DataFrame); + Py_VISIT(traverse_module_state->__pyx_n_s_E8601DA); + Py_VISIT(traverse_module_state->__pyx_n_s_E8601DT); + Py_VISIT(traverse_module_state->__pyx_n_s_E8601TM); + Py_VISIT(traverse_module_state->__pyx_n_s_EDATE); + Py_VISIT(traverse_module_state->__pyx_n_s_EDATE10); + Py_VISIT(traverse_module_state->__pyx_n_s_EDATE8); + Py_VISIT(traverse_module_state->__pyx_kp_s_Failed_convert_C_to_python_value); + Py_VISIT(traverse_module_state->__pyx_kp_s_Failed_to_read_number_of_variabl); + Py_VISIT(traverse_module_state->__pyx_kp_s_File_0_does_not_exist); + Py_VISIT(traverse_module_state->__pyx_n_s_HHMM); + Py_VISIT(traverse_module_state->__pyx_n_s_IS8601DA); + Py_VISIT(traverse_module_state->__pyx_n_s_IS8601DT); + Py_VISIT(traverse_module_state->__pyx_n_s_IS8601TM); + Py_VISIT(traverse_module_state->__pyx_n_s_JDATE); + Py_VISIT(traverse_module_state->__pyx_n_s_JDATE5); + Py_VISIT(traverse_module_state->__pyx_n_s_JDATE7); + Py_VISIT(traverse_module_state->__pyx_kp_s_Just_defining_a_custom_exceptio); + Py_VISIT(traverse_module_state->__pyx_kp_s_Just_defining_a_custom_exceptio_2); + Py_VISIT(traverse_module_state->__pyx_kp_s_M8_ns); + Py_VISIT(traverse_module_state->__pyx_n_s_MDYAMPM); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYY); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYB); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYB10); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYC); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYC10); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYD); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYD10); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYN6); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYN8); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYP); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYP10); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYS); + Py_VISIT(traverse_module_state->__pyx_n_s_MMDDYYS10); + Py_VISIT(traverse_module_state->__pyx_n_s_NULL); + Py_VISIT(traverse_module_state->__pyx_n_s_OrderedDict); + Py_VISIT(traverse_module_state->__pyx_n_s_PyreadstatError); + Py_VISIT(traverse_module_state->__pyx_n_s_ReadstatError); + Py_VISIT(traverse_module_state->__pyx_n_s_RuntimeError); + Py_VISIT(traverse_module_state->__pyx_n_s_SDATE); + Py_VISIT(traverse_module_state->__pyx_n_s_SDATE10); + Py_VISIT(traverse_module_state->__pyx_n_s_SDATE8); + Py_VISIT(traverse_module_state->__pyx_kp_s_STRING_type_with_value_s_with_da); + Py_VISIT(traverse_module_state->__pyx_n_s_TIME); + Py_VISIT(traverse_module_state->__pyx_kp_s_TIME11_2); + Py_VISIT(traverse_module_state->__pyx_n_s_TIME20); + Py_VISIT(traverse_module_state->__pyx_kp_s_TIME20_3); + Py_VISIT(traverse_module_state->__pyx_n_s_TIME5); + Py_VISIT(traverse_module_state->__pyx_n_s_TIME8); + Py_VISIT(traverse_module_state->__pyx_n_s_TIMEAMPM); + Py_VISIT(traverse_module_state->__pyx_n_s_TOD); + Py_VISIT(traverse_module_state->__pyx_kp_s_This_class_holds_metadata_we_wa); + Py_VISIT(traverse_module_state->__pyx_kp_s_Time_zones_are_not_available_fro); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_n_s_UnicodeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unknown_file_format); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unkown_data_type); + Py_VISIT(traverse_module_state->__pyx_n_s_WEEKDATE); + Py_VISIT(traverse_module_state->__pyx_n_s_WEEKDATX); + Py_VISIT(traverse_module_state->__pyx_n_s_YMDHMS16); + Py_VISIT(traverse_module_state->__pyx_n_s_YMDHMS19); + Py_VISIT(traverse_module_state->__pyx_kp_s_YMDHMS19_2); + Py_VISIT(traverse_module_state->__pyx_n_s_YMDHMS20); + Py_VISIT(traverse_module_state->__pyx_n_s_YYMMDD); + Py_VISIT(traverse_module_state->__pyx_n_s_YYMMDD10); + Py_VISIT(traverse_module_state->__pyx_n_s_YYMMDDB); + Py_VISIT(traverse_module_state->__pyx_n_s_YYMMDDD); + Py_VISIT(traverse_module_state->__pyx_n_s_YYMMDDN); + Py_VISIT(traverse_module_state->__pyx_n_s_YYMMDDP); + Py_VISIT(traverse_module_state->__pyx_n_s_YYMMDDS); + Py_VISIT(traverse_module_state->__pyx_n_s__15); + Py_VISIT(traverse_module_state->__pyx_kp_s__2); + Py_VISIT(traverse_module_state->__pyx_kp_u__8); + Py_VISIT(traverse_module_state->__pyx_n_s__9); + Py_VISIT(traverse_module_state->__pyx_n_s_allowed_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_append); + Py_VISIT(traverse_module_state->__pyx_n_s_astype); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_center); + Py_VISIT(traverse_module_state->__pyx_n_s_chr); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_collections); + Py_VISIT(traverse_module_state->__pyx_kp_s_column_0_is_duplicated_renamed_t); + Py_VISIT(traverse_module_state->__pyx_n_s_column_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_column_names); + Py_VISIT(traverse_module_state->__pyx_n_s_column_names_to_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_columns); + Py_VISIT(traverse_module_state->__pyx_n_s_copy); + Py_VISIT(traverse_module_state->__pyx_kp_s_d); + Py_VISIT(traverse_module_state->__pyx_n_s_data_container); + Py_VISIT(traverse_module_state->__pyx_n_s_data_container___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_data_container___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_date); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_dict_2); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_doc); + Py_VISIT(traverse_module_state->__pyx_n_s_double); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtypes); + Py_VISIT(traverse_module_state->__pyx_n_s_duplicated); + Py_VISIT(traverse_module_state->__pyx_n_s_empty); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_expanduser); + Py_VISIT(traverse_module_state->__pyx_n_s_file_encoding); + Py_VISIT(traverse_module_state->__pyx_n_s_file_label); + Py_VISIT(traverse_module_state->__pyx_kp_s_file_path_could_not_be_encoded_w); + Py_VISIT(traverse_module_state->__pyx_n_s_fill); + Py_VISIT(traverse_module_state->__pyx_n_s_float); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_from_dict); + Py_VISIT(traverse_module_state->__pyx_n_s_fsdecode); + Py_VISIT(traverse_module_state->__pyx_n_s_fsencode); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_get); + Py_VISIT(traverse_module_state->__pyx_n_s_getfilesystemencoding); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_n_s_hi); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_init); + Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int16); + Py_VISIT(traverse_module_state->__pyx_n_s_int32); + Py_VISIT(traverse_module_state->__pyx_n_s_int64); + Py_VISIT(traverse_module_state->__pyx_n_s_int8); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_isfile); + Py_VISIT(traverse_module_state->__pyx_n_s_items); + Py_VISIT(traverse_module_state->__pyx_n_s_left); + Py_VISIT(traverse_module_state->__pyx_n_s_lo); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_metaclass); + Py_VISIT(traverse_module_state->__pyx_n_s_metadata_container); + Py_VISIT(traverse_module_state->__pyx_n_s_metadata_container___init); + Py_VISIT(traverse_module_state->__pyx_n_s_missing_ranges); + Py_VISIT(traverse_module_state->__pyx_n_s_missing_user_values); + Py_VISIT(traverse_module_state->__pyx_n_s_module); + Py_VISIT(traverse_module_state->__pyx_n_s_mro_entries); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_nan); + Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non); + Py_VISIT(traverse_module_state->__pyx_n_s_nominal); + Py_VISIT(traverse_module_state->__pyx_n_s_notes); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nt); + Py_VISIT(traverse_module_state->__pyx_n_s_number_columns); + Py_VISIT(traverse_module_state->__pyx_n_s_number_rows); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_n_s_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ordinal); + Py_VISIT(traverse_module_state->__pyx_n_s_original_variable_types); + Py_VISIT(traverse_module_state->__pyx_n_s_os); + Py_VISIT(traverse_module_state->__pyx_n_s_output_format); + Py_VISIT(traverse_module_state->__pyx_kp_s_output_format_must_be_one_of_all); + Py_VISIT(traverse_module_state->__pyx_n_s_pandas); + Py_VISIT(traverse_module_state->__pyx_n_s_path); + Py_VISIT(traverse_module_state->__pyx_kp_s_path_must_be_either_str_or_bytes); + Py_VISIT(traverse_module_state->__pyx_kp_s_path_must_be_str_bytes_or_unicod); + Py_VISIT(traverse_module_state->__pyx_n_s_pd); + Py_VISIT(traverse_module_state->__pyx_n_s_prepare); + Py_VISIT(traverse_module_state->__pyx_n_s_pyreadstat__readstat_parser); + Py_VISIT(traverse_module_state->__pyx_kp_s_pyreadstat__readstat_parser_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_capi); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_qualname); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_readstat_to_numpy_types); + Py_VISIT(traverse_module_state->__pyx_n_s_readstat_variable_types); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_right); + Py_VISIT(traverse_module_state->__pyx_n_s_sas_all_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_sas_date_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_sas_datetime_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_sas_origin); + Py_VISIT(traverse_module_state->__pyx_n_s_sas_time_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_scale); + Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_n_s_set_name); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_spss_all_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_spss_date_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_spss_datetime_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_spss_origin); + Py_VISIT(traverse_module_state->__pyx_n_s_spss_time_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_stata_all_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_stata_date_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_stata_datetime_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_stata_origin); + Py_VISIT(traverse_module_state->__pyx_n_s_stata_time_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_string); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_super); + Py_VISIT(traverse_module_state->__pyx_n_s_surrogateescape); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_kp_s_tC); + Py_VISIT(traverse_module_state->__pyx_n_s_table_name); + Py_VISIT(traverse_module_state->__pyx_kp_s_tc); + Py_VISIT(traverse_module_state->__pyx_kp_s_tcHH_MM); + Py_VISIT(traverse_module_state->__pyx_kp_s_tcHH_MM_SS); + Py_VISIT(traverse_module_state->__pyx_kp_s_td); + Py_VISIT(traverse_module_state->__pyx_kp_s_tdCCYY_NN_DD); + Py_VISIT(traverse_module_state->__pyx_kp_s_tdD_m_Y); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_time); + Py_VISIT(traverse_module_state->__pyx_n_s_to_datetime); + Py_VISIT(traverse_module_state->__pyx_n_s_tolist); + Py_VISIT(traverse_module_state->__pyx_n_s_undetermined); + Py_VISIT(traverse_module_state->__pyx_n_s_unknown); + Py_VISIT(traverse_module_state->__pyx_kp_s_utf_8); + Py_VISIT(traverse_module_state->__pyx_n_s_value_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_alignment); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_display_width); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_measure); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_storage_width); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_to_label); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_value_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_warn); + Py_VISIT(traverse_module_state->__pyx_n_s_warnings); + Py_VISIT(traverse_module_state->__pyx_n_s_zip); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_100000); + Py_VISIT(traverse_module_state->__pyx_tuple_); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__5); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__7); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_codeobj__11); + Py_VISIT(traverse_module_state->__pyx_codeobj__13); + Py_VISIT(traverse_module_state->__pyx_codeobj__14); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_8datetime_date __pyx_mstate_global->__pyx_ptype_7cpython_8datetime_date +#define __pyx_ptype_7cpython_8datetime_time __pyx_mstate_global->__pyx_ptype_7cpython_8datetime_time +#define __pyx_ptype_7cpython_8datetime_datetime __pyx_mstate_global->__pyx_ptype_7cpython_8datetime_datetime +#define __pyx_ptype_7cpython_8datetime_timedelta __pyx_mstate_global->__pyx_ptype_7cpython_8datetime_timedelta +#define __pyx_ptype_7cpython_8datetime_tzinfo __pyx_mstate_global->__pyx_ptype_7cpython_8datetime_tzinfo +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type_10pyreadstat_16_readstat_parser_data_container __pyx_mstate_global->__pyx_type_10pyreadstat_16_readstat_parser_data_container +#endif +#define __pyx_ptype_10pyreadstat_16_readstat_parser_data_container __pyx_mstate_global->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container +#define __pyx_n_s_ADATE __pyx_mstate_global->__pyx_n_s_ADATE +#define __pyx_n_s_ADATE10 __pyx_mstate_global->__pyx_n_s_ADATE10 +#define __pyx_n_s_ADATE8 __pyx_mstate_global->__pyx_n_s_ADATE8 +#define __pyx_n_s_B8601DA __pyx_mstate_global->__pyx_n_s_B8601DA +#define __pyx_n_s_B8601DN __pyx_mstate_global->__pyx_n_s_B8601DN +#define __pyx_n_s_B8601DT __pyx_mstate_global->__pyx_n_s_B8601DT +#define __pyx_n_s_B8601TM __pyx_mstate_global->__pyx_n_s_B8601TM +#define __pyx_n_s_DATE __pyx_mstate_global->__pyx_n_s_DATE +#define __pyx_n_s_DATE11 __pyx_mstate_global->__pyx_n_s_DATE11 +#define __pyx_n_s_DATE12 __pyx_mstate_global->__pyx_n_s_DATE12 +#define __pyx_n_s_DATE8 __pyx_mstate_global->__pyx_n_s_DATE8 +#define __pyx_n_s_DATE9 __pyx_mstate_global->__pyx_n_s_DATE9 +#define __pyx_n_s_DATEAMPM __pyx_mstate_global->__pyx_n_s_DATEAMPM +#define __pyx_n_s_DATETIME __pyx_mstate_global->__pyx_n_s_DATETIME +#define __pyx_n_s_DATETIME17 __pyx_mstate_global->__pyx_n_s_DATETIME17 +#define __pyx_n_s_DATETIME18 __pyx_mstate_global->__pyx_n_s_DATETIME18 +#define __pyx_n_s_DATETIME19 __pyx_mstate_global->__pyx_n_s_DATETIME19 +#define __pyx_n_s_DATETIME20 __pyx_mstate_global->__pyx_n_s_DATETIME20 +#define __pyx_n_s_DATETIME21 __pyx_mstate_global->__pyx_n_s_DATETIME21 +#define __pyx_n_s_DATETIME22 __pyx_mstate_global->__pyx_n_s_DATETIME22 +#define __pyx_kp_s_DATETIME23_2 __pyx_mstate_global->__pyx_kp_s_DATETIME23_2 +#define __pyx_n_s_DATETIME8 __pyx_mstate_global->__pyx_n_s_DATETIME8 +#define __pyx_n_s_DDMMYY __pyx_mstate_global->__pyx_n_s_DDMMYY +#define __pyx_n_s_DDMMYYB __pyx_mstate_global->__pyx_n_s_DDMMYYB +#define __pyx_n_s_DDMMYYB10 __pyx_mstate_global->__pyx_n_s_DDMMYYB10 +#define __pyx_n_s_DDMMYYC __pyx_mstate_global->__pyx_n_s_DDMMYYC +#define __pyx_n_s_DDMMYYC10 __pyx_mstate_global->__pyx_n_s_DDMMYYC10 +#define __pyx_n_s_DDMMYYD __pyx_mstate_global->__pyx_n_s_DDMMYYD +#define __pyx_n_s_DDMMYYD10 __pyx_mstate_global->__pyx_n_s_DDMMYYD10 +#define __pyx_n_s_DDMMYYN6 __pyx_mstate_global->__pyx_n_s_DDMMYYN6 +#define __pyx_n_s_DDMMYYN8 __pyx_mstate_global->__pyx_n_s_DDMMYYN8 +#define __pyx_n_s_DDMMYYP __pyx_mstate_global->__pyx_n_s_DDMMYYP +#define __pyx_n_s_DDMMYYP10 __pyx_mstate_global->__pyx_n_s_DDMMYYP10 +#define __pyx_n_s_DDMMYYS __pyx_mstate_global->__pyx_n_s_DDMMYYS +#define __pyx_n_s_DDMMYYS10 __pyx_mstate_global->__pyx_n_s_DDMMYYS10 +#define __pyx_n_s_DTDATE __pyx_mstate_global->__pyx_n_s_DTDATE +#define __pyx_n_s_DTIME __pyx_mstate_global->__pyx_n_s_DTIME +#define __pyx_n_s_DataFrame __pyx_mstate_global->__pyx_n_s_DataFrame +#define __pyx_n_s_E8601DA __pyx_mstate_global->__pyx_n_s_E8601DA +#define __pyx_n_s_E8601DT __pyx_mstate_global->__pyx_n_s_E8601DT +#define __pyx_n_s_E8601TM __pyx_mstate_global->__pyx_n_s_E8601TM +#define __pyx_n_s_EDATE __pyx_mstate_global->__pyx_n_s_EDATE +#define __pyx_n_s_EDATE10 __pyx_mstate_global->__pyx_n_s_EDATE10 +#define __pyx_n_s_EDATE8 __pyx_mstate_global->__pyx_n_s_EDATE8 +#define __pyx_kp_s_Failed_convert_C_to_python_value __pyx_mstate_global->__pyx_kp_s_Failed_convert_C_to_python_value +#define __pyx_kp_s_Failed_to_read_number_of_variabl __pyx_mstate_global->__pyx_kp_s_Failed_to_read_number_of_variabl +#define __pyx_kp_s_File_0_does_not_exist __pyx_mstate_global->__pyx_kp_s_File_0_does_not_exist +#define __pyx_n_s_HHMM __pyx_mstate_global->__pyx_n_s_HHMM +#define __pyx_n_s_IS8601DA __pyx_mstate_global->__pyx_n_s_IS8601DA +#define __pyx_n_s_IS8601DT __pyx_mstate_global->__pyx_n_s_IS8601DT +#define __pyx_n_s_IS8601TM __pyx_mstate_global->__pyx_n_s_IS8601TM +#define __pyx_n_s_JDATE __pyx_mstate_global->__pyx_n_s_JDATE +#define __pyx_n_s_JDATE5 __pyx_mstate_global->__pyx_n_s_JDATE5 +#define __pyx_n_s_JDATE7 __pyx_mstate_global->__pyx_n_s_JDATE7 +#define __pyx_kp_s_Just_defining_a_custom_exceptio __pyx_mstate_global->__pyx_kp_s_Just_defining_a_custom_exceptio +#define __pyx_kp_s_Just_defining_a_custom_exceptio_2 __pyx_mstate_global->__pyx_kp_s_Just_defining_a_custom_exceptio_2 +#define __pyx_kp_s_M8_ns __pyx_mstate_global->__pyx_kp_s_M8_ns +#define __pyx_n_s_MDYAMPM __pyx_mstate_global->__pyx_n_s_MDYAMPM +#define __pyx_n_s_MMDDYY __pyx_mstate_global->__pyx_n_s_MMDDYY +#define __pyx_n_s_MMDDYYB __pyx_mstate_global->__pyx_n_s_MMDDYYB +#define __pyx_n_s_MMDDYYB10 __pyx_mstate_global->__pyx_n_s_MMDDYYB10 +#define __pyx_n_s_MMDDYYC __pyx_mstate_global->__pyx_n_s_MMDDYYC +#define __pyx_n_s_MMDDYYC10 __pyx_mstate_global->__pyx_n_s_MMDDYYC10 +#define __pyx_n_s_MMDDYYD __pyx_mstate_global->__pyx_n_s_MMDDYYD +#define __pyx_n_s_MMDDYYD10 __pyx_mstate_global->__pyx_n_s_MMDDYYD10 +#define __pyx_n_s_MMDDYYN6 __pyx_mstate_global->__pyx_n_s_MMDDYYN6 +#define __pyx_n_s_MMDDYYN8 __pyx_mstate_global->__pyx_n_s_MMDDYYN8 +#define __pyx_n_s_MMDDYYP __pyx_mstate_global->__pyx_n_s_MMDDYYP +#define __pyx_n_s_MMDDYYP10 __pyx_mstate_global->__pyx_n_s_MMDDYYP10 +#define __pyx_n_s_MMDDYYS __pyx_mstate_global->__pyx_n_s_MMDDYYS +#define __pyx_n_s_MMDDYYS10 __pyx_mstate_global->__pyx_n_s_MMDDYYS10 +#define __pyx_n_s_NULL __pyx_mstate_global->__pyx_n_s_NULL +#define __pyx_n_s_OrderedDict __pyx_mstate_global->__pyx_n_s_OrderedDict +#define __pyx_n_s_PyreadstatError __pyx_mstate_global->__pyx_n_s_PyreadstatError +#define __pyx_n_s_ReadstatError __pyx_mstate_global->__pyx_n_s_ReadstatError +#define __pyx_n_s_RuntimeError __pyx_mstate_global->__pyx_n_s_RuntimeError +#define __pyx_n_s_SDATE __pyx_mstate_global->__pyx_n_s_SDATE +#define __pyx_n_s_SDATE10 __pyx_mstate_global->__pyx_n_s_SDATE10 +#define __pyx_n_s_SDATE8 __pyx_mstate_global->__pyx_n_s_SDATE8 +#define __pyx_kp_s_STRING_type_with_value_s_with_da __pyx_mstate_global->__pyx_kp_s_STRING_type_with_value_s_with_da +#define __pyx_n_s_TIME __pyx_mstate_global->__pyx_n_s_TIME +#define __pyx_kp_s_TIME11_2 __pyx_mstate_global->__pyx_kp_s_TIME11_2 +#define __pyx_n_s_TIME20 __pyx_mstate_global->__pyx_n_s_TIME20 +#define __pyx_kp_s_TIME20_3 __pyx_mstate_global->__pyx_kp_s_TIME20_3 +#define __pyx_n_s_TIME5 __pyx_mstate_global->__pyx_n_s_TIME5 +#define __pyx_n_s_TIME8 __pyx_mstate_global->__pyx_n_s_TIME8 +#define __pyx_n_s_TIMEAMPM __pyx_mstate_global->__pyx_n_s_TIMEAMPM +#define __pyx_n_s_TOD __pyx_mstate_global->__pyx_n_s_TOD +#define __pyx_kp_s_This_class_holds_metadata_we_wa __pyx_mstate_global->__pyx_kp_s_This_class_holds_metadata_we_wa +#define __pyx_kp_s_Time_zones_are_not_available_fro __pyx_mstate_global->__pyx_kp_s_Time_zones_are_not_available_fro +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_n_s_UnicodeError __pyx_mstate_global->__pyx_n_s_UnicodeError +#define __pyx_kp_s_Unknown_file_format __pyx_mstate_global->__pyx_kp_s_Unknown_file_format +#define __pyx_kp_s_Unkown_data_type __pyx_mstate_global->__pyx_kp_s_Unkown_data_type +#define __pyx_n_s_WEEKDATE __pyx_mstate_global->__pyx_n_s_WEEKDATE +#define __pyx_n_s_WEEKDATX __pyx_mstate_global->__pyx_n_s_WEEKDATX +#define __pyx_n_s_YMDHMS16 __pyx_mstate_global->__pyx_n_s_YMDHMS16 +#define __pyx_n_s_YMDHMS19 __pyx_mstate_global->__pyx_n_s_YMDHMS19 +#define __pyx_kp_s_YMDHMS19_2 __pyx_mstate_global->__pyx_kp_s_YMDHMS19_2 +#define __pyx_n_s_YMDHMS20 __pyx_mstate_global->__pyx_n_s_YMDHMS20 +#define __pyx_n_s_YYMMDD __pyx_mstate_global->__pyx_n_s_YYMMDD +#define __pyx_n_s_YYMMDD10 __pyx_mstate_global->__pyx_n_s_YYMMDD10 +#define __pyx_n_s_YYMMDDB __pyx_mstate_global->__pyx_n_s_YYMMDDB +#define __pyx_n_s_YYMMDDD __pyx_mstate_global->__pyx_n_s_YYMMDDD +#define __pyx_n_s_YYMMDDN __pyx_mstate_global->__pyx_n_s_YYMMDDN +#define __pyx_n_s_YYMMDDP __pyx_mstate_global->__pyx_n_s_YYMMDDP +#define __pyx_n_s_YYMMDDS __pyx_mstate_global->__pyx_n_s_YYMMDDS +#define __pyx_n_s__15 __pyx_mstate_global->__pyx_n_s__15 +#define __pyx_kp_s__2 __pyx_mstate_global->__pyx_kp_s__2 +#define __pyx_kp_u__8 __pyx_mstate_global->__pyx_kp_u__8 +#define __pyx_n_s__9 __pyx_mstate_global->__pyx_n_s__9 +#define __pyx_n_s_allowed_formats __pyx_mstate_global->__pyx_n_s_allowed_formats +#define __pyx_n_s_append __pyx_mstate_global->__pyx_n_s_append +#define __pyx_n_s_astype __pyx_mstate_global->__pyx_n_s_astype +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_center __pyx_mstate_global->__pyx_n_s_center +#define __pyx_n_s_chr __pyx_mstate_global->__pyx_n_s_chr +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections +#define __pyx_kp_s_column_0_is_duplicated_renamed_t __pyx_mstate_global->__pyx_kp_s_column_0_is_duplicated_renamed_t +#define __pyx_n_s_column_labels __pyx_mstate_global->__pyx_n_s_column_labels +#define __pyx_n_s_column_names __pyx_mstate_global->__pyx_n_s_column_names +#define __pyx_n_s_column_names_to_labels __pyx_mstate_global->__pyx_n_s_column_names_to_labels +#define __pyx_n_s_columns __pyx_mstate_global->__pyx_n_s_columns +#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy +#define __pyx_kp_s_d __pyx_mstate_global->__pyx_kp_s_d +#define __pyx_n_s_data_container __pyx_mstate_global->__pyx_n_s_data_container +#define __pyx_n_s_data_container___reduce_cython __pyx_mstate_global->__pyx_n_s_data_container___reduce_cython +#define __pyx_n_s_data_container___setstate_cython __pyx_mstate_global->__pyx_n_s_data_container___setstate_cython +#define __pyx_n_s_date __pyx_mstate_global->__pyx_n_s_date +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_n_s_dict_2 __pyx_mstate_global->__pyx_n_s_dict_2 +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_doc __pyx_mstate_global->__pyx_n_s_doc +#define __pyx_n_s_double __pyx_mstate_global->__pyx_n_s_double +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtypes __pyx_mstate_global->__pyx_n_s_dtypes +#define __pyx_n_s_duplicated __pyx_mstate_global->__pyx_n_s_duplicated +#define __pyx_n_s_empty __pyx_mstate_global->__pyx_n_s_empty +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_expanduser __pyx_mstate_global->__pyx_n_s_expanduser +#define __pyx_n_s_file_encoding __pyx_mstate_global->__pyx_n_s_file_encoding +#define __pyx_n_s_file_label __pyx_mstate_global->__pyx_n_s_file_label +#define __pyx_kp_s_file_path_could_not_be_encoded_w __pyx_mstate_global->__pyx_kp_s_file_path_could_not_be_encoded_w +#define __pyx_n_s_fill __pyx_mstate_global->__pyx_n_s_fill +#define __pyx_n_s_float __pyx_mstate_global->__pyx_n_s_float +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_from_dict __pyx_mstate_global->__pyx_n_s_from_dict +#define __pyx_n_s_fsdecode __pyx_mstate_global->__pyx_n_s_fsdecode +#define __pyx_n_s_fsencode __pyx_mstate_global->__pyx_n_s_fsencode +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get +#define __pyx_n_s_getfilesystemencoding __pyx_mstate_global->__pyx_n_s_getfilesystemencoding +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_n_s_hi __pyx_mstate_global->__pyx_n_s_hi +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init +#define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int16 __pyx_mstate_global->__pyx_n_s_int16 +#define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32 +#define __pyx_n_s_int64 __pyx_mstate_global->__pyx_n_s_int64 +#define __pyx_n_s_int8 __pyx_mstate_global->__pyx_n_s_int8 +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_isfile __pyx_mstate_global->__pyx_n_s_isfile +#define __pyx_n_s_items __pyx_mstate_global->__pyx_n_s_items +#define __pyx_n_s_left __pyx_mstate_global->__pyx_n_s_left +#define __pyx_n_s_lo __pyx_mstate_global->__pyx_n_s_lo +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_metaclass __pyx_mstate_global->__pyx_n_s_metaclass +#define __pyx_n_s_metadata_container __pyx_mstate_global->__pyx_n_s_metadata_container +#define __pyx_n_s_metadata_container___init __pyx_mstate_global->__pyx_n_s_metadata_container___init +#define __pyx_n_s_missing_ranges __pyx_mstate_global->__pyx_n_s_missing_ranges +#define __pyx_n_s_missing_user_values __pyx_mstate_global->__pyx_n_s_missing_user_values +#define __pyx_n_s_module __pyx_mstate_global->__pyx_n_s_module +#define __pyx_n_s_mro_entries __pyx_mstate_global->__pyx_n_s_mro_entries +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_nan __pyx_mstate_global->__pyx_n_s_nan +#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non +#define __pyx_n_s_nominal __pyx_mstate_global->__pyx_n_s_nominal +#define __pyx_n_s_notes __pyx_mstate_global->__pyx_n_s_notes +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nt __pyx_mstate_global->__pyx_n_s_nt +#define __pyx_n_s_number_columns __pyx_mstate_global->__pyx_n_s_number_columns +#define __pyx_n_s_number_rows __pyx_mstate_global->__pyx_n_s_number_rows +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object +#define __pyx_n_s_ordinal __pyx_mstate_global->__pyx_n_s_ordinal +#define __pyx_n_s_original_variable_types __pyx_mstate_global->__pyx_n_s_original_variable_types +#define __pyx_n_s_os __pyx_mstate_global->__pyx_n_s_os +#define __pyx_n_s_output_format __pyx_mstate_global->__pyx_n_s_output_format +#define __pyx_kp_s_output_format_must_be_one_of_all __pyx_mstate_global->__pyx_kp_s_output_format_must_be_one_of_all +#define __pyx_n_s_pandas __pyx_mstate_global->__pyx_n_s_pandas +#define __pyx_n_s_path __pyx_mstate_global->__pyx_n_s_path +#define __pyx_kp_s_path_must_be_either_str_or_bytes __pyx_mstate_global->__pyx_kp_s_path_must_be_either_str_or_bytes +#define __pyx_kp_s_path_must_be_str_bytes_or_unicod __pyx_mstate_global->__pyx_kp_s_path_must_be_str_bytes_or_unicod +#define __pyx_n_s_pd __pyx_mstate_global->__pyx_n_s_pd +#define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare +#define __pyx_n_s_pyreadstat__readstat_parser __pyx_mstate_global->__pyx_n_s_pyreadstat__readstat_parser +#define __pyx_kp_s_pyreadstat__readstat_parser_pyx __pyx_mstate_global->__pyx_kp_s_pyreadstat__readstat_parser_pyx +#define __pyx_n_s_pyx_capi __pyx_mstate_global->__pyx_n_s_pyx_capi +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_qualname __pyx_mstate_global->__pyx_n_s_qualname +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_readstat_to_numpy_types __pyx_mstate_global->__pyx_n_s_readstat_to_numpy_types +#define __pyx_n_s_readstat_variable_types __pyx_mstate_global->__pyx_n_s_readstat_variable_types +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_right __pyx_mstate_global->__pyx_n_s_right +#define __pyx_n_s_sas_all_formats __pyx_mstate_global->__pyx_n_s_sas_all_formats +#define __pyx_n_s_sas_date_formats __pyx_mstate_global->__pyx_n_s_sas_date_formats +#define __pyx_n_s_sas_datetime_formats __pyx_mstate_global->__pyx_n_s_sas_datetime_formats +#define __pyx_n_s_sas_origin __pyx_mstate_global->__pyx_n_s_sas_origin +#define __pyx_n_s_sas_time_formats __pyx_mstate_global->__pyx_n_s_sas_time_formats +#define __pyx_n_s_scale __pyx_mstate_global->__pyx_n_s_scale +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_n_s_set_name __pyx_mstate_global->__pyx_n_s_set_name +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_spss_all_formats __pyx_mstate_global->__pyx_n_s_spss_all_formats +#define __pyx_n_s_spss_date_formats __pyx_mstate_global->__pyx_n_s_spss_date_formats +#define __pyx_n_s_spss_datetime_formats __pyx_mstate_global->__pyx_n_s_spss_datetime_formats +#define __pyx_n_s_spss_origin __pyx_mstate_global->__pyx_n_s_spss_origin +#define __pyx_n_s_spss_time_formats __pyx_mstate_global->__pyx_n_s_spss_time_formats +#define __pyx_n_s_stata_all_formats __pyx_mstate_global->__pyx_n_s_stata_all_formats +#define __pyx_n_s_stata_date_formats __pyx_mstate_global->__pyx_n_s_stata_date_formats +#define __pyx_n_s_stata_datetime_formats __pyx_mstate_global->__pyx_n_s_stata_datetime_formats +#define __pyx_n_s_stata_origin __pyx_mstate_global->__pyx_n_s_stata_origin +#define __pyx_n_s_stata_time_formats __pyx_mstate_global->__pyx_n_s_stata_time_formats +#define __pyx_n_s_string __pyx_mstate_global->__pyx_n_s_string +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super +#define __pyx_n_s_surrogateescape __pyx_mstate_global->__pyx_n_s_surrogateescape +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_kp_s_tC __pyx_mstate_global->__pyx_kp_s_tC +#define __pyx_n_s_table_name __pyx_mstate_global->__pyx_n_s_table_name +#define __pyx_kp_s_tc __pyx_mstate_global->__pyx_kp_s_tc +#define __pyx_kp_s_tcHH_MM __pyx_mstate_global->__pyx_kp_s_tcHH_MM +#define __pyx_kp_s_tcHH_MM_SS __pyx_mstate_global->__pyx_kp_s_tcHH_MM_SS +#define __pyx_kp_s_td __pyx_mstate_global->__pyx_kp_s_td +#define __pyx_kp_s_tdCCYY_NN_DD __pyx_mstate_global->__pyx_kp_s_tdCCYY_NN_DD +#define __pyx_kp_s_tdD_m_Y __pyx_mstate_global->__pyx_kp_s_tdD_m_Y +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_time __pyx_mstate_global->__pyx_n_s_time +#define __pyx_n_s_to_datetime __pyx_mstate_global->__pyx_n_s_to_datetime +#define __pyx_n_s_tolist __pyx_mstate_global->__pyx_n_s_tolist +#define __pyx_n_s_undetermined __pyx_mstate_global->__pyx_n_s_undetermined +#define __pyx_n_s_unknown __pyx_mstate_global->__pyx_n_s_unknown +#define __pyx_kp_s_utf_8 __pyx_mstate_global->__pyx_kp_s_utf_8 +#define __pyx_n_s_value_labels __pyx_mstate_global->__pyx_n_s_value_labels +#define __pyx_n_s_variable_alignment __pyx_mstate_global->__pyx_n_s_variable_alignment +#define __pyx_n_s_variable_display_width __pyx_mstate_global->__pyx_n_s_variable_display_width +#define __pyx_n_s_variable_measure __pyx_mstate_global->__pyx_n_s_variable_measure +#define __pyx_n_s_variable_storage_width __pyx_mstate_global->__pyx_n_s_variable_storage_width +#define __pyx_n_s_variable_to_label __pyx_mstate_global->__pyx_n_s_variable_to_label +#define __pyx_n_s_variable_value_labels __pyx_mstate_global->__pyx_n_s_variable_value_labels +#define __pyx_n_s_warn __pyx_mstate_global->__pyx_n_s_warn +#define __pyx_n_s_warnings __pyx_mstate_global->__pyx_n_s_warnings +#define __pyx_n_s_zip __pyx_mstate_global->__pyx_n_s_zip +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_100000 __pyx_mstate_global->__pyx_int_100000 +#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_ +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 +#define __pyx_codeobj__13 __pyx_mstate_global->__pyx_codeobj__13 +#define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14 +/* #### Code section: module_code ### */ + +/* "cpython/datetime.pxd":72 + * ctypedef extern class datetime.date[object PyDateTime_Date]: + * @property + * cdef inline int year(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(self) + * + */ + +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4date_4year_year(PyDateTime_Date *__pyx_v_self) { 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 (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_14data_container___cinit__(((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_v_self)); + __Pyx_RefNannySetupContext("year", 0); + + /* "cpython/datetime.pxd":73 + * @property + * cdef inline int year(self): + * return PyDateTime_GET_YEAR(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyDateTime_GET_YEAR(((PyObject *)__pyx_v_self)); + goto __pyx_L0; + + /* "cpython/datetime.pxd":72 + * ctypedef extern class datetime.date[object PyDateTime_Date]: + * @property + * cdef inline int year(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(self) + * + */ /* function exit code */ + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static int __pyx_pf_10pyreadstat_16_readstat_parser_14data_container___cinit__(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self) { +/* "cpython/datetime.pxd":76 + * + * @property + * cdef inline int month(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(self) + * + */ + +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4date_5month_month(PyDateTime_Date *__pyx_v_self) { 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("__cinit__", 0); + __Pyx_RefNannySetupContext("month", 0); - /* "pyreadstat/_readstat_parser.pyx":81 + /* "cpython/datetime.pxd":77 + * @property + * cdef inline int month(self): + * return PyDateTime_GET_MONTH(self) # <<<<<<<<<<<<<< * - * def __cinit__(self): - * self.n_obs = 0 # <<<<<<<<<<<<<< - * self.n_vars = 0 - * self.max_n_obs = 0 + * @property */ - __pyx_v_self->n_obs = 0; + __pyx_r = PyDateTime_GET_MONTH(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":82 - * def __cinit__(self): - * self.n_obs = 0 - * self.n_vars = 0 # <<<<<<<<<<<<<< - * self.max_n_obs = 0 - * self.col_data = list() + /* "cpython/datetime.pxd":76 + * + * @property + * cdef inline int month(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(self) + * */ - __pyx_v_self->n_vars = 0; - /* "pyreadstat/_readstat_parser.pyx":83 - * self.n_obs = 0 - * self.n_vars = 0 - * self.max_n_obs = 0 # <<<<<<<<<<<<<< - * self.col_data = list() - * self.col_data_len = list() - */ - __pyx_v_self->max_n_obs = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":84 - * self.n_vars = 0 - * self.max_n_obs = 0 - * self.col_data = list() # <<<<<<<<<<<<<< - * self.col_data_len = list() - * self.col_names = list() +/* "cpython/datetime.pxd":80 + * + * @property + * cdef inline int day(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_data); - __Pyx_DECREF(__pyx_v_self->col_data); - __pyx_v_self->col_data = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":85 - * self.max_n_obs = 0 - * self.col_data = list() - * self.col_data_len = list() # <<<<<<<<<<<<<< - * self.col_names = list() - * self.col_labels = list() - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_data_len); - __Pyx_DECREF(__pyx_v_self->col_data_len); - __pyx_v_self->col_data_len = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4date_3day_day(PyDateTime_Date *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("day", 0); - /* "pyreadstat/_readstat_parser.pyx":86 - * self.col_data = list() - * self.col_data_len = list() - * self.col_names = list() # <<<<<<<<<<<<<< - * self.col_labels = list() - * self.col_dtypes = list() + /* "cpython/datetime.pxd":81 + * @property + * cdef inline int day(self): + * return PyDateTime_GET_DAY(self) # <<<<<<<<<<<<<< + * + * ctypedef extern class datetime.time[object PyDateTime_Time]: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_names); - __Pyx_DECREF(__pyx_v_self->col_names); - __pyx_v_self->col_names = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_r = PyDateTime_GET_DAY(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":87 - * self.col_data_len = list() - * self.col_names = list() - * self.col_labels = list() # <<<<<<<<<<<<<< - * self.col_dtypes = list() - * self.col_numpy_dtypes = list() + /* "cpython/datetime.pxd":80 + * + * @property + * cdef inline int day(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_labels); - __Pyx_DECREF(__pyx_v_self->col_labels); - __pyx_v_self->col_labels = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":88 - * self.col_names = list() - * self.col_labels = list() - * self.col_dtypes = list() # <<<<<<<<<<<<<< - * self.col_numpy_dtypes = list() - * self.col_dtypes_isobject = list() - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_dtypes); - __Pyx_DECREF(__pyx_v_self->col_dtypes); - __pyx_v_self->col_dtypes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":89 - * self.col_labels = list() - * self.col_dtypes = list() - * self.col_numpy_dtypes = list() # <<<<<<<<<<<<<< - * self.col_dtypes_isobject = list() - * self.col_dytpes_isfloat = list() +/* "cpython/datetime.pxd":85 + * ctypedef extern class datetime.time[object PyDateTime_Time]: + * @property + * cdef inline int hour(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_HOUR(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_numpy_dtypes); - __Pyx_DECREF(__pyx_v_self->col_numpy_dtypes); - __pyx_v_self->col_numpy_dtypes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":90 - * self.col_dtypes = list() - * self.col_numpy_dtypes = list() - * self.col_dtypes_isobject = list() # <<<<<<<<<<<<<< - * self.col_dytpes_isfloat = list() - * self.col_formats = list() - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_dtypes_isobject); - __Pyx_DECREF(__pyx_v_self->col_dtypes_isobject); - __pyx_v_self->col_dtypes_isobject = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_4hour_hour(PyDateTime_Time *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("hour", 0); - /* "pyreadstat/_readstat_parser.pyx":91 - * self.col_numpy_dtypes = list() - * self.col_dtypes_isobject = list() - * self.col_dytpes_isfloat = list() # <<<<<<<<<<<<<< - * self.col_formats = list() - * self.col_formats_original = list() + /* "cpython/datetime.pxd":86 + * @property + * cdef inline int hour(self): + * return PyDateTime_TIME_GET_HOUR(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_dytpes_isfloat); - __Pyx_DECREF(__pyx_v_self->col_dytpes_isfloat); - __pyx_v_self->col_dytpes_isfloat = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_r = PyDateTime_TIME_GET_HOUR(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":92 - * self.col_dtypes_isobject = list() - * self.col_dytpes_isfloat = list() - * self.col_formats = list() # <<<<<<<<<<<<<< - * self.col_formats_original = list() - * self.origin = None + /* "cpython/datetime.pxd":85 + * ctypedef extern class datetime.time[object PyDateTime_Time]: + * @property + * cdef inline int hour(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_HOUR(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_formats); - __Pyx_DECREF(__pyx_v_self->col_formats); - __pyx_v_self->col_formats = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":93 - * self.col_dytpes_isfloat = list() - * self.col_formats = list() - * self.col_formats_original = list() # <<<<<<<<<<<<<< - * self.origin = None - * self.is_unkown_number_rows = 0 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":89 + * + * @property + * cdef inline int minute(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MINUTE(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->col_formats_original); - __Pyx_DECREF(__pyx_v_self->col_formats_original); - __pyx_v_self->col_formats_original = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":94 - * self.col_formats = list() - * self.col_formats_original = list() - * self.origin = None # <<<<<<<<<<<<<< - * self.is_unkown_number_rows = 0 - * self.file_encoding = None +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_6minute_minute(PyDateTime_Time *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("minute", 0); + + /* "cpython/datetime.pxd":90 + * @property + * cdef inline int minute(self): + * return PyDateTime_TIME_GET_MINUTE(self) # <<<<<<<<<<<<<< + * + * @property */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->origin); - __Pyx_DECREF(__pyx_v_self->origin); - __pyx_v_self->origin = Py_None; + __pyx_r = PyDateTime_TIME_GET_MINUTE(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":95 - * self.col_formats_original = list() - * self.origin = None - * self.is_unkown_number_rows = 0 # <<<<<<<<<<<<<< - * self.file_encoding = None - * self.file_label = None + /* "cpython/datetime.pxd":89 + * + * @property + * cdef inline int minute(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MINUTE(self) + * */ - __pyx_v_self->is_unkown_number_rows = 0; - /* "pyreadstat/_readstat_parser.pyx":96 - * self.origin = None - * self.is_unkown_number_rows = 0 - * self.file_encoding = None # <<<<<<<<<<<<<< - * self.file_label = None - * self.metaonly = 0 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":93 + * + * @property + * cdef inline int second(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_SECOND(self) + * */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->file_encoding); - __Pyx_DECREF(__pyx_v_self->file_encoding); - __pyx_v_self->file_encoding = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":97 - * self.is_unkown_number_rows = 0 - * self.file_encoding = None - * self.file_label = None # <<<<<<<<<<<<<< - * self.metaonly = 0 - * self.dates_as_pandas = 0 +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_6second_second(PyDateTime_Time *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("second", 0); + + /* "cpython/datetime.pxd":94 + * @property + * cdef inline int second(self): + * return PyDateTime_TIME_GET_SECOND(self) # <<<<<<<<<<<<<< + * + * @property */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->file_label); - __Pyx_DECREF(__pyx_v_self->file_label); - __pyx_v_self->file_label = ((PyObject*)Py_None); + __pyx_r = PyDateTime_TIME_GET_SECOND(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":98 - * self.file_encoding = None - * self.file_label = None - * self.metaonly = 0 # <<<<<<<<<<<<<< - * self.dates_as_pandas = 0 - * self.label_to_var_name = dict() + /* "cpython/datetime.pxd":93 + * + * @property + * cdef inline int second(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_SECOND(self) + * */ - __pyx_v_self->metaonly = 0; - /* "pyreadstat/_readstat_parser.pyx":99 - * self.file_label = None - * self.metaonly = 0 - * self.dates_as_pandas = 0 # <<<<<<<<<<<<<< - * self.label_to_var_name = dict() - * self.labels_raw = dict() + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":97 + * + * @property + * cdef inline int microsecond(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MICROSECOND(self) + * */ - __pyx_v_self->dates_as_pandas = 0; - /* "pyreadstat/_readstat_parser.pyx":100 - * self.metaonly = 0 - * self.dates_as_pandas = 0 - * self.label_to_var_name = dict() # <<<<<<<<<<<<<< - * self.labels_raw = dict() - * self.notes = list() +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_11microsecond_microsecond(PyDateTime_Time *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("microsecond", 0); + + /* "cpython/datetime.pxd":98 + * @property + * cdef inline int microsecond(self): + * return PyDateTime_TIME_GET_MICROSECOND(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->label_to_var_name); - __Pyx_DECREF(__pyx_v_self->label_to_var_name); - __pyx_v_self->label_to_var_name = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = PyDateTime_TIME_GET_MICROSECOND(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":101 - * self.dates_as_pandas = 0 - * self.label_to_var_name = dict() - * self.labels_raw = dict() # <<<<<<<<<<<<<< - * self.notes = list() - * self.user_encoding = None + /* "cpython/datetime.pxd":97 + * + * @property + * cdef inline int microsecond(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MICROSECOND(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->labels_raw); - __Pyx_DECREF(__pyx_v_self->labels_raw); - __pyx_v_self->labels_raw = __pyx_t_1; - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":102 - * self.label_to_var_name = dict() - * self.labels_raw = dict() - * self.notes = list() # <<<<<<<<<<<<<< - * self.user_encoding = None - * self.table_name = None + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":101 + * + * @property + * cdef inline object tzinfo(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_TZINFO(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->notes); - __Pyx_DECREF(__pyx_v_self->notes); - __pyx_v_self->notes = __pyx_t_1; - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":103 - * self.labels_raw = dict() - * self.notes = list() - * self.user_encoding = None # <<<<<<<<<<<<<< - * self.table_name = None - * self.filter_cols = 0 +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_4time_6tzinfo_tzinfo(PyDateTime_Time *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("tzinfo", 0); + + /* "cpython/datetime.pxd":102 + * @property + * cdef inline object tzinfo(self): + * return PyDateTime_TIME_GET_TZINFO(self) # <<<<<<<<<<<<<< + * + * @property */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->user_encoding); - __Pyx_DECREF(__pyx_v_self->user_encoding); - __pyx_v_self->user_encoding = ((PyObject*)Py_None); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDateTime_TIME_GET_TZINFO(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":104 - * self.notes = list() - * self.user_encoding = None - * self.table_name = None # <<<<<<<<<<<<<< - * self.filter_cols = 0 - * self.use_cols = list() + /* "cpython/datetime.pxd":101 + * + * @property + * cdef inline object tzinfo(self): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_TZINFO(self) + * */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->table_name); - __Pyx_DECREF(__pyx_v_self->table_name); - __pyx_v_self->table_name = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":105 - * self.user_encoding = None - * self.table_name = None - * self.filter_cols = 0 # <<<<<<<<<<<<<< - * self.use_cols = list() - * self.usernan = 0 + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":105 + * + * @property + * cdef inline int fold(self): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_TIME_GET_FOLD(self) */ - __pyx_v_self->filter_cols = 0; - /* "pyreadstat/_readstat_parser.pyx":106 - * self.table_name = None - * self.filter_cols = 0 - * self.use_cols = list() # <<<<<<<<<<<<<< - * self.usernan = 0 - * self.missing_ranges = dict() +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_4time_4fold_fold(PyDateTime_Time *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fold", 0); + + /* "cpython/datetime.pxd":107 + * cdef inline int fold(self): + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_TIME_GET_FOLD(self) # <<<<<<<<<<<<<< + * + * ctypedef extern class datetime.datetime[object PyDateTime_DateTime]: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->use_cols); - __Pyx_DECREF(__pyx_v_self->use_cols); - __pyx_v_self->use_cols = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_r = PyDateTime_TIME_GET_FOLD(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":107 - * self.filter_cols = 0 - * self.use_cols = list() - * self.usernan = 0 # <<<<<<<<<<<<<< - * self.missing_ranges = dict() - * self.missing_user_values = dict() + /* "cpython/datetime.pxd":105 + * + * @property + * cdef inline int fold(self): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_TIME_GET_FOLD(self) */ - __pyx_v_self->usernan = 0; - /* "pyreadstat/_readstat_parser.pyx":108 - * self.use_cols = list() - * self.usernan = 0 - * self.missing_ranges = dict() # <<<<<<<<<<<<<< - * self.missing_user_values = dict() - * self.variable_storage_width = dict() + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":111 + * ctypedef extern class datetime.datetime[object PyDateTime_DateTime]: + * @property + * cdef inline int year(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->missing_ranges); - __Pyx_DECREF(__pyx_v_self->missing_ranges); - __pyx_v_self->missing_ranges = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":109 - * self.usernan = 0 - * self.missing_ranges = dict() - * self.missing_user_values = dict() # <<<<<<<<<<<<<< - * self.variable_storage_width = dict() - * self.variable_display_width = dict() +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_4year_year(PyDateTime_DateTime *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("year", 0); + + /* "cpython/datetime.pxd":112 + * @property + * cdef inline int year(self): + * return PyDateTime_GET_YEAR(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->missing_user_values); - __Pyx_DECREF(__pyx_v_self->missing_user_values); - __pyx_v_self->missing_user_values = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_r = PyDateTime_GET_YEAR(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":110 - * self.missing_ranges = dict() - * self.missing_user_values = dict() - * self.variable_storage_width = dict() # <<<<<<<<<<<<<< - * self.variable_display_width = dict() - * self.variable_alignment = dict() + /* "cpython/datetime.pxd":111 + * ctypedef extern class datetime.datetime[object PyDateTime_DateTime]: + * @property + * cdef inline int year(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->variable_storage_width); - __Pyx_DECREF(__pyx_v_self->variable_storage_width); - __pyx_v_self->variable_storage_width = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":111 - * self.missing_user_values = dict() - * self.variable_storage_width = dict() - * self.variable_display_width = dict() # <<<<<<<<<<<<<< - * self.variable_alignment = dict() - * self.variable_measure = dict() + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":115 + * + * @property + * cdef inline int month(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->variable_display_width); - __Pyx_DECREF(__pyx_v_self->variable_display_width); - __pyx_v_self->variable_display_width = __pyx_t_1; - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":112 - * self.variable_storage_width = dict() - * self.variable_display_width = dict() - * self.variable_alignment = dict() # <<<<<<<<<<<<<< - * self.variable_measure = dict() - * self.no_datetime_conversion = 0 - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->variable_alignment); - __Pyx_DECREF(__pyx_v_self->variable_alignment); - __pyx_v_self->variable_alignment = __pyx_t_1; - __pyx_t_1 = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_5month_month(PyDateTime_DateTime *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("month", 0); - /* "pyreadstat/_readstat_parser.pyx":113 - * self.variable_display_width = dict() - * self.variable_alignment = dict() - * self.variable_measure = dict() # <<<<<<<<<<<<<< - * self.no_datetime_conversion = 0 + /* "cpython/datetime.pxd":116 + * @property + * cdef inline int month(self): + * return PyDateTime_GET_MONTH(self) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->variable_measure); - __Pyx_DECREF(__pyx_v_self->variable_measure); - __pyx_v_self->variable_measure = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = PyDateTime_GET_MONTH(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":114 - * self.variable_alignment = dict() - * self.variable_measure = dict() - * self.no_datetime_conversion = 0 # <<<<<<<<<<<<<< + /* "cpython/datetime.pxd":115 * - * class metadata_container: - */ - __pyx_v_self->no_datetime_conversion = 0; - - /* "pyreadstat/_readstat_parser.pyx":80 - * """ + * @property + * cdef inline int month(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(self) * - * def __cinit__(self): # <<<<<<<<<<<<<< - * self.n_obs = 0 - * self.n_vars = 0 */ /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container.__cinit__", __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): +/* "cpython/datetime.pxd":119 + * + * @property + * cdef inline int day(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(self) + * */ -/* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_3day_day(PyDateTime_DateTime *__pyx_v_self) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_14data_container_2__reduce_cython__(((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_v_self)); + __Pyx_RefNannySetupContext("day", 0); + + /* "cpython/datetime.pxd":120 + * @property + * cdef inline int day(self): + * return PyDateTime_GET_DAY(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyDateTime_GET_DAY(((PyObject *)__pyx_v_self)); + goto __pyx_L0; + + /* "cpython/datetime.pxd":119 + * + * @property + * cdef inline int day(self): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(self) + * + */ /* function exit code */ + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_14data_container_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self) { - PyObject *__pyx_r = NULL; +/* "cpython/datetime.pxd":123 + * + * @property + * cdef inline int hour(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_HOUR(self) + * + */ + +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_4hour_hour(PyDateTime_DateTime *__pyx_v_self) { + 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("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("hour", 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__") + /* "cpython/datetime.pxd":124 + * @property + * cdef inline int hour(self): + * return PyDateTime_DATE_GET_HOUR(self) # <<<<<<<<<<<<<< + * + * @property */ - __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(1, 2, __pyx_L1_error) + __pyx_r = PyDateTime_DATE_GET_HOUR(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): + /* "cpython/datetime.pxd":123 + * + * @property + * cdef inline int hour(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_HOUR(self) + * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); + __pyx_L0:; __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__") +/* "cpython/datetime.pxd":127 + * + * @property + * cdef inline int minute(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MINUTE(self) + * */ -/* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_6minute_minute(PyDateTime_DateTime *__pyx_v_self) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_14data_container_4__setstate_cython__(((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + __Pyx_RefNannySetupContext("minute", 0); + + /* "cpython/datetime.pxd":128 + * @property + * cdef inline int minute(self): + * return PyDateTime_DATE_GET_MINUTE(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyDateTime_DATE_GET_MINUTE(((PyObject *)__pyx_v_self)); + goto __pyx_L0; + + /* "cpython/datetime.pxd":127 + * + * @property + * cdef inline int minute(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MINUTE(self) + * + */ /* function exit code */ + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_14data_container_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; +/* "cpython/datetime.pxd":131 + * + * @property + * cdef inline int second(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_SECOND(self) + * + */ + +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_6second_second(PyDateTime_DateTime *__pyx_v_self) { + 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("__setstate_cython__", 0); + __Pyx_RefNannySetupContext("second", 0); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "cpython/datetime.pxd":132 + * @property + * cdef inline int second(self): + * return PyDateTime_DATE_GET_SECOND(self) # <<<<<<<<<<<<<< + * + * @property */ - __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(1, 4, __pyx_L1_error) + __pyx_r = PyDateTime_DATE_GET_SECOND(((PyObject *)__pyx_v_self)); + 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__") + /* "cpython/datetime.pxd":131 + * + * @property + * cdef inline int second(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_SECOND(self) + * */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":120 - * This class holds metadata we want to give back to python - * """ - * def __init__(self): # <<<<<<<<<<<<<< - * self.column_names = list() - * self.column_labels = list() +/* "cpython/datetime.pxd":135 + * + * @property + * cdef inline int microsecond(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MICROSECOND(self) + * */ -/* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_18metadata_container_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10pyreadstat_16_readstat_parser_18metadata_container_1__init__ = {"__init__", (PyCFunction)__pyx_pw_10pyreadstat_16_readstat_parser_18metadata_container_1__init__, METH_O, 0}; -static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_18metadata_container_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_11microsecond_microsecond(PyDateTime_DateTime *__pyx_v_self) { + int __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_18metadata_container___init__(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("microsecond", 0); + + /* "cpython/datetime.pxd":136 + * @property + * cdef inline int microsecond(self): + * return PyDateTime_DATE_GET_MICROSECOND(self) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = PyDateTime_DATE_GET_MICROSECOND(((PyObject *)__pyx_v_self)); + goto __pyx_L0; + + /* "cpython/datetime.pxd":135 + * + * @property + * cdef inline int microsecond(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MICROSECOND(self) + * + */ /* function exit code */ + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_18metadata_container___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +/* "cpython/datetime.pxd":139 + * + * @property + * cdef inline object tzinfo(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_TZINFO(self) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_8datetime_6tzinfo_tzinfo(PyDateTime_DateTime *__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("__init__", 0); + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("tzinfo", 0); - /* "pyreadstat/_readstat_parser.pyx":121 - * """ - * def __init__(self): - * self.column_names = list() # <<<<<<<<<<<<<< - * self.column_labels = list() - * self.column_names_to_labels = dict() + /* "cpython/datetime.pxd":140 + * @property + * cdef inline object tzinfo(self): + * return PyDateTime_DATE_GET_TZINFO(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_column_names, __pyx_t_1) < 0) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDateTime_DATE_GET_TZINFO(((PyObject *)__pyx_v_self)); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":122 - * def __init__(self): - * self.column_names = list() - * self.column_labels = list() # <<<<<<<<<<<<<< - * self.column_names_to_labels = dict() - * self.file_encoding = None + /* "cpython/datetime.pxd":139 + * + * @property + * cdef inline object tzinfo(self): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_TZINFO(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_column_labels, __pyx_t_1) < 0) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":123 - * self.column_names = list() - * self.column_labels = list() - * self.column_names_to_labels = dict() # <<<<<<<<<<<<<< - * self.file_encoding = None - * self.number_columns = None - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_column_names_to_labels, __pyx_t_1) < 0) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":124 - * self.column_labels = list() - * self.column_names_to_labels = dict() - * self.file_encoding = None # <<<<<<<<<<<<<< - * self.number_columns = None - * self.number_rows = None +/* "cpython/datetime.pxd":143 + * + * @property + * cdef inline int fold(self): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_DATE_GET_FOLD(self) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_file_encoding, Py_None) < 0) __PYX_ERR(0, 124, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":125 - * self.column_names_to_labels = dict() - * self.file_encoding = None - * self.number_columns = None # <<<<<<<<<<<<<< - * self.number_rows = None - * self.variable_value_labels = dict() +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_8datetime_4fold_fold(PyDateTime_DateTime *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fold", 0); + + /* "cpython/datetime.pxd":145 + * cdef inline int fold(self): + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_DATE_GET_FOLD(self) # <<<<<<<<<<<<<< + * + * ctypedef extern class datetime.timedelta[object PyDateTime_Delta]: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_number_columns, Py_None) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_r = PyDateTime_DATE_GET_FOLD(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":126 - * self.file_encoding = None - * self.number_columns = None - * self.number_rows = None # <<<<<<<<<<<<<< - * self.variable_value_labels = dict() - * self.value_labels = dict() + /* "cpython/datetime.pxd":143 + * + * @property + * cdef inline int fold(self): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_DATE_GET_FOLD(self) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_number_rows, Py_None) < 0) __PYX_ERR(0, 126, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":127 - * self.number_columns = None - * self.number_rows = None - * self.variable_value_labels = dict() # <<<<<<<<<<<<<< - * self.value_labels = dict() - * self.variable_to_label = dict() + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":149 + * ctypedef extern class datetime.timedelta[object PyDateTime_Delta]: + * @property + * cdef inline int day(self): # <<<<<<<<<<<<<< + * return PyDateTime_DELTA_GET_DAYS(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_value_labels, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":128 - * self.number_rows = None - * self.variable_value_labels = dict() - * self.value_labels = dict() # <<<<<<<<<<<<<< - * self.variable_to_label = dict() - * self.notes = list() +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_9timedelta_3day_day(PyDateTime_Delta *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("day", 0); + + /* "cpython/datetime.pxd":150 + * @property + * cdef inline int day(self): + * return PyDateTime_DELTA_GET_DAYS(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value_labels, __pyx_t_1) < 0) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = PyDateTime_DELTA_GET_DAYS(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":129 - * self.variable_value_labels = dict() - * self.value_labels = dict() - * self.variable_to_label = dict() # <<<<<<<<<<<<<< - * self.notes = list() - * self.original_variable_types = dict() + /* "cpython/datetime.pxd":149 + * ctypedef extern class datetime.timedelta[object PyDateTime_Delta]: + * @property + * cdef inline int day(self): # <<<<<<<<<<<<<< + * return PyDateTime_DELTA_GET_DAYS(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_to_label, __pyx_t_1) < 0) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":130 - * self.value_labels = dict() - * self.variable_to_label = dict() - * self.notes = list() # <<<<<<<<<<<<<< - * self.original_variable_types = dict() - * self.readstat_variable_types = dict() + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":153 + * + * @property + * cdef inline int second(self): # <<<<<<<<<<<<<< + * return PyDateTime_DELTA_GET_SECONDS(self) + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_notes, __pyx_t_1) < 0) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":131 - * self.variable_to_label = dict() - * self.notes = list() - * self.original_variable_types = dict() # <<<<<<<<<<<<<< - * self.readstat_variable_types = dict() - * self.table_name = None +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_9timedelta_6second_second(PyDateTime_Delta *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("second", 0); + + /* "cpython/datetime.pxd":154 + * @property + * cdef inline int second(self): + * return PyDateTime_DELTA_GET_SECONDS(self) # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_original_variable_types, __pyx_t_1) < 0) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = PyDateTime_DELTA_GET_SECONDS(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":132 - * self.notes = list() - * self.original_variable_types = dict() - * self.readstat_variable_types = dict() # <<<<<<<<<<<<<< - * self.table_name = None - * self.missing_ranges = dict() + /* "cpython/datetime.pxd":153 + * + * @property + * cdef inline int second(self): # <<<<<<<<<<<<<< + * return PyDateTime_DELTA_GET_SECONDS(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_readstat_variable_types, __pyx_t_1) < 0) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":133 - * self.original_variable_types = dict() - * self.readstat_variable_types = dict() - * self.table_name = None # <<<<<<<<<<<<<< - * self.missing_ranges = dict() - * self.missing_user_values = dict() + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":157 + * + * @property + * cdef inline int microsecond(self): # <<<<<<<<<<<<<< + * return PyDateTime_DELTA_GET_MICROSECONDS(self) + * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_table_name, Py_None) < 0) __PYX_ERR(0, 133, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":134 - * self.readstat_variable_types = dict() - * self.table_name = None - * self.missing_ranges = dict() # <<<<<<<<<<<<<< - * self.missing_user_values = dict() - * self.variable_storage_width = dict() +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_9timedelta_11microsecond_microsecond(PyDateTime_Delta *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("microsecond", 0); + + /* "cpython/datetime.pxd":158 + * @property + * cdef inline int microsecond(self): + * return PyDateTime_DELTA_GET_MICROSECONDS(self) # <<<<<<<<<<<<<< + * + * ctypedef extern class datetime.tzinfo[object PyDateTime_TZInfo]: */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_missing_ranges, __pyx_t_1) < 0) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = PyDateTime_DELTA_GET_MICROSECONDS(((PyObject *)__pyx_v_self)); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":135 - * self.table_name = None - * self.missing_ranges = dict() - * self.missing_user_values = dict() # <<<<<<<<<<<<<< - * self.variable_storage_width = dict() - * self.variable_display_width = dict() + /* "cpython/datetime.pxd":157 + * + * @property + * cdef inline int microsecond(self): # <<<<<<<<<<<<<< + * return PyDateTime_DELTA_GET_MICROSECONDS(self) + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_missing_user_values, __pyx_t_1) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":136 - * self.missing_ranges = dict() - * self.missing_user_values = dict() - * self.variable_storage_width = dict() # <<<<<<<<<<<<<< - * self.variable_display_width = dict() - * self.variable_alignment = dict() + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":282 + * # Datetime C API initialization function. + * # You have to call it before any usage of DateTime CAPI functions. + * cdef inline void import_datetime(): # <<<<<<<<<<<<<< + * PyDateTime_IMPORT + * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_storage_width, __pyx_t_1) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":137 - * self.missing_user_values = dict() - * self.variable_storage_width = dict() - * self.variable_display_width = dict() # <<<<<<<<<<<<<< - * self.variable_alignment = dict() - * self.variable_measure = dict() +static CYTHON_INLINE void __pyx_f_7cpython_8datetime_import_datetime(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("import_datetime", 0); + + /* "cpython/datetime.pxd":283 + * # You have to call it before any usage of DateTime CAPI functions. + * cdef inline void import_datetime(): + * PyDateTime_IMPORT # <<<<<<<<<<<<<< + * + * # Create date object using DateTime CAPI factory function. */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_display_width, __pyx_t_1) < 0) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + (void)(PyDateTime_IMPORT); - /* "pyreadstat/_readstat_parser.pyx":138 - * self.variable_storage_width = dict() - * self.variable_display_width = dict() - * self.variable_alignment = dict() # <<<<<<<<<<<<<< - * self.variable_measure = dict() + /* "cpython/datetime.pxd":282 + * # Datetime C API initialization function. + * # You have to call it before any usage of DateTime CAPI functions. + * cdef inline void import_datetime(): # <<<<<<<<<<<<<< + * PyDateTime_IMPORT * */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_alignment, __pyx_t_1) < 0) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":139 - * self.variable_display_width = dict() - * self.variable_alignment = dict() - * self.variable_measure = dict() # <<<<<<<<<<<<<< + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "cpython/datetime.pxd":287 + * # Create date object using DateTime CAPI factory function. + * # Note, there are no range checks for any of the arguments. + * cdef inline date date_new(int year, int month, int day): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType) * + */ + +static CYTHON_INLINE PyDateTime_Date *__pyx_f_7cpython_8datetime_date_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day) { + PyDateTime_Date *__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("date_new", 0); + + /* "cpython/datetime.pxd":288 + * # Note, there are no range checks for any of the arguments. + * cdef inline date date_new(int year, int month, int day): + * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType) # <<<<<<<<<<<<<< * + * # Create time object using DateTime CAPI factory function */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = ((PyObject *)PyDateTimeAPI->Date_FromDate(__pyx_v_year, __pyx_v_month, __pyx_v_day, PyDateTimeAPI->DateType)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_measure, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyDateTime_Date *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":120 - * This class holds metadata we want to give back to python - * """ - * def __init__(self): # <<<<<<<<<<<<<< - * self.column_names = list() - * self.column_labels = list() + /* "cpython/datetime.pxd":287 + * # Create date object using DateTime CAPI factory function. + * # Note, there are no range checks for any of the arguments. + * cdef inline date date_new(int year, int month, int day): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType) + * */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pyreadstat._readstat_parser.metadata_container.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_AddTraceback("cpython.datetime.date_new", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":155 - * +/* "cpython/datetime.pxd":292 + * # Create time object using DateTime CAPI factory function + * # Note, there are no range checks for any of the arguments. + * cdef inline time time_new(int hour, int minute, int second, int microsecond, object tz, int fold=0): # <<<<<<<<<<<<<< + * return __Pyx_DateTime_TimeWithFold(hour, minute, second, microsecond, tz, fold) * - * cdef py_datetime_format transform_variable_format(str var_format, py_file_format file_format): # <<<<<<<<<<<<<< - * """ - * Transforms a readstat var_format to a date, datetime or time format label */ -static __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_f_10pyreadstat_16_readstat_parser_transform_variable_format(PyObject *__pyx_v_var_format, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format) { - __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_r; +static CYTHON_INLINE PyDateTime_Time *__pyx_f_7cpython_8datetime_time_new(int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz, struct __pyx_opt_args_7cpython_8datetime_time_new *__pyx_optional_args) { + int __pyx_v_fold = ((int)0); + PyDateTime_Time *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("transform_variable_format", 0); + __Pyx_RefNannySetupContext("time_new", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_fold = __pyx_optional_args->fold; + } + } - /* "pyreadstat/_readstat_parser.pyx":159 - * Transforms a readstat var_format to a date, datetime or time format label - * """ - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * if var_format in sas_all_formats: - * if var_format in sas_date_formats: + /* "cpython/datetime.pxd":293 + * # Note, there are no range checks for any of the arguments. + * cdef inline time time_new(int hour, int minute, int second, int microsecond, object tz, int fold=0): + * return __Pyx_DateTime_TimeWithFold(hour, minute, second, microsecond, tz, fold) # <<<<<<<<<<<<<< + * + * # Create datetime object using DateTime CAPI factory function. */ - switch (__pyx_v_file_format) { - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = ((PyObject *)__Pyx_DateTime_TimeWithFold(__pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, __pyx_v_fold)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cpython_8datetime_time))))) __PYX_ERR(2, 293, __pyx_L1_error) + __pyx_r = ((PyDateTime_Time *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":160 - * """ - * if file_format == FILE_FORMAT_SAS: - * if var_format in sas_all_formats: # <<<<<<<<<<<<<< - * if var_format in sas_date_formats: - * return DATE_FORMAT_DATE + /* "cpython/datetime.pxd":292 + * # Create time object using DateTime CAPI factory function + * # Note, there are no range checks for any of the arguments. + * cdef inline time time_new(int hour, int minute, int second, int microsecond, object tz, int fold=0): # <<<<<<<<<<<<<< + * return __Pyx_DateTime_TimeWithFold(hour, minute, second, microsecond, tz, fold) + * */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_all_formats, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 160, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":161 - * if file_format == FILE_FORMAT_SAS: - * if var_format in sas_all_formats: - * if var_format in sas_date_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATE - * elif var_format in sas_datetime_formats: - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 161, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cpython.datetime.time_new", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":162 - * if var_format in sas_all_formats: - * if var_format in sas_date_formats: - * return DATE_FORMAT_DATE # <<<<<<<<<<<<<< - * elif var_format in sas_datetime_formats: - * return DATE_FORMAT_DATETIME +/* "cpython/datetime.pxd":297 + * # Create datetime object using DateTime CAPI factory function. + * # Note, there are no range checks for any of the arguments. + * cdef inline datetime datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz, int fold=0): # <<<<<<<<<<<<<< + * return __Pyx_DateTime_DateTimeWithFold(year, month, day, hour, minute, second, microsecond, tz, fold) + * */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE; - goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":161 - * if file_format == FILE_FORMAT_SAS: - * if var_format in sas_all_formats: - * if var_format in sas_date_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATE - * elif var_format in sas_datetime_formats: - */ - } +static CYTHON_INLINE PyDateTime_DateTime *__pyx_f_7cpython_8datetime_datetime_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day, int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz, struct __pyx_opt_args_7cpython_8datetime_datetime_new *__pyx_optional_args) { + int __pyx_v_fold = ((int)0); + PyDateTime_DateTime *__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("datetime_new", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_fold = __pyx_optional_args->fold; + } + } - /* "pyreadstat/_readstat_parser.pyx":163 - * if var_format in sas_date_formats: - * return DATE_FORMAT_DATE - * elif var_format in sas_datetime_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATETIME - * elif var_format in sas_time_formats: + /* "cpython/datetime.pxd":298 + * # Note, there are no range checks for any of the arguments. + * cdef inline datetime datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz, int fold=0): + * return __Pyx_DateTime_DateTimeWithFold(year, month, day, hour, minute, second, microsecond, tz, fold) # <<<<<<<<<<<<<< + * + * # Create timedelta object using DateTime CAPI factory function. */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 163, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = ((PyObject *)__Pyx_DateTime_DateTimeWithFold(__pyx_v_year, __pyx_v_month, __pyx_v_day, __pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, __pyx_v_fold)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 298, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyDateTime_DateTime *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":164 - * return DATE_FORMAT_DATE - * elif var_format in sas_datetime_formats: - * return DATE_FORMAT_DATETIME # <<<<<<<<<<<<<< - * elif var_format in sas_time_formats: - * return DATE_FORMAT_TIME + /* "cpython/datetime.pxd":297 + * # Create datetime object using DateTime CAPI factory function. + * # Note, there are no range checks for any of the arguments. + * cdef inline datetime datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz, int fold=0): # <<<<<<<<<<<<<< + * return __Pyx_DateTime_DateTimeWithFold(year, month, day, hour, minute, second, microsecond, tz, fold) + * */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME; - goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":163 - * if var_format in sas_date_formats: - * return DATE_FORMAT_DATE - * elif var_format in sas_datetime_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATETIME - * elif var_format in sas_time_formats: - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cpython.datetime.datetime_new", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":165 - * elif var_format in sas_datetime_formats: - * return DATE_FORMAT_DATETIME - * elif var_format in sas_time_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_TIME - * else: +/* "cpython/datetime.pxd":302 + * # Create timedelta object using DateTime CAPI factory function. + * # Note, there are no range checks for any of the arguments. + * cdef inline timedelta timedelta_new(int days, int seconds, int useconds): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType) + * */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_time_formats, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 165, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":166 - * return DATE_FORMAT_DATETIME - * elif var_format in sas_time_formats: - * return DATE_FORMAT_TIME # <<<<<<<<<<<<<< - * else: - * return DATE_FORMAT_NOTADATE - */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME; - goto __pyx_L0; +static CYTHON_INLINE PyDateTime_Delta *__pyx_f_7cpython_8datetime_timedelta_new(int __pyx_v_days, int __pyx_v_seconds, int __pyx_v_useconds) { + PyDateTime_Delta *__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("timedelta_new", 0); - /* "pyreadstat/_readstat_parser.pyx":165 - * elif var_format in sas_datetime_formats: - * return DATE_FORMAT_DATETIME - * elif var_format in sas_time_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_TIME - * else: + /* "cpython/datetime.pxd":303 + * # Note, there are no range checks for any of the arguments. + * cdef inline timedelta timedelta_new(int days, int seconds, int useconds): + * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType) # <<<<<<<<<<<<<< + * + * # Create timedelta object using DateTime CAPI factory function. */ - } + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = ((PyObject *)PyDateTimeAPI->Delta_FromDelta(__pyx_v_days, __pyx_v_seconds, __pyx_v_useconds, 1, PyDateTimeAPI->DeltaType)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyDateTime_Delta *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":160 - * """ - * if file_format == FILE_FORMAT_SAS: - * if var_format in sas_all_formats: # <<<<<<<<<<<<<< - * if var_format in sas_date_formats: - * return DATE_FORMAT_DATE + /* "cpython/datetime.pxd":302 + * # Create timedelta object using DateTime CAPI factory function. + * # Note, there are no range checks for any of the arguments. + * cdef inline timedelta timedelta_new(int days, int seconds, int useconds): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType) + * */ - goto __pyx_L3; - } - /* "pyreadstat/_readstat_parser.pyx":168 - * return DATE_FORMAT_TIME - * else: - * return DATE_FORMAT_NOTADATE # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("cpython.datetime.timedelta_new", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":306 * - * elif file_format == FILE_FORMAT_SPSS: + * # Create timedelta object using DateTime CAPI factory function. + * cdef inline object timezone_new(object offset, object name=None): # <<<<<<<<<<<<<< + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') */ - /*else*/ { - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE; - goto __pyx_L0; + +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_timezone_new(PyObject *__pyx_v_offset, struct __pyx_opt_args_7cpython_8datetime_timezone_new *__pyx_optional_args) { + PyObject *__pyx_v_name = ((PyObject *)Py_None); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("timezone_new", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_name = __pyx_optional_args->name; } - __pyx_L3:; + } - /* "pyreadstat/_readstat_parser.pyx":159 - * Transforms a readstat var_format to a date, datetime or time format label - * """ - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * if var_format in sas_all_formats: - * if var_format in sas_date_formats: + /* "cpython/datetime.pxd":307 + * # Create timedelta object using DateTime CAPI factory function. + * cdef inline object timezone_new(object offset, object name=None): + * if PY_VERSION_HEX < 0x030700b1: # <<<<<<<<<<<<<< + * raise RuntimeError('Time zones are not available from the C-API.') + * return __Pyx_TimeZone_FromOffsetAndName(offset, name if name is not None else NULL) */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: + __pyx_t_1 = (PY_VERSION_HEX < 0x030700b1); + if (unlikely(__pyx_t_1)) { - /* "pyreadstat/_readstat_parser.pyx":171 + /* "cpython/datetime.pxd":308 + * cdef inline object timezone_new(object offset, object name=None): + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') # <<<<<<<<<<<<<< + * return __Pyx_TimeZone_FromOffsetAndName(offset, name if name is not None else NULL) * - * elif file_format == FILE_FORMAT_SPSS: - * if var_format in spss_all_formats: # <<<<<<<<<<<<<< - * if var_format in spss_date_formats: - * return DATE_FORMAT_DATE */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_all_formats, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 171, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 308, __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(2, 308, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":172 - * elif file_format == FILE_FORMAT_SPSS: - * if var_format in spss_all_formats: - * if var_format in spss_date_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATE - * elif var_format in spss_datetime_formats: + /* "cpython/datetime.pxd":307 + * # Create timedelta object using DateTime CAPI factory function. + * cdef inline object timezone_new(object offset, object name=None): + * if PY_VERSION_HEX < 0x030700b1: # <<<<<<<<<<<<<< + * raise RuntimeError('Time zones are not available from the C-API.') + * return __Pyx_TimeZone_FromOffsetAndName(offset, name if name is not None else NULL) */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 172, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + } - /* "pyreadstat/_readstat_parser.pyx":173 - * if var_format in spss_all_formats: - * if var_format in spss_date_formats: - * return DATE_FORMAT_DATE # <<<<<<<<<<<<<< - * elif var_format in spss_datetime_formats: - * return DATE_FORMAT_DATETIME + /* "cpython/datetime.pxd":309 + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') + * return __Pyx_TimeZone_FromOffsetAndName(offset, name if name is not None else NULL) # <<<<<<<<<<<<<< + * + * # Create datetime object using DB API constructor. */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE; - goto __pyx_L0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = (__pyx_v_name != Py_None); + if (__pyx_t_1) { + __pyx_t_3 = ((PyObject *)__pyx_v_name); + } else { + __pyx_t_3 = NULL; + } + __pyx_t_2 = __Pyx_TimeZone_FromOffsetAndName(__pyx_v_offset, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":172 - * elif file_format == FILE_FORMAT_SPSS: - * if var_format in spss_all_formats: - * if var_format in spss_date_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATE - * elif var_format in spss_datetime_formats: + /* "cpython/datetime.pxd":306 + * + * # Create timedelta object using DateTime CAPI factory function. + * cdef inline object timezone_new(object offset, object name=None): # <<<<<<<<<<<<<< + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') */ - } - /* "pyreadstat/_readstat_parser.pyx":174 - * if var_format in spss_date_formats: - * return DATE_FORMAT_DATE - * elif var_format in spss_datetime_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATETIME - * elif var_format in spss_time_formats: - */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 174, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cpython.datetime.timezone_new", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":175 - * return DATE_FORMAT_DATE - * elif var_format in spss_datetime_formats: - * return DATE_FORMAT_DATETIME # <<<<<<<<<<<<<< - * elif var_format in spss_time_formats: - * return DATE_FORMAT_TIME +/* "cpython/datetime.pxd":312 + * + * # Create datetime object using DB API constructor. + * cdef inline datetime datetime_from_timestamp(timestamp, tz=None): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.DateTime_FromTimestamp( + * PyDateTimeAPI.DateTimeType, (timestamp, tz) if tz is not None else (timestamp,), NULL) */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME; - goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":174 - * if var_format in spss_date_formats: - * return DATE_FORMAT_DATE - * elif var_format in spss_datetime_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATETIME - * elif var_format in spss_time_formats: - */ - } - - /* "pyreadstat/_readstat_parser.pyx":176 - * elif var_format in spss_datetime_formats: - * return DATE_FORMAT_DATETIME - * elif var_format in spss_time_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_TIME - * else: - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_time_formats, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 176, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "pyreadstat/_readstat_parser.pyx":177 - * return DATE_FORMAT_DATETIME - * elif var_format in spss_time_formats: - * return DATE_FORMAT_TIME # <<<<<<<<<<<<<< - * else: - * return DATE_FORMAT_NOTADATE - */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME; - goto __pyx_L0; - - /* "pyreadstat/_readstat_parser.pyx":176 - * elif var_format in spss_datetime_formats: - * return DATE_FORMAT_DATETIME - * elif var_format in spss_time_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_TIME - * else: - */ - } +static CYTHON_INLINE PyDateTime_DateTime *__pyx_f_7cpython_8datetime_datetime_from_timestamp(PyObject *__pyx_v_timestamp, struct __pyx_opt_args_7cpython_8datetime_datetime_from_timestamp *__pyx_optional_args) { + PyObject *__pyx_v_tz = ((PyObject *)Py_None); + PyDateTime_DateTime *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("datetime_from_timestamp", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_tz = __pyx_optional_args->tz; + } + } - /* "pyreadstat/_readstat_parser.pyx":171 + /* "cpython/datetime.pxd":313 + * # Create datetime object using DB API constructor. + * cdef inline datetime datetime_from_timestamp(timestamp, tz=None): + * return PyDateTimeAPI.DateTime_FromTimestamp( # <<<<<<<<<<<<<< + * PyDateTimeAPI.DateTimeType, (timestamp, tz) if tz is not None else (timestamp,), NULL) * - * elif file_format == FILE_FORMAT_SPSS: - * if var_format in spss_all_formats: # <<<<<<<<<<<<<< - * if var_format in spss_date_formats: - * return DATE_FORMAT_DATE */ - goto __pyx_L5; - } + __Pyx_XDECREF((PyObject *)__pyx_r); - /* "pyreadstat/_readstat_parser.pyx":179 - * return DATE_FORMAT_TIME - * else: - * return DATE_FORMAT_NOTADATE # <<<<<<<<<<<<<< + /* "cpython/datetime.pxd":314 + * cdef inline datetime datetime_from_timestamp(timestamp, tz=None): + * return PyDateTimeAPI.DateTime_FromTimestamp( + * PyDateTimeAPI.DateTimeType, (timestamp, tz) if tz is not None else (timestamp,), NULL) # <<<<<<<<<<<<<< * - * elif file_format == FILE_FORMAT_STATA: + * # Create date object using DB API constructor. */ - /*else*/ { - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE; - goto __pyx_L0; - } - __pyx_L5:; + __pyx_t_2 = (__pyx_v_tz != Py_None); + if (__pyx_t_2) { + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_timestamp); + __Pyx_GIVEREF(__pyx_v_timestamp); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_timestamp); + __Pyx_INCREF(__pyx_v_tz); + __Pyx_GIVEREF(__pyx_v_tz); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_tz); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_timestamp); + __Pyx_GIVEREF(__pyx_v_timestamp); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_timestamp); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } - /* "pyreadstat/_readstat_parser.pyx":170 - * return DATE_FORMAT_NOTADATE + /* "cpython/datetime.pxd":313 + * # Create datetime object using DB API constructor. + * cdef inline datetime datetime_from_timestamp(timestamp, tz=None): + * return PyDateTimeAPI.DateTime_FromTimestamp( # <<<<<<<<<<<<<< + * PyDateTimeAPI.DateTimeType, (timestamp, tz) if tz is not None else (timestamp,), NULL) * - * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< - * if var_format in spss_all_formats: - * if var_format in spss_date_formats: */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: + __pyx_t_3 = ((PyObject *)PyDateTimeAPI->DateTime_FromTimestamp(((PyObject *)PyDateTimeAPI->DateTimeType), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyDateTime_DateTime *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":182 + /* "cpython/datetime.pxd":312 * - * elif file_format == FILE_FORMAT_STATA: - * if var_format in stata_all_formats: # <<<<<<<<<<<<<< - * if var_format in stata_date_formats: - * return DATE_FORMAT_DATE + * # Create datetime object using DB API constructor. + * cdef inline datetime datetime_from_timestamp(timestamp, tz=None): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.DateTime_FromTimestamp( + * PyDateTimeAPI.DateTimeType, (timestamp, tz) if tz is not None else (timestamp,), NULL) */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_all_formats, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 182, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":183 - * elif file_format == FILE_FORMAT_STATA: - * if var_format in stata_all_formats: - * if var_format in stata_date_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATE - * elif var_format in stata_datetime_formats: - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 183, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cpython.datetime.datetime_from_timestamp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":184 - * if var_format in stata_all_formats: - * if var_format in stata_date_formats: - * return DATE_FORMAT_DATE # <<<<<<<<<<<<<< - * elif var_format in stata_datetime_formats: - * return DATE_FORMAT_DATETIME +/* "cpython/datetime.pxd":317 + * + * # Create date object using DB API constructor. + * cdef inline date date_from_timestamp(timestamp): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.Date_FromTimestamp(PyDateTimeAPI.DateType, (timestamp,)) + * */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE; - goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":183 - * elif file_format == FILE_FORMAT_STATA: - * if var_format in stata_all_formats: - * if var_format in stata_date_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATE - * elif var_format in stata_datetime_formats: - */ - } +static CYTHON_INLINE PyDateTime_Date *__pyx_f_7cpython_8datetime_date_from_timestamp(PyObject *__pyx_v_timestamp) { + PyDateTime_Date *__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("date_from_timestamp", 0); - /* "pyreadstat/_readstat_parser.pyx":185 - * if var_format in stata_date_formats: - * return DATE_FORMAT_DATE - * elif var_format in stata_datetime_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATETIME - * elif var_format in stata_time_formats: + /* "cpython/datetime.pxd":318 + * # Create date object using DB API constructor. + * cdef inline date date_from_timestamp(timestamp): + * return PyDateTimeAPI.Date_FromTimestamp(PyDateTimeAPI.DateType, (timestamp,)) # <<<<<<<<<<<<<< + * + * # More recognizable getters for date/time/datetime/timedelta. */ - __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 185, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __Pyx_XDECREF((PyObject *)__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 318, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_timestamp); + __Pyx_GIVEREF(__pyx_v_timestamp); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_timestamp); + __pyx_t_2 = ((PyObject *)PyDateTimeAPI->Date_FromTimestamp(((PyObject *)PyDateTimeAPI->DateType), __pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 318, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = ((PyDateTime_Date *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":186 - * return DATE_FORMAT_DATE - * elif var_format in stata_datetime_formats: - * return DATE_FORMAT_DATETIME # <<<<<<<<<<<<<< - * elif var_format in stata_time_formats: - * return DATE_FORMAT_TIME + /* "cpython/datetime.pxd":317 + * + * # Create date object using DB API constructor. + * cdef inline date date_from_timestamp(timestamp): # <<<<<<<<<<<<<< + * return PyDateTimeAPI.Date_FromTimestamp(PyDateTimeAPI.DateType, (timestamp,)) + * */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME; - goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":185 - * if var_format in stata_date_formats: - * return DATE_FORMAT_DATE - * elif var_format in stata_datetime_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_DATETIME - * elif var_format in stata_time_formats: - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cpython.datetime.date_from_timestamp", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":187 - * elif var_format in stata_datetime_formats: - * return DATE_FORMAT_DATETIME - * elif var_format in stata_time_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_TIME - * else: +/* "cpython/datetime.pxd":326 + * + * # Get UTC singleton + * cdef inline object get_utc(): # <<<<<<<<<<<<<< + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_time_formats, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 187, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":188 - * return DATE_FORMAT_DATETIME - * elif var_format in stata_time_formats: - * return DATE_FORMAT_TIME # <<<<<<<<<<<<<< - * else: - * return DATE_FORMAT_NOTADATE - */ - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME; - goto __pyx_L0; +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_get_utc(void) { + 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("get_utc", 0); - /* "pyreadstat/_readstat_parser.pyx":187 - * elif var_format in stata_datetime_formats: - * return DATE_FORMAT_DATETIME - * elif var_format in stata_time_formats: # <<<<<<<<<<<<<< - * return DATE_FORMAT_TIME - * else: + /* "cpython/datetime.pxd":327 + * # Get UTC singleton + * cdef inline object get_utc(): + * if PY_VERSION_HEX < 0x030700b1: # <<<<<<<<<<<<<< + * raise RuntimeError('Time zones are not available from the C-API.') + * return __Pyx_TimeZone_UTC */ - } + __pyx_t_1 = (PY_VERSION_HEX < 0x030700b1); + if (unlikely(__pyx_t_1)) { - /* "pyreadstat/_readstat_parser.pyx":182 + /* "cpython/datetime.pxd":328 + * cdef inline object get_utc(): + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') # <<<<<<<<<<<<<< + * return __Pyx_TimeZone_UTC * - * elif file_format == FILE_FORMAT_STATA: - * if var_format in stata_all_formats: # <<<<<<<<<<<<<< - * if var_format in stata_date_formats: - * return DATE_FORMAT_DATE */ - goto __pyx_L7; - } + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 328, __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(2, 328, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":190 - * return DATE_FORMAT_TIME - * else: - * return DATE_FORMAT_NOTADATE # <<<<<<<<<<<<<< - * - * cdef object transform_datetime(py_datetime_format var_format, double tstamp, py_file_format file_format, object origin, bint dates_as_pandas): + /* "cpython/datetime.pxd":327 + * # Get UTC singleton + * cdef inline object get_utc(): + * if PY_VERSION_HEX < 0x030700b1: # <<<<<<<<<<<<<< + * raise RuntimeError('Time zones are not available from the C-API.') + * return __Pyx_TimeZone_UTC */ - /*else*/ { - __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE; - goto __pyx_L0; - } - __pyx_L7:; + } - /* "pyreadstat/_readstat_parser.pyx":181 - * return DATE_FORMAT_NOTADATE + /* "cpython/datetime.pxd":329 + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') + * return __Pyx_TimeZone_UTC # <<<<<<<<<<<<<< * - * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * if var_format in stata_all_formats: - * if var_format in stata_date_formats: + * # Get tzinfo of time */ - break; - default: break; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__Pyx_TimeZone_UTC)); + __pyx_r = ((PyObject *)__Pyx_TimeZone_UTC); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":155 - * + /* "cpython/datetime.pxd":326 * - * cdef py_datetime_format transform_variable_format(str var_format, py_file_format file_format): # <<<<<<<<<<<<<< - * """ - * Transforms a readstat var_format to a date, datetime or time format label + * # Get UTC singleton + * cdef inline object get_utc(): # <<<<<<<<<<<<<< + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') */ /* function exit code */ - __pyx_r = (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) 0; - goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("pyreadstat._readstat_parser.transform_variable_format", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cpython.datetime.get_utc", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":192 - * return DATE_FORMAT_NOTADATE +/* "cpython/datetime.pxd":332 + * + * # Get tzinfo of time + * cdef inline object time_tzinfo(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_TZINFO(o) * - * cdef object transform_datetime(py_datetime_format var_format, double tstamp, py_file_format file_format, object origin, bint dates_as_pandas): # <<<<<<<<<<<<<< - * """ - * Transforms a tstamp integer value to a date, time or datetime pyton object. */ -static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_transform_datetime(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_var_format, double __pyx_v_tstamp, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format, PyObject *__pyx_v_origin, int __pyx_v_dates_as_pandas) { - PyObject *__pyx_v_tdelta = 0; - int __pyx_v_days; - int __pyx_v_secs; - double __pyx_v_msecs; - int __pyx_v_usecs; - PyObject *__pyx_v_mydat = 0; +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_time_tzinfo(PyObject *__pyx_v_o) { 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("transform_datetime", 0); + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("time_tzinfo", 0); - /* "pyreadstat/_readstat_parser.pyx":205 - * cdef object mydat + /* "cpython/datetime.pxd":333 + * # Get tzinfo of time + * cdef inline object time_tzinfo(object o): + * return PyDateTime_TIME_GET_TZINFO(o) # <<<<<<<<<<<<<< * - * if var_format == DATE_FORMAT_DATE: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_SPSS: - * # tstamp is in seconds + * # Get tzinfo of datetime */ - switch (__pyx_v_var_format) { - case __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE: + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDateTime_TIME_GET_TZINFO(__pyx_v_o); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":206 + /* "cpython/datetime.pxd":332 + * + * # Get tzinfo of time + * cdef inline object time_tzinfo(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_TZINFO(o) * - * if var_format == DATE_FORMAT_DATE: - * if file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< - * # tstamp is in seconds - * days = (floor(tstamp / 86400)) */ - __pyx_t_1 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS) != 0); - if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":208 - * if file_format == FILE_FORMAT_SPSS: - * # tstamp is in seconds - * days = (floor(tstamp / 86400)) # <<<<<<<<<<<<<< - * secs = (tstamp % 86400) - * tdelta = timedelta_new(days, secs, 0) - */ - __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400.0))); + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":209 - * # tstamp is in seconds - * days = (floor(tstamp / 86400)) - * secs = (tstamp % 86400) # <<<<<<<<<<<<<< - * tdelta = timedelta_new(days, secs, 0) - * #tdelta = timedelta(seconds=tstamp) +/* "cpython/datetime.pxd":336 + * + * # Get tzinfo of datetime + * cdef inline object datetime_tzinfo(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_TZINFO(o) + * */ - __pyx_v_secs = ((int)__Pyx_mod_double(__pyx_v_tstamp, 86400.0)); - /* "pyreadstat/_readstat_parser.pyx":210 - * days = (floor(tstamp / 86400)) - * secs = (tstamp % 86400) - * tdelta = timedelta_new(days, secs, 0) # <<<<<<<<<<<<<< - * #tdelta = timedelta(seconds=tstamp) - * else: - */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_tdelta = __pyx_t_2; - __pyx_t_2 = 0; +static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_tzinfo(PyObject *__pyx_v_o) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1; + __Pyx_RefNannySetupContext("datetime_tzinfo", 0); - /* "pyreadstat/_readstat_parser.pyx":206 + /* "cpython/datetime.pxd":337 + * # Get tzinfo of datetime + * cdef inline object datetime_tzinfo(object o): + * return PyDateTime_DATE_GET_TZINFO(o) # <<<<<<<<<<<<<< * - * if var_format == DATE_FORMAT_DATE: - * if file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< - * # tstamp is in seconds - * days = (floor(tstamp / 86400)) + * # Get year of date */ - goto __pyx_L3; - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDateTime_DATE_GET_TZINFO(__pyx_v_o); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":214 - * else: - * # tstamp is in days - * days = tstamp # <<<<<<<<<<<<<< - * tdelta = timedelta_new(days, 0, 0) - * #tdelta = timedelta(days=tstamp) + /* "cpython/datetime.pxd":336 + * + * # Get tzinfo of datetime + * cdef inline object datetime_tzinfo(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_TZINFO(o) + * */ - /*else*/ { - __pyx_v_days = ((int)__pyx_v_tstamp); - /* "pyreadstat/_readstat_parser.pyx":215 - * # tstamp is in days - * days = tstamp - * tdelta = timedelta_new(days, 0, 0) # <<<<<<<<<<<<<< - * #tdelta = timedelta(days=tstamp) - * mydat = origin + tdelta - */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_tdelta = __pyx_t_2; - __pyx_t_2 = 0; - } - __pyx_L3:; + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":217 - * tdelta = timedelta_new(days, 0, 0) - * #tdelta = timedelta(days=tstamp) - * mydat = origin + tdelta # <<<<<<<<<<<<<< - * if dates_as_pandas: - * return mydat +/* "cpython/datetime.pxd":340 + * + * # Get year of date + * cdef inline int date_year(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(o) + * */ - __pyx_t_2 = PyNumber_Add(__pyx_v_origin, __pyx_v_tdelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_mydat = __pyx_t_2; - __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":218 - * #tdelta = timedelta(days=tstamp) - * mydat = origin + tdelta - * if dates_as_pandas: # <<<<<<<<<<<<<< - * return mydat - * else: - */ - __pyx_t_1 = (__pyx_v_dates_as_pandas != 0); - if (__pyx_t_1) { +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_year(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("date_year", 0); - /* "pyreadstat/_readstat_parser.pyx":219 - * mydat = origin + tdelta - * if dates_as_pandas: - * return mydat # <<<<<<<<<<<<<< - * else: - * return mydat.date() + /* "cpython/datetime.pxd":341 + * # Get year of date + * cdef inline int date_year(object o): + * return PyDateTime_GET_YEAR(o) # <<<<<<<<<<<<<< + * + * # Get month of date */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_mydat); - __pyx_r = __pyx_v_mydat; - goto __pyx_L0; + __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":218 - * #tdelta = timedelta(days=tstamp) - * mydat = origin + tdelta - * if dates_as_pandas: # <<<<<<<<<<<<<< - * return mydat - * else: + /* "cpython/datetime.pxd":340 + * + * # Get year of date + * cdef inline int date_year(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(o) + * */ - } - /* "pyreadstat/_readstat_parser.pyx":221 - * return mydat - * else: - * return mydat.date() # <<<<<<<<<<<<<< - * elif var_format == DATE_FORMAT_DATETIME: - * if file_format == FILE_FORMAT_STATA: - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_mydat, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __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(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - } + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":205 - * cdef object mydat +/* "cpython/datetime.pxd":344 + * + * # Get month of date + * cdef inline int date_month(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(o) * - * if var_format == DATE_FORMAT_DATE: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_SPSS: - * # tstamp is in seconds */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME: - /* "pyreadstat/_readstat_parser.pyx":223 - * return mydat.date() - * elif var_format == DATE_FORMAT_DATETIME: - * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) - */ - __pyx_t_1 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA) != 0); - if (__pyx_t_1) { +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_month(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("date_month", 0); - /* "pyreadstat/_readstat_parser.pyx":225 - * if file_format == FILE_FORMAT_STATA: - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) # <<<<<<<<<<<<<< - * msecs = tstamp % 86400000 - * secs = (msecs/1000) + /* "cpython/datetime.pxd":345 + * # Get month of date + * cdef inline int date_month(object o): + * return PyDateTime_GET_MONTH(o) # <<<<<<<<<<<<<< + * + * # Get day of date */ - __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400000.0))); + __pyx_r = PyDateTime_GET_MONTH(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":226 - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) - * msecs = tstamp % 86400000 # <<<<<<<<<<<<<< - * secs = (msecs/1000) - * usecs = ((msecs % 1000) * 1000 ) + /* "cpython/datetime.pxd":344 + * + * # Get month of date + * cdef inline int date_month(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(o) + * */ - __pyx_v_msecs = __Pyx_mod_double(__pyx_v_tstamp, 86400000.0); - /* "pyreadstat/_readstat_parser.pyx":227 - * days = (floor(tstamp / 86400000)) - * msecs = tstamp % 86400000 - * secs = (msecs/1000) # <<<<<<<<<<<<<< - * usecs = ((msecs % 1000) * 1000 ) - * tdelta = timedelta_new(days, secs, usecs) - */ - __pyx_v_secs = ((int)(__pyx_v_msecs / 1000.0)); + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":228 - * msecs = tstamp % 86400000 - * secs = (msecs/1000) - * usecs = ((msecs % 1000) * 1000 ) # <<<<<<<<<<<<<< - * tdelta = timedelta_new(days, secs, usecs) - * #tdelta = timedelta(milliseconds=tstamp) +/* "cpython/datetime.pxd":348 + * + * # Get day of date + * cdef inline int date_day(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(o) + * */ - __pyx_v_usecs = ((int)(__Pyx_mod_double(__pyx_v_msecs, 1000.0) * 1000.0)); - /* "pyreadstat/_readstat_parser.pyx":229 - * secs = (msecs/1000) - * usecs = ((msecs % 1000) * 1000 ) - * tdelta = timedelta_new(days, secs, usecs) # <<<<<<<<<<<<<< - * #tdelta = timedelta(milliseconds=tstamp) - * else: - */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, __pyx_v_usecs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_tdelta = __pyx_t_2; - __pyx_t_2 = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_day(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("date_day", 0); - /* "pyreadstat/_readstat_parser.pyx":223 - * return mydat.date() - * elif var_format == DATE_FORMAT_DATETIME: - * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) + /* "cpython/datetime.pxd":349 + * # Get day of date + * cdef inline int date_day(object o): + * return PyDateTime_GET_DAY(o) # <<<<<<<<<<<<<< + * + * # Get year of datetime */ - goto __pyx_L5; - } + __pyx_r = PyDateTime_GET_DAY(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":233 - * else: - * # tstamp in seconds - * days = (floor(tstamp / 86400)) # <<<<<<<<<<<<<< - * secs = (tstamp % 86400) - * tdelta = timedelta_new(days, secs, 0) + /* "cpython/datetime.pxd":348 + * + * # Get day of date + * cdef inline int date_day(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(o) + * */ - /*else*/ { - __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400.0))); - /* "pyreadstat/_readstat_parser.pyx":234 - * # tstamp in seconds - * days = (floor(tstamp / 86400)) - * secs = (tstamp % 86400) # <<<<<<<<<<<<<< - * tdelta = timedelta_new(days, secs, 0) - * #tdelta = timedelta(seconds=tstamp) - */ - __pyx_v_secs = ((int)__Pyx_mod_double(__pyx_v_tstamp, 86400.0)); + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":235 - * days = (floor(tstamp / 86400)) - * secs = (tstamp % 86400) - * tdelta = timedelta_new(days, secs, 0) # <<<<<<<<<<<<<< - * #tdelta = timedelta(seconds=tstamp) - * mydat = origin + tdelta +/* "cpython/datetime.pxd":352 + * + * # Get year of datetime + * cdef inline int datetime_year(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(o) + * */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_tdelta = __pyx_t_2; - __pyx_t_2 = 0; - } - __pyx_L5:; - /* "pyreadstat/_readstat_parser.pyx":237 - * tdelta = timedelta_new(days, secs, 0) - * #tdelta = timedelta(seconds=tstamp) - * mydat = origin + tdelta # <<<<<<<<<<<<<< - * return mydat - * elif var_format == DATE_FORMAT_TIME: - */ - __pyx_t_2 = PyNumber_Add(__pyx_v_origin, __pyx_v_tdelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_mydat = __pyx_t_2; - __pyx_t_2 = 0; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_year(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_year", 0); - /* "pyreadstat/_readstat_parser.pyx":238 - * #tdelta = timedelta(seconds=tstamp) - * mydat = origin + tdelta - * return mydat # <<<<<<<<<<<<<< - * elif var_format == DATE_FORMAT_TIME: - * if file_format == FILE_FORMAT_STATA: + /* "cpython/datetime.pxd":353 + * # Get year of datetime + * cdef inline int datetime_year(object o): + * return PyDateTime_GET_YEAR(o) # <<<<<<<<<<<<<< + * + * # Get month of datetime */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_mydat); - __pyx_r = __pyx_v_mydat; - goto __pyx_L0; + __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":222 - * else: - * return mydat.date() - * elif var_format == DATE_FORMAT_DATETIME: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_STATA: - * # tstamp is in millisecons + /* "cpython/datetime.pxd":352 + * + * # Get year of datetime + * cdef inline int datetime_year(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_YEAR(o) + * */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME: - /* "pyreadstat/_readstat_parser.pyx":240 - * return mydat - * elif var_format == DATE_FORMAT_TIME: - * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) - */ - __pyx_t_1 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA) != 0); - if (__pyx_t_1) { + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":242 - * if file_format == FILE_FORMAT_STATA: - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) # <<<<<<<<<<<<<< - * msecs = tstamp % 86400000 - * secs = (msecs/1000) +/* "cpython/datetime.pxd":356 + * + * # Get month of datetime + * cdef inline int datetime_month(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(o) + * */ - __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400000.0))); - /* "pyreadstat/_readstat_parser.pyx":243 - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) - * msecs = tstamp % 86400000 # <<<<<<<<<<<<<< - * secs = (msecs/1000) - * usecs = ((msecs % 1000) * 1000 ) - */ - __pyx_v_msecs = __Pyx_mod_double(__pyx_v_tstamp, 86400000.0); +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_month(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_month", 0); - /* "pyreadstat/_readstat_parser.pyx":244 - * days = (floor(tstamp / 86400000)) - * msecs = tstamp % 86400000 - * secs = (msecs/1000) # <<<<<<<<<<<<<< - * usecs = ((msecs % 1000) * 1000 ) - * tdelta = timedelta_new(days, secs, usecs) + /* "cpython/datetime.pxd":357 + * # Get month of datetime + * cdef inline int datetime_month(object o): + * return PyDateTime_GET_MONTH(o) # <<<<<<<<<<<<<< + * + * # Get day of datetime */ - __pyx_v_secs = ((int)(__pyx_v_msecs / 1000.0)); + __pyx_r = PyDateTime_GET_MONTH(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":245 - * msecs = tstamp % 86400000 - * secs = (msecs/1000) - * usecs = ((msecs % 1000) * 1000 ) # <<<<<<<<<<<<<< - * tdelta = timedelta_new(days, secs, usecs) - * #tdelta = timedelta(milliseconds=tstamp) + /* "cpython/datetime.pxd":356 + * + * # Get month of datetime + * cdef inline int datetime_month(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_MONTH(o) + * */ - __pyx_v_usecs = ((int)(__Pyx_mod_double(__pyx_v_msecs, 1000.0) * 1000.0)); - /* "pyreadstat/_readstat_parser.pyx":246 - * secs = (msecs/1000) - * usecs = ((msecs % 1000) * 1000 ) - * tdelta = timedelta_new(days, secs, usecs) # <<<<<<<<<<<<<< - * #tdelta = timedelta(milliseconds=tstamp) - * else: - */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, __pyx_v_usecs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_tdelta = __pyx_t_2; - __pyx_t_2 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":240 - * return mydat - * elif var_format == DATE_FORMAT_TIME: - * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * # tstamp is in millisecons - * days = (floor(tstamp / 86400000)) +/* "cpython/datetime.pxd":360 + * + * # Get day of datetime + * cdef inline int datetime_day(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(o) + * */ - goto __pyx_L6; - } - /* "pyreadstat/_readstat_parser.pyx":250 - * else: - * # tstamp in seconds - * days = (floor(tstamp / 86400)) # <<<<<<<<<<<<<< - * secs = (tstamp % 86400) - * tdelta = timedelta_new(days, secs, 0) - */ - /*else*/ { - __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400.0))); +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_day(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_day", 0); - /* "pyreadstat/_readstat_parser.pyx":251 - * # tstamp in seconds - * days = (floor(tstamp / 86400)) - * secs = (tstamp % 86400) # <<<<<<<<<<<<<< - * tdelta = timedelta_new(days, secs, 0) - * #tdelta = timedelta(seconds=tstamp) + /* "cpython/datetime.pxd":361 + * # Get day of datetime + * cdef inline int datetime_day(object o): + * return PyDateTime_GET_DAY(o) # <<<<<<<<<<<<<< + * + * # Get hour of time */ - __pyx_v_secs = ((int)__Pyx_mod_double(__pyx_v_tstamp, 86400.0)); + __pyx_r = PyDateTime_GET_DAY(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":252 - * days = (floor(tstamp / 86400)) - * secs = (tstamp % 86400) - * tdelta = timedelta_new(days, secs, 0) # <<<<<<<<<<<<<< - * #tdelta = timedelta(seconds=tstamp) - * mydat = origin + tdelta - */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_tdelta = __pyx_t_2; - __pyx_t_2 = 0; - } - __pyx_L6:; - - /* "pyreadstat/_readstat_parser.pyx":254 - * tdelta = timedelta_new(days, secs, 0) - * #tdelta = timedelta(seconds=tstamp) - * mydat = origin + tdelta # <<<<<<<<<<<<<< - * return mydat.time() + /* "cpython/datetime.pxd":360 + * + * # Get day of datetime + * cdef inline int datetime_day(object o): # <<<<<<<<<<<<<< + * return PyDateTime_GET_DAY(o) * */ - __pyx_t_2 = PyNumber_Add(__pyx_v_origin, __pyx_v_tdelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_mydat = __pyx_t_2; - __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":255 - * #tdelta = timedelta(seconds=tstamp) - * mydat = origin + tdelta - * return mydat.time() # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":364 * + * # Get hour of time + * cdef inline int time_hour(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_HOUR(o) * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_mydat, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __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(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":239 - * mydat = origin + tdelta - * return mydat - * elif var_format == DATE_FORMAT_TIME: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_STATA: - * # tstamp is in millisecons +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_hour(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("time_hour", 0); + + /* "cpython/datetime.pxd":365 + * # Get hour of time + * cdef inline int time_hour(object o): + * return PyDateTime_TIME_GET_HOUR(o) # <<<<<<<<<<<<<< + * + * # Get minute of time */ - break; - default: break; - } + __pyx_r = PyDateTime_TIME_GET_HOUR(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":192 - * return DATE_FORMAT_NOTADATE + /* "cpython/datetime.pxd":364 + * + * # Get hour of time + * cdef inline int time_hour(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_HOUR(o) * - * cdef object transform_datetime(py_datetime_format var_format, double tstamp, py_file_format file_format, object origin, bint dates_as_pandas): # <<<<<<<<<<<<<< - * """ - * Transforms a tstamp integer value to a date, time or datetime pyton object. */ /* 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("pyreadstat._readstat_parser.transform_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_tdelta); - __Pyx_XDECREF(__pyx_v_mydat); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":258 +/* "cpython/datetime.pxd":368 * + * # Get minute of time + * cdef inline int time_minute(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MINUTE(o) * - * cdef object convert_readstat_to_python_value(readstat_value_t value, int index, data_container dc): # <<<<<<<<<<<<<< - * """ - * Converts a readstat value to a python value. */ -static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(readstat_value_t __pyx_v_value, int __pyx_v_index, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc) { - readstat_type_t __pyx_v_var_type; - __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_var_format; - __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format __pyx_v_pyformat; - PyObject *__pyx_v_origin = 0; - int __pyx_v_dates_as_pandas; - __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; - PyObject *__pyx_v_result = 0; - char *__pyx_v_c_str_value; - PyObject *__pyx_v_py_str_value = 0; - int8_t __pyx_v_c_int8_value; - int16_t __pyx_v_c_int16_value; - int32_t __pyx_v_c_int32_value; - float __pyx_v_c_float_value; - double __pyx_v_c_double_value; - long __pyx_v_py_long_value; - double __pyx_v_py_float_value; - double __pyx_v_tstamp; - PyObject *__pyx_r = NULL; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_minute(PyObject *__pyx_v_o) { + int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - readstat_type_t __pyx_t_2; - __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_3; - int __pyx_t_4; - __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("convert_readstat_to_python_value", 0); + __Pyx_RefNannySetupContext("time_minute", 0); - /* "pyreadstat/_readstat_parser.pyx":285 - * cdef double tstamp + /* "cpython/datetime.pxd":369 + * # Get minute of time + * cdef inline int time_minute(object o): + * return PyDateTime_TIME_GET_MINUTE(o) # <<<<<<<<<<<<<< * - * var_type = dc.col_dtypes[index] # <<<<<<<<<<<<<< - * var_format = dc.col_formats[index] - * origin = dc.origin + * # Get second of time */ - if (unlikely(__pyx_v_dc->col_dtypes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 285, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dtypes, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_var_type = __pyx_t_2; + __pyx_r = PyDateTime_TIME_GET_MINUTE(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":286 + /* "cpython/datetime.pxd":368 + * + * # Get minute of time + * cdef inline int time_minute(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MINUTE(o) * - * var_type = dc.col_dtypes[index] - * var_format = dc.col_formats[index] # <<<<<<<<<<<<<< - * origin = dc.origin - * dates_as_pandas = dc.dates_as_pandas */ - if (unlikely(__pyx_v_dc->col_formats == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 286, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_formats, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = ((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_var_format = __pyx_t_3; - /* "pyreadstat/_readstat_parser.pyx":287 - * var_type = dc.col_dtypes[index] - * var_format = dc.col_formats[index] - * origin = dc.origin # <<<<<<<<<<<<<< - * dates_as_pandas = dc.dates_as_pandas - * file_format = dc.file_format - */ - __pyx_t_1 = __pyx_v_dc->origin; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_origin = __pyx_t_1; - __pyx_t_1 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":288 - * var_format = dc.col_formats[index] - * origin = dc.origin - * dates_as_pandas = dc.dates_as_pandas # <<<<<<<<<<<<<< - * file_format = dc.file_format +/* "cpython/datetime.pxd":372 + * + * # Get second of time + * cdef inline int time_second(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_SECOND(o) * */ - __pyx_t_4 = __pyx_v_dc->dates_as_pandas; - __pyx_v_dates_as_pandas = __pyx_t_4; - /* "pyreadstat/_readstat_parser.pyx":289 - * origin = dc.origin - * dates_as_pandas = dc.dates_as_pandas - * file_format = dc.file_format # <<<<<<<<<<<<<< +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_second(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("time_second", 0); + + /* "cpython/datetime.pxd":373 + * # Get second of time + * cdef inline int time_second(object o): + * return PyDateTime_TIME_GET_SECOND(o) # <<<<<<<<<<<<<< * - * # transform to values cython can deal with + * # Get microsecond of time */ - __pyx_t_5 = __pyx_v_dc->file_format; - __pyx_v_file_format = __pyx_t_5; + __pyx_r = PyDateTime_TIME_GET_SECOND(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":292 + /* "cpython/datetime.pxd":372 + * + * # Get second of time + * cdef inline int time_second(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_SECOND(o) * - * # transform to values cython can deal with - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< - * c_str_value = readstat_string_value(value) - * if c_str_value != NULL: */ - switch (__pyx_v_var_type) { - case READSTAT_TYPE_STRING: - case READSTAT_TYPE_STRING_REF: - /* "pyreadstat/_readstat_parser.pyx":293 - * # transform to values cython can deal with - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: - * c_str_value = readstat_string_value(value) # <<<<<<<<<<<<<< - * if c_str_value != NULL: - * py_str_value = c_str_value + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":376 + * + * # Get microsecond of time + * cdef inline int time_microsecond(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MICROSECOND(o) + * */ - __pyx_v_c_str_value = readstat_string_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":294 - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: - * c_str_value = readstat_string_value(value) - * if c_str_value != NULL: # <<<<<<<<<<<<<< - * py_str_value = c_str_value - * else: - */ - __pyx_t_4 = ((__pyx_v_c_str_value != NULL) != 0); - if (__pyx_t_4) { +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_microsecond(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("time_microsecond", 0); - /* "pyreadstat/_readstat_parser.pyx":295 - * c_str_value = readstat_string_value(value) - * if c_str_value != NULL: - * py_str_value = c_str_value # <<<<<<<<<<<<<< - * else: - * py_str_value = '' + /* "cpython/datetime.pxd":377 + * # Get microsecond of time + * cdef inline int time_microsecond(object o): + * return PyDateTime_TIME_GET_MICROSECOND(o) # <<<<<<<<<<<<<< + * + * # Get fold of time */ - __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_c_str_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_py_str_value = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_r = PyDateTime_TIME_GET_MICROSECOND(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":294 - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: - * c_str_value = readstat_string_value(value) - * if c_str_value != NULL: # <<<<<<<<<<<<<< - * py_str_value = c_str_value - * else: + /* "cpython/datetime.pxd":376 + * + * # Get microsecond of time + * cdef inline int time_microsecond(object o): # <<<<<<<<<<<<<< + * return PyDateTime_TIME_GET_MICROSECOND(o) + * */ - goto __pyx_L3; - } - /* "pyreadstat/_readstat_parser.pyx":297 - * py_str_value = c_str_value - * else: - * py_str_value = '' # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_STRING - * elif var_type == READSTAT_TYPE_INT8: - */ - /*else*/ { - __Pyx_INCREF(__pyx_kp_s__3); - __pyx_v_py_str_value = __pyx_kp_s__3; - } - __pyx_L3:; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":298 - * else: - * py_str_value = '' - * pyformat = VAR_FORMAT_STRING # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_INT8: - * c_int8_value = readstat_int8_value(value) +/* "cpython/datetime.pxd":380 + * + * # Get fold of time + * cdef inline int time_fold(object o): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_TIME_GET_FOLD(o) */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING; - /* "pyreadstat/_readstat_parser.pyx":292 +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_fold(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("time_fold", 0); + + /* "cpython/datetime.pxd":382 + * cdef inline int time_fold(object o): + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_TIME_GET_FOLD(o) # <<<<<<<<<<<<<< * - * # transform to values cython can deal with - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< - * c_str_value = readstat_string_value(value) - * if c_str_value != NULL: + * # Get hour of datetime */ - break; - case READSTAT_TYPE_INT8: + __pyx_r = PyDateTime_TIME_GET_FOLD(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":300 - * pyformat = VAR_FORMAT_STRING - * elif var_type == READSTAT_TYPE_INT8: - * c_int8_value = readstat_int8_value(value) # <<<<<<<<<<<<<< - * py_long_value = c_int8_value - * pyformat = VAR_FORMAT_LONG + /* "cpython/datetime.pxd":380 + * + * # Get fold of time + * cdef inline int time_fold(object o): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_TIME_GET_FOLD(o) */ - __pyx_v_c_int8_value = readstat_int8_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":301 - * elif var_type == READSTAT_TYPE_INT8: - * c_int8_value = readstat_int8_value(value) - * py_long_value = c_int8_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_INT16: - */ - __pyx_v_py_long_value = ((long)__pyx_v_c_int8_value); + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":302 - * c_int8_value = readstat_int8_value(value) - * py_long_value = c_int8_value - * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_INT16: - * c_int16_value = readstat_int16_value(value) +/* "cpython/datetime.pxd":385 + * + * # Get hour of datetime + * cdef inline int datetime_hour(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_HOUR(o) + * */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* "pyreadstat/_readstat_parser.pyx":299 - * py_str_value = '' - * pyformat = VAR_FORMAT_STRING - * elif var_type == READSTAT_TYPE_INT8: # <<<<<<<<<<<<<< - * c_int8_value = readstat_int8_value(value) - * py_long_value = c_int8_value - */ - break; - case READSTAT_TYPE_INT16: +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_hour(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_hour", 0); - /* "pyreadstat/_readstat_parser.pyx":304 - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_INT16: - * c_int16_value = readstat_int16_value(value) # <<<<<<<<<<<<<< - * py_long_value = c_int16_value - * pyformat = VAR_FORMAT_LONG + /* "cpython/datetime.pxd":386 + * # Get hour of datetime + * cdef inline int datetime_hour(object o): + * return PyDateTime_DATE_GET_HOUR(o) # <<<<<<<<<<<<<< + * + * # Get minute of datetime */ - __pyx_v_c_int16_value = readstat_int16_value(__pyx_v_value); + __pyx_r = PyDateTime_DATE_GET_HOUR(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":305 - * elif var_type == READSTAT_TYPE_INT16: - * c_int16_value = readstat_int16_value(value) - * py_long_value = c_int16_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_INT32: + /* "cpython/datetime.pxd":385 + * + * # Get hour of datetime + * cdef inline int datetime_hour(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_HOUR(o) + * */ - __pyx_v_py_long_value = ((long)__pyx_v_c_int16_value); - /* "pyreadstat/_readstat_parser.pyx":306 - * c_int16_value = readstat_int16_value(value) - * py_long_value = c_int16_value - * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_INT32: - * c_int32_value = readstat_int32_value(value) - */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":303 - * py_long_value = c_int8_value - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_INT16: # <<<<<<<<<<<<<< - * c_int16_value = readstat_int16_value(value) - * py_long_value = c_int16_value +/* "cpython/datetime.pxd":389 + * + * # Get minute of datetime + * cdef inline int datetime_minute(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MINUTE(o) + * */ - break; - case READSTAT_TYPE_INT32: - /* "pyreadstat/_readstat_parser.pyx":308 - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_INT32: - * c_int32_value = readstat_int32_value(value) # <<<<<<<<<<<<<< - * py_long_value = c_int32_value - * pyformat = VAR_FORMAT_LONG +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_minute(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_minute", 0); + + /* "cpython/datetime.pxd":390 + * # Get minute of datetime + * cdef inline int datetime_minute(object o): + * return PyDateTime_DATE_GET_MINUTE(o) # <<<<<<<<<<<<<< + * + * # Get second of datetime */ - __pyx_v_c_int32_value = readstat_int32_value(__pyx_v_value); + __pyx_r = PyDateTime_DATE_GET_MINUTE(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":309 - * elif var_type == READSTAT_TYPE_INT32: - * c_int32_value = readstat_int32_value(value) - * py_long_value = c_int32_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_FLOAT: + /* "cpython/datetime.pxd":389 + * + * # Get minute of datetime + * cdef inline int datetime_minute(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MINUTE(o) + * */ - __pyx_v_py_long_value = ((long)__pyx_v_c_int32_value); - /* "pyreadstat/_readstat_parser.pyx":310 - * c_int32_value = readstat_int32_value(value) - * py_long_value = c_int32_value - * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_FLOAT: - * c_float_value = readstat_float_value(value) + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":393 + * + * # Get second of datetime + * cdef inline int datetime_second(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_SECOND(o) + * */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* "pyreadstat/_readstat_parser.pyx":307 - * py_long_value = c_int16_value - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_INT32: # <<<<<<<<<<<<<< - * c_int32_value = readstat_int32_value(value) - * py_long_value = c_int32_value +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_second(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_second", 0); + + /* "cpython/datetime.pxd":394 + * # Get second of datetime + * cdef inline int datetime_second(object o): + * return PyDateTime_DATE_GET_SECOND(o) # <<<<<<<<<<<<<< + * + * # Get microsecond of datetime */ - break; - case READSTAT_TYPE_FLOAT: + __pyx_r = PyDateTime_DATE_GET_SECOND(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":312 - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_FLOAT: - * c_float_value = readstat_float_value(value) # <<<<<<<<<<<<<< - * py_float_value = c_float_value - * pyformat = VAR_FORMAT_FLOAT + /* "cpython/datetime.pxd":393 + * + * # Get second of datetime + * cdef inline int datetime_second(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_SECOND(o) + * */ - __pyx_v_c_float_value = readstat_float_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":313 - * elif var_type == READSTAT_TYPE_FLOAT: - * c_float_value = readstat_float_value(value) - * py_float_value = c_float_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_FLOAT - * elif var_type == READSTAT_TYPE_DOUBLE: - */ - __pyx_v_py_float_value = ((double)__pyx_v_c_float_value); + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":314 - * c_float_value = readstat_float_value(value) - * py_float_value = c_float_value - * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_DOUBLE: - * c_double_value = readstat_double_value(value); +/* "cpython/datetime.pxd":397 + * + * # Get microsecond of datetime + * cdef inline int datetime_microsecond(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MICROSECOND(o) + * */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; - /* "pyreadstat/_readstat_parser.pyx":311 - * py_long_value = c_int32_value - * pyformat = VAR_FORMAT_LONG - * elif var_type == READSTAT_TYPE_FLOAT: # <<<<<<<<<<<<<< - * c_float_value = readstat_float_value(value) - * py_float_value = c_float_value - */ - break; - case READSTAT_TYPE_DOUBLE: +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_microsecond(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_microsecond", 0); - /* "pyreadstat/_readstat_parser.pyx":316 - * pyformat = VAR_FORMAT_FLOAT - * elif var_type == READSTAT_TYPE_DOUBLE: - * c_double_value = readstat_double_value(value); # <<<<<<<<<<<<<< - * py_float_value = c_double_value - * pyformat = VAR_FORMAT_FLOAT + /* "cpython/datetime.pxd":398 + * # Get microsecond of datetime + * cdef inline int datetime_microsecond(object o): + * return PyDateTime_DATE_GET_MICROSECOND(o) # <<<<<<<<<<<<<< + * + * # Get fold of datetime */ - __pyx_v_c_double_value = readstat_double_value(__pyx_v_value); + __pyx_r = PyDateTime_DATE_GET_MICROSECOND(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":317 - * elif var_type == READSTAT_TYPE_DOUBLE: - * c_double_value = readstat_double_value(value); - * py_float_value = c_double_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_FLOAT - * else: + /* "cpython/datetime.pxd":397 + * + * # Get microsecond of datetime + * cdef inline int datetime_microsecond(object o): # <<<<<<<<<<<<<< + * return PyDateTime_DATE_GET_MICROSECOND(o) + * */ - __pyx_v_py_float_value = ((double)__pyx_v_c_double_value); - /* "pyreadstat/_readstat_parser.pyx":318 - * c_double_value = readstat_double_value(value); - * py_float_value = c_double_value - * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("Unkown data type") - */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":315 - * py_float_value = c_float_value - * pyformat = VAR_FORMAT_FLOAT - * elif var_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< - * c_double_value = readstat_double_value(value); - * py_float_value = c_double_value +/* "cpython/datetime.pxd":401 + * + * # Get fold of datetime + * cdef inline int datetime_fold(object o): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_DATE_GET_FOLD(o) */ - break; - default: - /* "pyreadstat/_readstat_parser.pyx":320 - * pyformat = VAR_FORMAT_FLOAT - * else: - * raise PyreadstatError("Unkown data type") # <<<<<<<<<<<<<< +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_fold(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("datetime_fold", 0); + + /* "cpython/datetime.pxd":403 + * cdef inline int datetime_fold(object o): + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_DATE_GET_FOLD(o) # <<<<<<<<<<<<<< * - * # final transformation and storage + * # Get days of timedelta */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = NULL; - 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_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_kp_s_Unkown_data_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Unkown_data_type); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 320, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 320, __pyx_L1_error) - break; - } + __pyx_r = PyDateTime_DATE_GET_FOLD(__pyx_v_o); + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":324 - * # final transformation and storage + /* "cpython/datetime.pxd":401 * - * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - * result = py_str_value + * # Get fold of datetime + * cdef inline int datetime_fold(object o): # <<<<<<<<<<<<<< + * # For Python < 3.6 this returns 0 no matter what + * return PyDateTime_DATE_GET_FOLD(o) */ - switch (__pyx_v_pyformat) { - case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING: - /* "pyreadstat/_readstat_parser.pyx":325 + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":406 + * + * # Get days of timedelta + * cdef inline int timedelta_days(object o): # <<<<<<<<<<<<<< + * return (o).days * - * if pyformat == VAR_FORMAT_STRING: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< - * result = py_str_value - * else: */ - __pyx_t_8 = ((__pyx_v_var_format == __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_4 = __pyx_t_8; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_8 = (__pyx_v_dc->no_datetime_conversion != 0); - __pyx_t_4 = __pyx_t_8; - __pyx_L5_bool_binop_done:; - if (likely(__pyx_t_4)) { - /* "pyreadstat/_readstat_parser.pyx":326 - * if pyformat == VAR_FORMAT_STRING: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - * result = py_str_value # <<<<<<<<<<<<<< - * else: - * #str_byte_val = py_str_value.encode("UTF-8") +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_days(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("timedelta_days", 0); + + /* "cpython/datetime.pxd":407 + * # Get days of timedelta + * cdef inline int timedelta_days(object o): + * return (o).days # <<<<<<<<<<<<<< + * + * # Get seconds of timedelta */ - if (unlikely(!__pyx_v_py_str_value)) { __Pyx_RaiseUnboundLocalError("py_str_value"); __PYX_ERR(0, 326, __pyx_L1_error) } - __Pyx_INCREF(__pyx_v_py_str_value); - __pyx_v_result = __pyx_v_py_str_value; + __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->days; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":325 + /* "cpython/datetime.pxd":406 + * + * # Get days of timedelta + * cdef inline int timedelta_days(object o): # <<<<<<<<<<<<<< + * return (o).days * - * if pyformat == VAR_FORMAT_STRING: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< - * result = py_str_value - * else: */ - goto __pyx_L4; - } - /* "pyreadstat/_readstat_parser.pyx":329 - * else: - * #str_byte_val = py_str_value.encode("UTF-8") - * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) # <<<<<<<<<<<<<< - * elif pyformat == VAR_FORMAT_LONG: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "cpython/datetime.pxd":410 + * + * # Get seconds of timedelta + * cdef inline int timedelta_seconds(object o): # <<<<<<<<<<<<<< + * return (o).seconds + * */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(!__pyx_v_py_str_value)) { __Pyx_RaiseUnboundLocalError("py_str_value"); __PYX_ERR(0, 329, __pyx_L1_error) } - if (unlikely(__pyx_v_dc->col_names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 329, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_dc->col_names, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_v_py_str_value); - __Pyx_GIVEREF(__pyx_v_py_str_value); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_py_str_value); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_STRING_type_with_value_s_with_da, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __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_6)) __PYX_ERR(0, 329, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 329, __pyx_L1_error) - } - __pyx_L4:; - /* "pyreadstat/_readstat_parser.pyx":324 - * # final transformation and storage +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_seconds(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("timedelta_seconds", 0); + + /* "cpython/datetime.pxd":411 + * # Get seconds of timedelta + * cdef inline int timedelta_seconds(object o): + * return (o).seconds # <<<<<<<<<<<<<< * - * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - * result = py_str_value + * # Get microseconds of timedelta */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG: + __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->seconds; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":331 - * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) - * elif pyformat == VAR_FORMAT_LONG: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< - * result = py_long_value - * else: + /* "cpython/datetime.pxd":410 + * + * # Get seconds of timedelta + * cdef inline int timedelta_seconds(object o): # <<<<<<<<<<<<<< + * return (o).seconds + * */ - __pyx_t_8 = ((__pyx_v_var_format == __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_4 = __pyx_t_8; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_8 = (__pyx_v_dc->no_datetime_conversion != 0); - __pyx_t_4 = __pyx_t_8; - __pyx_L8_bool_binop_done:; - if (__pyx_t_4) { - /* "pyreadstat/_readstat_parser.pyx":332 - * elif pyformat == VAR_FORMAT_LONG: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - * result = py_long_value # <<<<<<<<<<<<<< - * else: - * tstamp = py_long_value - */ - __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_py_long_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_result = __pyx_t_6; - __pyx_t_6 = 0; - - /* "pyreadstat/_readstat_parser.pyx":331 - * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) - * elif pyformat == VAR_FORMAT_LONG: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< - * result = py_long_value - * else: - */ - goto __pyx_L7; - } + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":334 - * result = py_long_value - * else: - * tstamp = py_long_value # <<<<<<<<<<<<<< - * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) - * elif pyformat == VAR_FORMAT_FLOAT: +/* "cpython/datetime.pxd":414 + * + * # Get microseconds of timedelta + * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<< + * return (o).microseconds + * */ - /*else*/ { - __pyx_v_tstamp = ((double)__pyx_v_py_long_value); - /* "pyreadstat/_readstat_parser.pyx":335 - * else: - * tstamp = py_long_value - * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) # <<<<<<<<<<<<<< - * elif pyformat == VAR_FORMAT_FLOAT: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - */ - __pyx_t_6 = __pyx_f_10pyreadstat_16_readstat_parser_transform_datetime(__pyx_v_var_format, __pyx_v_tstamp, __pyx_v_file_format, __pyx_v_origin, __pyx_v_dates_as_pandas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_result = __pyx_t_6; - __pyx_t_6 = 0; - } - __pyx_L7:; +static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_microseconds(PyObject *__pyx_v_o) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("timedelta_microseconds", 0); - /* "pyreadstat/_readstat_parser.pyx":330 - * #str_byte_val = py_str_value.encode("UTF-8") - * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) - * elif pyformat == VAR_FORMAT_LONG: # <<<<<<<<<<<<<< - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - * result = py_long_value + /* "cpython/datetime.pxd":415 + * # Get microseconds of timedelta + * cdef inline int timedelta_microseconds(object o): + * return (o).microseconds # <<<<<<<<<<<<<< + * + * cdef inline double total_seconds(timedelta obj): */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT: + __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->microseconds; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":337 - * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) - * elif pyformat == VAR_FORMAT_FLOAT: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< - * result = py_float_value - * else: + /* "cpython/datetime.pxd":414 + * + * # Get microseconds of timedelta + * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<< + * return (o).microseconds + * */ - __pyx_t_8 = ((__pyx_v_var_format == __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE) != 0); - if (!__pyx_t_8) { - } else { - __pyx_t_4 = __pyx_t_8; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_8 = (__pyx_v_dc->no_datetime_conversion != 0); - __pyx_t_4 = __pyx_t_8; - __pyx_L11_bool_binop_done:; - if (__pyx_t_4) { - /* "pyreadstat/_readstat_parser.pyx":338 - * elif pyformat == VAR_FORMAT_FLOAT: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - * result = py_float_value # <<<<<<<<<<<<<< - * else: - * #tstamp = py_float_value - */ - __pyx_t_6 = PyFloat_FromDouble(__pyx_v_py_float_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 338, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_result = __pyx_t_6; - __pyx_t_6 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":337 - * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) - * elif pyformat == VAR_FORMAT_FLOAT: - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< - * result = py_float_value - * else: +/* "cpython/datetime.pxd":417 + * return (o).microseconds + * + * cdef inline double total_seconds(timedelta obj): # <<<<<<<<<<<<<< + * # Mirrors the "timedelta.total_seconds()" method. + * # Note that this implementation is not guaranteed to give *exactly* the same */ - goto __pyx_L10; - } - /* "pyreadstat/_readstat_parser.pyx":341 - * else: - * #tstamp = py_float_value - * tstamp = py_float_value # <<<<<<<<<<<<<< - * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) - * #elif pyformat == VAR_FORMAT_MISSING: - */ - /*else*/ { - __pyx_v_tstamp = __pyx_v_py_float_value; +static CYTHON_INLINE double __pyx_f_7cpython_8datetime_total_seconds(PyDateTime_Delta *__pyx_v_obj) { + double __pyx_v_days; + double __pyx_v_seconds; + double __pyx_v_micros; + double __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("total_seconds", 0); - /* "pyreadstat/_readstat_parser.pyx":342 - * #tstamp = py_float_value - * tstamp = py_float_value - * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) # <<<<<<<<<<<<<< - * #elif pyformat == VAR_FORMAT_MISSING: - * # pass + /* "cpython/datetime.pxd":423 + * cdef: + * double days, seconds, micros + * days = PyDateTime_DELTA_GET_DAYS(obj) # <<<<<<<<<<<<<< + * seconds = PyDateTime_DELTA_GET_SECONDS(obj) + * micros = PyDateTime_DELTA_GET_MICROSECONDS(obj) */ - __pyx_t_6 = __pyx_f_10pyreadstat_16_readstat_parser_transform_datetime(__pyx_v_var_format, __pyx_v_tstamp, __pyx_v_file_format, __pyx_v_origin, __pyx_v_dates_as_pandas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_result = __pyx_t_6; - __pyx_t_6 = 0; - } - __pyx_L10:; + __pyx_v_days = ((double)PyDateTime_DELTA_GET_DAYS(((PyObject *)__pyx_v_obj))); - /* "pyreadstat/_readstat_parser.pyx":336 - * tstamp = py_long_value - * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) - * elif pyformat == VAR_FORMAT_FLOAT: # <<<<<<<<<<<<<< - * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: - * result = py_float_value + /* "cpython/datetime.pxd":424 + * double days, seconds, micros + * days = PyDateTime_DELTA_GET_DAYS(obj) + * seconds = PyDateTime_DELTA_GET_SECONDS(obj) # <<<<<<<<<<<<<< + * micros = PyDateTime_DELTA_GET_MICROSECONDS(obj) + * return days * 24 * 3600 + seconds + micros / 1_000_000 */ - break; - default: + __pyx_v_seconds = ((double)PyDateTime_DELTA_GET_SECONDS(((PyObject *)__pyx_v_obj))); - /* "pyreadstat/_readstat_parser.pyx":346 - * # pass - * else: - * raise PyreadstatError("Failed convert C to python value") # <<<<<<<<<<<<<< - * - * return result + /* "cpython/datetime.pxd":425 + * days = PyDateTime_DELTA_GET_DAYS(obj) + * seconds = PyDateTime_DELTA_GET_SECONDS(obj) + * micros = PyDateTime_DELTA_GET_MICROSECONDS(obj) # <<<<<<<<<<<<<< + * return days * 24 * 3600 + seconds + micros / 1_000_000 */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = NULL; - 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_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_kp_s_Failed_convert_C_to_python_value) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Failed_convert_C_to_python_value); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 346, __pyx_L1_error) - break; - } + __pyx_v_micros = ((double)PyDateTime_DELTA_GET_MICROSECONDS(((PyObject *)__pyx_v_obj))); - /* "pyreadstat/_readstat_parser.pyx":348 - * raise PyreadstatError("Failed convert C to python value") - * - * return result # <<<<<<<<<<<<<< - * - * + /* "cpython/datetime.pxd":426 + * seconds = PyDateTime_DELTA_GET_SECONDS(obj) + * micros = PyDateTime_DELTA_GET_MICROSECONDS(obj) + * return days * 24 * 3600 + seconds + micros / 1_000_000 # <<<<<<<<<<<<<< */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_result); - __pyx_r = __pyx_v_result; + __pyx_r = ((((__pyx_v_days * 24.0) * 3600.0) + __pyx_v_seconds) + (__pyx_v_micros / 1000000.0)); goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":258 - * + /* "cpython/datetime.pxd":417 + * return (o).microseconds * - * cdef object convert_readstat_to_python_value(readstat_value_t value, int index, data_container dc): # <<<<<<<<<<<<<< - * """ - * Converts a readstat value to a python value. + * cdef inline double total_seconds(timedelta obj): # <<<<<<<<<<<<<< + * # Mirrors the "timedelta.total_seconds()" method. + * # Note that this implementation is not guaranteed to give *exactly* the same */ /* 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_9); - __Pyx_AddTraceback("pyreadstat._readstat_parser.convert_readstat_to_python_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_origin); - __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_py_str_value); - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":351 - * - * - * cdef int handle_metadata(readstat_metadata_t *metadata, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< +/* "pyreadstat/_readstat_parser.pyx":80 * """ - * This function sets the number of observations(rows), number of variables + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.n_obs = 0 + * self.n_vars = 0 */ -static int __pyx_f_10pyreadstat_16_readstat_parser_handle_metadata(readstat_metadata_t *__pyx_v_metadata, void *__pyx_v_ctx) { - int __pyx_v_var_count; - int __pyx_v_obs_count; - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; - char *__pyx_v_flabel_orig; - char *__pyx_v_fencoding_orig; - PyObject *__pyx_v_flabel = 0; - PyObject *__pyx_v_fencoding = 0; - CYTHON_UNUSED int __pyx_v_metaonly; - char *__pyx_v_table; +/* Python wrapper */ +static int __pyx_pw_10pyreadstat_16_readstat_parser_14data_container_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_10pyreadstat_16_readstat_parser_14data_container_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_14data_container___cinit__(((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_10pyreadstat_16_readstat_parser_14data_container___cinit__(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - 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("handle_metadata", 0); + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "pyreadstat/_readstat_parser.pyx":360 + /* "pyreadstat/_readstat_parser.pyx":81 * - * cdef int var_count, obs_count - * cdef data_container dc = ctx # <<<<<<<<<<<<<< - * #cdef object row - * cdef char * flabel_orig + * def __cinit__(self): + * self.n_obs = 0 # <<<<<<<<<<<<<< + * self.n_vars = 0 + * self.max_n_obs = 0 */ - __pyx_t_1 = ((PyObject *)__pyx_v_ctx); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_self->n_obs = 0; - /* "pyreadstat/_readstat_parser.pyx":368 - * cdef char * table - * - * metaonly = dc.metaonly # <<<<<<<<<<<<<< - * - * var_count = readstat_get_var_count(metadata) - */ - __pyx_t_2 = __pyx_v_dc->metaonly; - __pyx_v_metaonly = __pyx_t_2; - - /* "pyreadstat/_readstat_parser.pyx":370 - * metaonly = dc.metaonly - * - * var_count = readstat_get_var_count(metadata) # <<<<<<<<<<<<<< - * if var_count<0: - * raise PyreadstatError("Failed to read number of variables") + /* "pyreadstat/_readstat_parser.pyx":82 + * def __cinit__(self): + * self.n_obs = 0 + * self.n_vars = 0 # <<<<<<<<<<<<<< + * self.max_n_obs = 0 + * self.col_data = list() */ - __pyx_v_var_count = readstat_get_var_count(__pyx_v_metadata); + __pyx_v_self->n_vars = 0; - /* "pyreadstat/_readstat_parser.pyx":371 - * - * var_count = readstat_get_var_count(metadata) - * if var_count<0: # <<<<<<<<<<<<<< - * raise PyreadstatError("Failed to read number of variables") - * obs_count = readstat_get_row_count(metadata) + /* "pyreadstat/_readstat_parser.pyx":83 + * self.n_obs = 0 + * self.n_vars = 0 + * self.max_n_obs = 0 # <<<<<<<<<<<<<< + * self.col_data = list() + * self.col_data_len = list() */ - __pyx_t_2 = ((__pyx_v_var_count < 0) != 0); - if (unlikely(__pyx_t_2)) { + __pyx_v_self->max_n_obs = 0; - /* "pyreadstat/_readstat_parser.pyx":372 - * var_count = readstat_get_var_count(metadata) - * if var_count<0: - * raise PyreadstatError("Failed to read number of variables") # <<<<<<<<<<<<<< - * obs_count = readstat_get_row_count(metadata) - * if obs_count <0: + /* "pyreadstat/_readstat_parser.pyx":84 + * self.n_vars = 0 + * self.max_n_obs = 0 + * self.col_data = list() # <<<<<<<<<<<<<< + * self.col_data_len = list() + * self.col_names = list() */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __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_Failed_to_read_number_of_variabl) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Failed_to_read_number_of_variabl); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __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, 372, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_data); + __Pyx_DECREF(__pyx_v_self->col_data); + __pyx_v_self->col_data = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":371 - * - * var_count = readstat_get_var_count(metadata) - * if var_count<0: # <<<<<<<<<<<<<< - * raise PyreadstatError("Failed to read number of variables") - * obs_count = readstat_get_row_count(metadata) + /* "pyreadstat/_readstat_parser.pyx":85 + * self.max_n_obs = 0 + * self.col_data = list() + * self.col_data_len = list() # <<<<<<<<<<<<<< + * self.col_names = list() + * self.col_labels = list() */ - } + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_data_len); + __Pyx_DECREF(__pyx_v_self->col_data_len); + __pyx_v_self->col_data_len = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":373 - * if var_count<0: - * raise PyreadstatError("Failed to read number of variables") - * obs_count = readstat_get_row_count(metadata) # <<<<<<<<<<<<<< - * if obs_count <0: - * # if <0 it means the number of rows is not known, allocate 100 000 + /* "pyreadstat/_readstat_parser.pyx":86 + * self.col_data = list() + * self.col_data_len = list() + * self.col_names = list() # <<<<<<<<<<<<<< + * self.col_labels = list() + * self.col_dtypes = list() */ - __pyx_v_obs_count = readstat_get_row_count(__pyx_v_metadata); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_names); + __Pyx_DECREF(__pyx_v_self->col_names); + __pyx_v_self->col_names = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":374 - * raise PyreadstatError("Failed to read number of variables") - * obs_count = readstat_get_row_count(metadata) - * if obs_count <0: # <<<<<<<<<<<<<< - * # if <0 it means the number of rows is not known, allocate 100 000 - * obs_count = 100000 + /* "pyreadstat/_readstat_parser.pyx":87 + * self.col_data_len = list() + * self.col_names = list() + * self.col_labels = list() # <<<<<<<<<<<<<< + * self.col_dtypes = list() + * self.col_numpy_dtypes = list() */ - __pyx_t_2 = ((__pyx_v_obs_count < 0) != 0); - if (__pyx_t_2) { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_labels); + __Pyx_DECREF(__pyx_v_self->col_labels); + __pyx_v_self->col_labels = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":376 - * if obs_count <0: - * # if <0 it means the number of rows is not known, allocate 100 000 - * obs_count = 100000 # <<<<<<<<<<<<<< - * dc.is_unkown_number_rows = 1 - * + /* "pyreadstat/_readstat_parser.pyx":88 + * self.col_names = list() + * self.col_labels = list() + * self.col_dtypes = list() # <<<<<<<<<<<<<< + * self.col_numpy_dtypes = list() + * self.col_dtypes_isobject = list() */ - __pyx_v_obs_count = 0x186A0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_dtypes); + __Pyx_DECREF(__pyx_v_self->col_dtypes); + __pyx_v_self->col_dtypes = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":377 - * # if <0 it means the number of rows is not known, allocate 100 000 - * obs_count = 100000 - * dc.is_unkown_number_rows = 1 # <<<<<<<<<<<<<< - * - * dc.n_obs = obs_count + /* "pyreadstat/_readstat_parser.pyx":89 + * self.col_labels = list() + * self.col_dtypes = list() + * self.col_numpy_dtypes = list() # <<<<<<<<<<<<<< + * self.col_dtypes_isobject = list() + * self.col_dytpes_isfloat = list() */ - __pyx_v_dc->is_unkown_number_rows = 1; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_numpy_dtypes); + __Pyx_DECREF(__pyx_v_self->col_numpy_dtypes); + __pyx_v_self->col_numpy_dtypes = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":374 - * raise PyreadstatError("Failed to read number of variables") - * obs_count = readstat_get_row_count(metadata) - * if obs_count <0: # <<<<<<<<<<<<<< - * # if <0 it means the number of rows is not known, allocate 100 000 - * obs_count = 100000 + /* "pyreadstat/_readstat_parser.pyx":90 + * self.col_dtypes = list() + * self.col_numpy_dtypes = list() + * self.col_dtypes_isobject = list() # <<<<<<<<<<<<<< + * self.col_dytpes_isfloat = list() + * self.col_formats = list() */ - } + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_dtypes_isobject); + __Pyx_DECREF(__pyx_v_self->col_dtypes_isobject); + __pyx_v_self->col_dtypes_isobject = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":379 - * dc.is_unkown_number_rows = 1 - * - * dc.n_obs = obs_count # <<<<<<<<<<<<<< - * dc.n_vars = var_count - * + /* "pyreadstat/_readstat_parser.pyx":91 + * self.col_numpy_dtypes = list() + * self.col_dtypes_isobject = list() + * self.col_dytpes_isfloat = list() # <<<<<<<<<<<<<< + * self.col_formats = list() + * self.col_formats_original = list() */ - __pyx_v_dc->n_obs = __pyx_v_obs_count; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_dytpes_isfloat); + __Pyx_DECREF(__pyx_v_self->col_dytpes_isfloat); + __pyx_v_self->col_dytpes_isfloat = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":380 - * - * dc.n_obs = obs_count - * dc.n_vars = var_count # <<<<<<<<<<<<<< - * - * dc.col_data_len = [obs_count] * var_count + /* "pyreadstat/_readstat_parser.pyx":92 + * self.col_dtypes_isobject = list() + * self.col_dytpes_isfloat = list() + * self.col_formats = list() # <<<<<<<<<<<<<< + * self.col_formats_original = list() + * self.origin = None */ - __pyx_v_dc->n_vars = __pyx_v_var_count; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_formats); + __Pyx_DECREF(__pyx_v_self->col_formats); + __pyx_v_self->col_formats = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":382 - * dc.n_vars = var_count - * - * dc.col_data_len = [obs_count] * var_count # <<<<<<<<<<<<<< - * dc.col_numpy_dtypes = [None] * var_count - * dc.col_dytpes_isfloat = [0] * var_count + /* "pyreadstat/_readstat_parser.pyx":93 + * self.col_dytpes_isfloat = list() + * self.col_formats = list() + * self.col_formats_original = list() # <<<<<<<<<<<<<< + * self.origin = None + * self.is_unkown_number_rows = 0 */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_obs_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_t_1); - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_dc->col_data_len); - __Pyx_DECREF(__pyx_v_dc->col_data_len); - __pyx_v_dc->col_data_len = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "pyreadstat/_readstat_parser.pyx":383 - * - * dc.col_data_len = [obs_count] * var_count - * dc.col_numpy_dtypes = [None] * var_count # <<<<<<<<<<<<<< - * dc.col_dytpes_isfloat = [0] * var_count - * dc.col_dtypes_isobject = [0] * var_count - */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None); - } - } - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_dc->col_numpy_dtypes); - __Pyx_DECREF(__pyx_v_dc->col_numpy_dtypes); - __pyx_v_dc->col_numpy_dtypes = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->col_formats_original); + __Pyx_DECREF(__pyx_v_self->col_formats_original); + __pyx_v_self->col_formats_original = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":384 - * dc.col_data_len = [obs_count] * var_count - * dc.col_numpy_dtypes = [None] * var_count - * dc.col_dytpes_isfloat = [0] * var_count # <<<<<<<<<<<<<< - * dc.col_dtypes_isobject = [0] * var_count - * + /* "pyreadstat/_readstat_parser.pyx":94 + * self.col_formats = list() + * self.col_formats_original = list() + * self.origin = None # <<<<<<<<<<<<<< + * self.is_unkown_number_rows = 0 + * self.file_encoding = None */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_int_0); - } - } - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_dc->col_dytpes_isfloat); - __Pyx_DECREF(__pyx_v_dc->col_dytpes_isfloat); - __pyx_v_dc->col_dytpes_isfloat = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->origin); + __Pyx_DECREF(__pyx_v_self->origin); + __pyx_v_self->origin = Py_None; - /* "pyreadstat/_readstat_parser.pyx":385 - * dc.col_numpy_dtypes = [None] * var_count - * dc.col_dytpes_isfloat = [0] * var_count - * dc.col_dtypes_isobject = [0] * var_count # <<<<<<<<<<<<<< - * - * # read other metadata + /* "pyreadstat/_readstat_parser.pyx":95 + * self.col_formats_original = list() + * self.origin = None + * self.is_unkown_number_rows = 0 # <<<<<<<<<<<<<< + * self.file_encoding = None + * self.file_label = None */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_int_0); - } - } - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_dc->col_dtypes_isobject); - __Pyx_DECREF(__pyx_v_dc->col_dtypes_isobject); - __pyx_v_dc->col_dtypes_isobject = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_self->is_unkown_number_rows = 0; - /* "pyreadstat/_readstat_parser.pyx":388 - * - * # read other metadata - * flabel_orig = readstat_get_file_label(metadata); # <<<<<<<<<<<<<< - * fencoding_orig = readstat_get_file_encoding(metadata) - * if flabel_orig != NULL and flabel_orig[0]: + /* "pyreadstat/_readstat_parser.pyx":96 + * self.origin = None + * self.is_unkown_number_rows = 0 + * self.file_encoding = None # <<<<<<<<<<<<<< + * self.file_label = None + * self.metaonly = 0 */ - __pyx_v_flabel_orig = readstat_get_file_label(__pyx_v_metadata); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->file_encoding); + __Pyx_DECREF(__pyx_v_self->file_encoding); + __pyx_v_self->file_encoding = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":389 - * # read other metadata - * flabel_orig = readstat_get_file_label(metadata); - * fencoding_orig = readstat_get_file_encoding(metadata) # <<<<<<<<<<<<<< - * if flabel_orig != NULL and flabel_orig[0]: - * flabel = flabel_orig + /* "pyreadstat/_readstat_parser.pyx":97 + * self.is_unkown_number_rows = 0 + * self.file_encoding = None + * self.file_label = None # <<<<<<<<<<<<<< + * self.metaonly = 0 + * self.dates_as_pandas = 0 */ - __pyx_v_fencoding_orig = readstat_get_file_encoding(__pyx_v_metadata); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->file_label); + __Pyx_DECREF(__pyx_v_self->file_label); + __pyx_v_self->file_label = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":390 - * flabel_orig = readstat_get_file_label(metadata); - * fencoding_orig = readstat_get_file_encoding(metadata) - * if flabel_orig != NULL and flabel_orig[0]: # <<<<<<<<<<<<<< - * flabel = flabel_orig - * else: + /* "pyreadstat/_readstat_parser.pyx":98 + * self.file_encoding = None + * self.file_label = None + * self.metaonly = 0 # <<<<<<<<<<<<<< + * self.dates_as_pandas = 0 + * self.label_to_var_name = dict() */ - __pyx_t_5 = ((__pyx_v_flabel_orig != NULL) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_2 = __pyx_t_5; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_flabel_orig[0]) != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L6_bool_binop_done:; - if (__pyx_t_2) { + __pyx_v_self->metaonly = 0; - /* "pyreadstat/_readstat_parser.pyx":391 - * fencoding_orig = readstat_get_file_encoding(metadata) - * if flabel_orig != NULL and flabel_orig[0]: - * flabel = flabel_orig # <<<<<<<<<<<<<< - * else: - * flabel = None + /* "pyreadstat/_readstat_parser.pyx":99 + * self.file_label = None + * self.metaonly = 0 + * self.dates_as_pandas = 0 # <<<<<<<<<<<<<< + * self.label_to_var_name = dict() + * self.labels_raw = dict() */ - __pyx_t_3 = __Pyx_PyStr_FromString(__pyx_v_flabel_orig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_flabel = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_self->dates_as_pandas = 0; - /* "pyreadstat/_readstat_parser.pyx":390 - * flabel_orig = readstat_get_file_label(metadata); - * fencoding_orig = readstat_get_file_encoding(metadata) - * if flabel_orig != NULL and flabel_orig[0]: # <<<<<<<<<<<<<< - * flabel = flabel_orig - * else: + /* "pyreadstat/_readstat_parser.pyx":100 + * self.metaonly = 0 + * self.dates_as_pandas = 0 + * self.label_to_var_name = dict() # <<<<<<<<<<<<<< + * self.labels_raw = dict() + * self.notes = list() */ - goto __pyx_L5; - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->label_to_var_name); + __Pyx_DECREF(__pyx_v_self->label_to_var_name); + __pyx_v_self->label_to_var_name = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":393 - * flabel = flabel_orig - * else: - * flabel = None # <<<<<<<<<<<<<< - * if fencoding_orig != NULL and fencoding_orig[0]: - * fencoding = fencoding_orig + /* "pyreadstat/_readstat_parser.pyx":101 + * self.dates_as_pandas = 0 + * self.label_to_var_name = dict() + * self.labels_raw = dict() # <<<<<<<<<<<<<< + * self.notes = list() + * self.user_encoding = None */ - /*else*/ { - __Pyx_INCREF(Py_None); - __pyx_v_flabel = ((PyObject*)Py_None); - } - __pyx_L5:; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->labels_raw); + __Pyx_DECREF(__pyx_v_self->labels_raw); + __pyx_v_self->labels_raw = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":394 - * else: - * flabel = None - * if fencoding_orig != NULL and fencoding_orig[0]: # <<<<<<<<<<<<<< - * fencoding = fencoding_orig - * else: + /* "pyreadstat/_readstat_parser.pyx":102 + * self.label_to_var_name = dict() + * self.labels_raw = dict() + * self.notes = list() # <<<<<<<<<<<<<< + * self.user_encoding = None + * self.table_name = None */ - __pyx_t_5 = ((__pyx_v_fencoding_orig != NULL) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_2 = __pyx_t_5; - goto __pyx_L9_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_fencoding_orig[0]) != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L9_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->notes); + __Pyx_DECREF(__pyx_v_self->notes); + __pyx_v_self->notes = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":395 - * flabel = None - * if fencoding_orig != NULL and fencoding_orig[0]: - * fencoding = fencoding_orig # <<<<<<<<<<<<<< - * else: - * fencoding = None + /* "pyreadstat/_readstat_parser.pyx":103 + * self.labels_raw = dict() + * self.notes = list() + * self.user_encoding = None # <<<<<<<<<<<<<< + * self.table_name = None + * self.filter_cols = 0 */ - __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_fencoding_orig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_fencoding = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->user_encoding); + __Pyx_DECREF(__pyx_v_self->user_encoding); + __pyx_v_self->user_encoding = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":394 - * else: - * flabel = None - * if fencoding_orig != NULL and fencoding_orig[0]: # <<<<<<<<<<<<<< - * fencoding = fencoding_orig - * else: + /* "pyreadstat/_readstat_parser.pyx":104 + * self.notes = list() + * self.user_encoding = None + * self.table_name = None # <<<<<<<<<<<<<< + * self.filter_cols = 0 + * self.use_cols = list() */ - goto __pyx_L8; - } + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->table_name); + __Pyx_DECREF(__pyx_v_self->table_name); + __pyx_v_self->table_name = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":397 - * fencoding = fencoding_orig - * else: - * fencoding = None # <<<<<<<<<<<<<< - * - * dc.file_encoding = fencoding + /* "pyreadstat/_readstat_parser.pyx":105 + * self.user_encoding = None + * self.table_name = None + * self.filter_cols = 0 # <<<<<<<<<<<<<< + * self.use_cols = list() + * self.usernan = 0 */ - /*else*/ { - __Pyx_INCREF(Py_None); - __pyx_v_fencoding = ((PyObject*)Py_None); - } - __pyx_L8:; + __pyx_v_self->filter_cols = 0; - /* "pyreadstat/_readstat_parser.pyx":399 - * fencoding = None - * - * dc.file_encoding = fencoding # <<<<<<<<<<<<<< - * dc.file_label = flabel - * + /* "pyreadstat/_readstat_parser.pyx":106 + * self.table_name = None + * self.filter_cols = 0 + * self.use_cols = list() # <<<<<<<<<<<<<< + * self.usernan = 0 + * self.missing_ranges = dict() */ - __Pyx_INCREF(__pyx_v_fencoding); - __Pyx_GIVEREF(__pyx_v_fencoding); - __Pyx_GOTREF(__pyx_v_dc->file_encoding); - __Pyx_DECREF(__pyx_v_dc->file_encoding); - __pyx_v_dc->file_encoding = __pyx_v_fencoding; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->use_cols); + __Pyx_DECREF(__pyx_v_self->use_cols); + __pyx_v_self->use_cols = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":400 - * - * dc.file_encoding = fencoding - * dc.file_label = flabel # <<<<<<<<<<<<<< - * - * table = readstat_get_table_name(metadata) + /* "pyreadstat/_readstat_parser.pyx":107 + * self.filter_cols = 0 + * self.use_cols = list() + * self.usernan = 0 # <<<<<<<<<<<<<< + * self.missing_ranges = dict() + * self.missing_user_values = dict() */ - __Pyx_INCREF(__pyx_v_flabel); - __Pyx_GIVEREF(__pyx_v_flabel); - __Pyx_GOTREF(__pyx_v_dc->file_label); - __Pyx_DECREF(__pyx_v_dc->file_label); - __pyx_v_dc->file_label = __pyx_v_flabel; + __pyx_v_self->usernan = 0; - /* "pyreadstat/_readstat_parser.pyx":402 - * dc.file_label = flabel - * - * table = readstat_get_table_name(metadata) # <<<<<<<<<<<<<< - * if table != NULL and table[0]: - * dc.table_name = table + /* "pyreadstat/_readstat_parser.pyx":108 + * self.use_cols = list() + * self.usernan = 0 + * self.missing_ranges = dict() # <<<<<<<<<<<<<< + * self.missing_user_values = dict() + * self.variable_storage_width = dict() */ - __pyx_v_table = readstat_get_table_name(__pyx_v_metadata); + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->missing_ranges); + __Pyx_DECREF(__pyx_v_self->missing_ranges); + __pyx_v_self->missing_ranges = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":403 - * - * table = readstat_get_table_name(metadata) - * if table != NULL and table[0]: # <<<<<<<<<<<<<< - * dc.table_name = table - * + /* "pyreadstat/_readstat_parser.pyx":109 + * self.usernan = 0 + * self.missing_ranges = dict() + * self.missing_user_values = dict() # <<<<<<<<<<<<<< + * self.variable_storage_width = dict() + * self.variable_display_width = dict() */ - __pyx_t_5 = ((__pyx_v_table != NULL) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_2 = __pyx_t_5; - goto __pyx_L12_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_table[0]) != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L12_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->missing_user_values); + __Pyx_DECREF(__pyx_v_self->missing_user_values); + __pyx_v_self->missing_user_values = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":404 - * table = readstat_get_table_name(metadata) - * if table != NULL and table[0]: - * dc.table_name = table # <<<<<<<<<<<<<< - * - * return READSTAT_HANDLER_OK + /* "pyreadstat/_readstat_parser.pyx":110 + * self.missing_ranges = dict() + * self.missing_user_values = dict() + * self.variable_storage_width = dict() # <<<<<<<<<<<<<< + * self.variable_display_width = dict() + * self.variable_alignment = dict() */ - __pyx_t_3 = __Pyx_PyStr_FromString(__pyx_v_table); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_dc->table_name); - __Pyx_DECREF(__pyx_v_dc->table_name); - __pyx_v_dc->table_name = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->variable_storage_width); + __Pyx_DECREF(__pyx_v_self->variable_storage_width); + __pyx_v_self->variable_storage_width = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":403 - * - * table = readstat_get_table_name(metadata) - * if table != NULL and table[0]: # <<<<<<<<<<<<<< - * dc.table_name = table - * + /* "pyreadstat/_readstat_parser.pyx":111 + * self.missing_user_values = dict() + * self.variable_storage_width = dict() + * self.variable_display_width = dict() # <<<<<<<<<<<<<< + * self.variable_alignment = dict() + * self.variable_measure = dict() */ - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->variable_display_width); + __Pyx_DECREF(__pyx_v_self->variable_display_width); + __pyx_v_self->variable_display_width = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":406 - * dc.table_name = table - * - * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< - * - * cdef int handle_variable(int index, readstat_variable_t *variable, + /* "pyreadstat/_readstat_parser.pyx":112 + * self.variable_storage_width = dict() + * self.variable_display_width = dict() + * self.variable_alignment = dict() # <<<<<<<<<<<<<< + * self.variable_measure = dict() + * self.no_datetime_conversion = 0 */ - __pyx_r = READSTAT_HANDLER_OK; - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->variable_alignment); + __Pyx_DECREF(__pyx_v_self->variable_alignment); + __pyx_v_self->variable_alignment = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":351 + /* "pyreadstat/_readstat_parser.pyx":113 + * self.variable_display_width = dict() + * self.variable_alignment = dict() + * self.variable_measure = dict() # <<<<<<<<<<<<<< + * self.no_datetime_conversion = 0 * + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->variable_measure); + __Pyx_DECREF(__pyx_v_self->variable_measure); + __pyx_v_self->variable_measure = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pyreadstat/_readstat_parser.pyx":114 + * self.variable_alignment = dict() + * self.variable_measure = dict() + * self.no_datetime_conversion = 0 # <<<<<<<<<<<<<< * - * cdef int handle_metadata(readstat_metadata_t *metadata, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * class metadata_container: + */ + __pyx_v_self->no_datetime_conversion = 0; + + /* "pyreadstat/_readstat_parser.pyx":80 * """ - * This function sets the number of observations(rows), number of variables + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.n_obs = 0 + * self.n_vars = 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_AddTraceback("pyreadstat._readstat_parser.handle_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = READSTAT_HANDLER_ABORT; + __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_dc); - __Pyx_XDECREF(__pyx_v_flabel); - __Pyx_XDECREF(__pyx_v_fencoding); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":408 - * return READSTAT_HANDLER_OK - * - * cdef int handle_variable(int index, readstat_variable_t *variable, # <<<<<<<<<<<<<< - * char *val_labels, void *ctx) except READSTAT_HANDLER_ABORT: - * """ +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ -static int __pyx_f_10pyreadstat_16_readstat_parser_handle_variable(int __pyx_v_index, readstat_variable_t *__pyx_v_variable, char *__pyx_v_val_labels, void *__pyx_v_ctx) { - char *__pyx_v_var_name; - char *__pyx_v_var_label; - char *__pyx_v_var_format; - PyObject *__pyx_v_col_name = 0; - PyObject *__pyx_v_col_label = 0; - PyObject *__pyx_v_label_name = 0; - PyObject *__pyx_v_col_format_original = 0; - __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_col_format_final; - readstat_type_t __pyx_v_var_type; - __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; - int __pyx_v_n_ranges; - readstat_value_t __pyx_v_loval; - readstat_value_t __pyx_v_hival; - PyObject *__pyx_v_pyloval = 0; - PyObject *__pyx_v_pyhival = 0; - PyObject *__pyx_v_missing_ranges = 0; - PyObject *__pyx_v_curnptype = 0; - PyObject *__pyx_v_row = 0; - int __pyx_v_metaonly; - int __pyx_v_obs_count; - int __pyx_v_iscurnptypefloat; - int __pyx_v_iscurnptypeobject; - PyObject *__pyx_v_newcolname = 0; - int __pyx_v_dupcolcnt; - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; - PyObject *__pyx_v_msg = NULL; - long __pyx_v_i; - size_t __pyx_v_storage_width; - readstat_alignment_t __pyx_v_align; - PyObject *__pyx_v_pyalign = 0; - readstat_measure_t __pyx_v_measure; - PyObject *__pyx_v_pymeasure = 0; - int __pyx_r; +/* Python wrapper */ +static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + if (unlikely(__pyx_nargs > 0)) { + __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_14data_container_2__reduce_cython__(((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_14data_container_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self) { + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_t_10; - int __pyx_t_11; - long __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle_variable", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "pyreadstat/_readstat_parser.pyx":437 - * cdef int dupcolcnt - * - * cdef data_container dc = ctx # <<<<<<<<<<<<<< - * - * # get variable name, label, format and type and put into our data container + /* "(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 = ((PyObject *)__pyx_v_ctx); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 2, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":440 - * - * # get variable name, label, format and type and put into our data container - * var_name = readstat_variable_get_name(variable) # <<<<<<<<<<<<<< - * if var_name == NULL: - * col_name = None + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): */ - __pyx_v_var_name = readstat_variable_get_name(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":441 - * # get variable name, label, format and type and put into our data container - * var_name = readstat_variable_get_name(variable) - * if var_name == NULL: # <<<<<<<<<<<<<< - * col_name = None - * else: - */ - __pyx_t_2 = ((__pyx_v_var_name == NULL) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":442 - * var_name = readstat_variable_get_name(variable) - * if var_name == NULL: - * col_name = None # <<<<<<<<<<<<<< - * else: - * col_name = var_name +/* "(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_INCREF(Py_None); - __pyx_v_col_name = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":441 - * # get variable name, label, format and type and put into our data container - * var_name = readstat_variable_get_name(variable) - * if var_name == NULL: # <<<<<<<<<<<<<< - * col_name = None - * else: - */ - goto __pyx_L3; +/* Python wrapper */ +static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__(PyObject *__pyx_v_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v___pyx_state = values[0]; } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_14data_container_4__setstate_cython__(((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_v_self), __pyx_v___pyx_state); - /* "pyreadstat/_readstat_parser.pyx":444 - * col_name = None - * else: - * col_name = var_name # <<<<<<<<<<<<<< - * - * # if the user introduced a list of columns to include, continue only if the column is in the list - */ - /*else*/ { - __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_var_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_col_name = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - } - __pyx_L3:; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":447 - * - * # if the user introduced a list of columns to include, continue only if the column is in the list - * if dc.filter_cols and not (col_name in dc.use_cols): # <<<<<<<<<<<<<< - * dc.n_vars -= 1 - * return READSTAT_HANDLER_SKIP_VARIABLE - */ - __pyx_t_4 = (__pyx_v_dc->filter_cols != 0); - if (__pyx_t_4) { - } else { - __pyx_t_2 = __pyx_t_4; - goto __pyx_L5_bool_binop_done; - } - __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_name, __pyx_v_dc->use_cols, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 447, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L5_bool_binop_done:; - if (__pyx_t_2) { +static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_14data_container_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "pyreadstat/_readstat_parser.pyx":448 - * # if the user introduced a list of columns to include, continue only if the column is in the list - * if dc.filter_cols and not (col_name in dc.use_cols): - * dc.n_vars -= 1 # <<<<<<<<<<<<<< - * return READSTAT_HANDLER_SKIP_VARIABLE - * + /* "(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_v_dc->n_vars = (__pyx_v_dc->n_vars - 1); + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":449 - * if dc.filter_cols and not (col_name in dc.use_cols): - * dc.n_vars -= 1 - * return READSTAT_HANDLER_SKIP_VARIABLE # <<<<<<<<<<<<<< - * - * index = readstat_variable_get_index_after_skipping(variable) + /* "(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_r = READSTAT_HANDLER_SKIP_VARIABLE; - goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":447 - * - * # if the user introduced a list of columns to include, continue only if the column is in the list - * if dc.filter_cols and not (col_name in dc.use_cols): # <<<<<<<<<<<<<< - * dc.n_vars -= 1 - * return READSTAT_HANDLER_SKIP_VARIABLE - */ - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":451 - * return READSTAT_HANDLER_SKIP_VARIABLE - * - * index = readstat_variable_get_index_after_skipping(variable) # <<<<<<<<<<<<<< - * - * if col_name in dc.col_names: +/* "pyreadstat/_readstat_parser.pyx":120 + * This class holds metadata we want to give back to python + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.column_names = list() + * self.column_labels = list() */ - __pyx_v_index = readstat_variable_get_index_after_skipping(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":453 - * index = readstat_variable_get_index_after_skipping(variable) - * - * if col_name in dc.col_names: # <<<<<<<<<<<<<< - * dupcolcnt = 1 - * while True: - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_name, __pyx_v_dc->col_names, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 453, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_2 != 0); - if (__pyx_t_5) { +/* Python wrapper */ +static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_18metadata_container_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_10pyreadstat_16_readstat_parser_18metadata_container_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_16_readstat_parser_18metadata_container_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10pyreadstat_16_readstat_parser_18metadata_container_1__init__(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_self = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 120, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_self = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 120, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyreadstat._readstat_parser.metadata_container.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_10pyreadstat_16_readstat_parser_18metadata_container___init__(__pyx_self, __pyx_v_self); - /* "pyreadstat/_readstat_parser.pyx":454 - * - * if col_name in dc.col_names: - * dupcolcnt = 1 # <<<<<<<<<<<<<< - * while True: - * newcolname = col_name + "_duplicated" + str(dupcolcnt) - */ - __pyx_v_dupcolcnt = 1; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":455 - * if col_name in dc.col_names: - * dupcolcnt = 1 - * while True: # <<<<<<<<<<<<<< - * newcolname = col_name + "_duplicated" + str(dupcolcnt) - * if newcolname in col_name: - */ - while (1) { +static PyObject *__pyx_pf_10pyreadstat_16_readstat_parser_18metadata_container___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__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("__init__", 0); - /* "pyreadstat/_readstat_parser.pyx":456 - * dupcolcnt = 1 - * while True: - * newcolname = col_name + "_duplicated" + str(dupcolcnt) # <<<<<<<<<<<<<< - * if newcolname in col_name: - * dupcolcnt += 1 + /* "pyreadstat/_readstat_parser.pyx":121 + * """ + * def __init__(self): + * self.column_names = list() # <<<<<<<<<<<<<< + * self.column_labels = list() + * self.column_names_to_labels = dict() */ - __pyx_t_3 = PyNumber_Add(__pyx_v_col_name, __pyx_n_s_duplicated); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dupcolcnt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_newcolname, ((PyObject*)__pyx_t_1)); - __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_column_names, __pyx_t_1) < 0) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":457 - * while True: - * newcolname = col_name + "_duplicated" + str(dupcolcnt) - * if newcolname in col_name: # <<<<<<<<<<<<<< - * dupcolcnt += 1 - * continue + /* "pyreadstat/_readstat_parser.pyx":122 + * def __init__(self): + * self.column_names = list() + * self.column_labels = list() # <<<<<<<<<<<<<< + * self.column_names_to_labels = dict() + * self.file_encoding = None */ - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_newcolname, __pyx_v_col_name, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_5 != 0); - if (__pyx_t_2) { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_column_labels, __pyx_t_1) < 0) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":458 - * newcolname = col_name + "_duplicated" + str(dupcolcnt) - * if newcolname in col_name: - * dupcolcnt += 1 # <<<<<<<<<<<<<< - * continue - * else: + /* "pyreadstat/_readstat_parser.pyx":123 + * self.column_names = list() + * self.column_labels = list() + * self.column_names_to_labels = dict() # <<<<<<<<<<<<<< + * self.file_encoding = None + * self.number_columns = None */ - __pyx_v_dupcolcnt = (__pyx_v_dupcolcnt + 1); + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_column_names_to_labels, __pyx_t_1) < 0) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":459 - * if newcolname in col_name: - * dupcolcnt += 1 - * continue # <<<<<<<<<<<<<< - * else: - * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) + /* "pyreadstat/_readstat_parser.pyx":124 + * self.column_labels = list() + * self.column_names_to_labels = dict() + * self.file_encoding = None # <<<<<<<<<<<<<< + * self.number_columns = None + * self.number_rows = None */ - goto __pyx_L8_continue; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_file_encoding, Py_None) < 0) __PYX_ERR(0, 124, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":457 - * while True: - * newcolname = col_name + "_duplicated" + str(dupcolcnt) - * if newcolname in col_name: # <<<<<<<<<<<<<< - * dupcolcnt += 1 - * continue + /* "pyreadstat/_readstat_parser.pyx":125 + * self.column_names_to_labels = dict() + * self.file_encoding = None + * self.number_columns = None # <<<<<<<<<<<<<< + * self.number_rows = None + * self.variable_value_labels = dict() */ - } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_number_columns, Py_None) < 0) __PYX_ERR(0, 125, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":461 - * continue - * else: - * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) # <<<<<<<<<<<<<< - * warnings.warn(msg) - * col_name = newcolname + /* "pyreadstat/_readstat_parser.pyx":126 + * self.file_encoding = None + * self.number_columns = None + * self.number_rows = None # <<<<<<<<<<<<<< + * self.variable_value_labels = dict() + * self.value_labels = dict() */ - /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_column_0_is_duplicated_renamed_t, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_col_name, __pyx_v_newcolname}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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_3, __pyx_v_col_name, __pyx_v_newcolname}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_col_name); - __Pyx_GIVEREF(__pyx_v_col_name); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_col_name); - __Pyx_INCREF(__pyx_v_newcolname); - __Pyx_GIVEREF(__pyx_v_newcolname); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_newcolname); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_msg = __pyx_t_1; - __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_number_rows, Py_None) < 0) __PYX_ERR(0, 126, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":462 - * else: - * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) - * warnings.warn(msg) # <<<<<<<<<<<<<< - * col_name = newcolname - * break + /* "pyreadstat/_readstat_parser.pyx":127 + * self.number_columns = None + * self.number_rows = None + * self.variable_value_labels = dict() # <<<<<<<<<<<<<< + * self.value_labels = dict() + * self.variable_to_label = dict() */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_warnings); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_warn); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 462, __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_8))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_6, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_value_labels, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":463 - * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) - * warnings.warn(msg) - * col_name = newcolname # <<<<<<<<<<<<<< - * break - * + /* "pyreadstat/_readstat_parser.pyx":128 + * self.number_rows = None + * self.variable_value_labels = dict() + * self.value_labels = dict() # <<<<<<<<<<<<<< + * self.variable_to_label = dict() + * self.notes = list() */ - __Pyx_INCREF(__pyx_v_newcolname); - __Pyx_DECREF_SET(__pyx_v_col_name, __pyx_v_newcolname); + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value_labels, __pyx_t_1) < 0) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":464 - * warnings.warn(msg) - * col_name = newcolname - * break # <<<<<<<<<<<<<< - * - * dc.col_names.append(col_name) + /* "pyreadstat/_readstat_parser.pyx":129 + * self.variable_value_labels = dict() + * self.value_labels = dict() + * self.variable_to_label = dict() # <<<<<<<<<<<<<< + * self.notes = list() + * self.original_variable_types = dict() */ - goto __pyx_L9_break; - } - __pyx_L8_continue:; - } - __pyx_L9_break:; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_to_label, __pyx_t_1) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":453 - * index = readstat_variable_get_index_after_skipping(variable) - * - * if col_name in dc.col_names: # <<<<<<<<<<<<<< - * dupcolcnt = 1 - * while True: + /* "pyreadstat/_readstat_parser.pyx":130 + * self.value_labels = dict() + * self.variable_to_label = dict() + * self.notes = list() # <<<<<<<<<<<<<< + * self.original_variable_types = dict() + * self.readstat_variable_types = dict() */ - } + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_notes, __pyx_t_1) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":466 - * break - * - * dc.col_names.append(col_name) # <<<<<<<<<<<<<< - * - * # the name of the value label for the variable + /* "pyreadstat/_readstat_parser.pyx":131 + * self.variable_to_label = dict() + * self.notes = list() + * self.original_variable_types = dict() # <<<<<<<<<<<<<< + * self.readstat_variable_types = dict() + * self.table_name = None */ - if (unlikely(__pyx_v_dc->col_names == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); - __PYX_ERR(0, 466, __pyx_L1_error) - } - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_dc->col_names, __pyx_v_col_name); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_original_variable_types, __pyx_t_1) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":469 - * - * # the name of the value label for the variable - * if val_labels != NULL: # <<<<<<<<<<<<<< - * label_name = val_labels - * if label_name: + /* "pyreadstat/_readstat_parser.pyx":132 + * self.notes = list() + * self.original_variable_types = dict() + * self.readstat_variable_types = dict() # <<<<<<<<<<<<<< + * self.table_name = None + * self.missing_ranges = dict() */ - __pyx_t_2 = ((__pyx_v_val_labels != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_readstat_variable_types, __pyx_t_1) < 0) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":470 - * # the name of the value label for the variable - * if val_labels != NULL: - * label_name = val_labels # <<<<<<<<<<<<<< - * if label_name: - * dc.label_to_var_name[col_name] = label_name + /* "pyreadstat/_readstat_parser.pyx":133 + * self.original_variable_types = dict() + * self.readstat_variable_types = dict() + * self.table_name = None # <<<<<<<<<<<<<< + * self.missing_ranges = dict() + * self.missing_user_values = dict() */ - __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_val_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_label_name = ((PyObject*)__pyx_t_8); - __pyx_t_8 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_table_name, Py_None) < 0) __PYX_ERR(0, 133, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":471 - * if val_labels != NULL: - * label_name = val_labels - * if label_name: # <<<<<<<<<<<<<< - * dc.label_to_var_name[col_name] = label_name - * + /* "pyreadstat/_readstat_parser.pyx":134 + * self.readstat_variable_types = dict() + * self.table_name = None + * self.missing_ranges = dict() # <<<<<<<<<<<<<< + * self.missing_user_values = dict() + * self.variable_storage_width = dict() */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_label_name); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 471, __pyx_L1_error) - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_missing_ranges, __pyx_t_1) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":472 - * label_name = val_labels - * if label_name: - * dc.label_to_var_name[col_name] = label_name # <<<<<<<<<<<<<< - * - * var_label = readstat_variable_get_label(variable) + /* "pyreadstat/_readstat_parser.pyx":135 + * self.table_name = None + * self.missing_ranges = dict() + * self.missing_user_values = dict() # <<<<<<<<<<<<<< + * self.variable_storage_width = dict() + * self.variable_display_width = dict() */ - if (unlikely(PyObject_SetItem(__pyx_v_dc->label_to_var_name, __pyx_v_col_name, __pyx_v_label_name) < 0)) __PYX_ERR(0, 472, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_missing_user_values, __pyx_t_1) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":471 - * if val_labels != NULL: - * label_name = val_labels - * if label_name: # <<<<<<<<<<<<<< - * dc.label_to_var_name[col_name] = label_name - * + /* "pyreadstat/_readstat_parser.pyx":136 + * self.missing_ranges = dict() + * self.missing_user_values = dict() + * self.variable_storage_width = dict() # <<<<<<<<<<<<<< + * self.variable_display_width = dict() + * self.variable_alignment = dict() */ - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_storage_width, __pyx_t_1) < 0) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":469 - * - * # the name of the value label for the variable - * if val_labels != NULL: # <<<<<<<<<<<<<< - * label_name = val_labels - * if label_name: + /* "pyreadstat/_readstat_parser.pyx":137 + * self.missing_user_values = dict() + * self.variable_storage_width = dict() + * self.variable_display_width = dict() # <<<<<<<<<<<<<< + * self.variable_alignment = dict() + * self.variable_measure = dict() */ - } + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_display_width, __pyx_t_1) < 0) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":474 - * dc.label_to_var_name[col_name] = label_name + /* "pyreadstat/_readstat_parser.pyx":138 + * self.variable_storage_width = dict() + * self.variable_display_width = dict() + * self.variable_alignment = dict() # <<<<<<<<<<<<<< + * self.variable_measure = dict() * - * var_label = readstat_variable_get_label(variable) # <<<<<<<<<<<<<< - * if var_label == NULL: - * col_label = None */ - __pyx_v_var_label = readstat_variable_get_label(__pyx_v_variable); + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_alignment, __pyx_t_1) < 0) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":475 + /* "pyreadstat/_readstat_parser.pyx":139 + * self.variable_display_width = dict() + * self.variable_alignment = dict() + * self.variable_measure = dict() # <<<<<<<<<<<<<< + * * - * var_label = readstat_variable_get_label(variable) - * if var_label == NULL: # <<<<<<<<<<<<<< - * col_label = None - * else: */ - __pyx_t_2 = ((__pyx_v_var_label == NULL) != 0); - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_variable_measure, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":476 - * var_label = readstat_variable_get_label(variable) - * if var_label == NULL: - * col_label = None # <<<<<<<<<<<<<< - * else: - * col_label = var_label + /* "pyreadstat/_readstat_parser.pyx":120 + * This class holds metadata we want to give back to python + * """ + * def __init__(self): # <<<<<<<<<<<<<< + * self.column_names = list() + * self.column_labels = list() */ - __Pyx_INCREF(Py_None); - __pyx_v_col_label = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":475 + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("pyreadstat._readstat_parser.metadata_container.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyreadstat/_readstat_parser.pyx":155 * - * var_label = readstat_variable_get_label(variable) - * if var_label == NULL: # <<<<<<<<<<<<<< - * col_label = None - * else: + * + * cdef py_datetime_format transform_variable_format(str var_format, py_file_format file_format): # <<<<<<<<<<<<<< + * """ + * Transforms a readstat var_format to a date, datetime or time format label */ - goto __pyx_L13; - } - /* "pyreadstat/_readstat_parser.pyx":478 - * col_label = None - * else: - * col_label = var_label # <<<<<<<<<<<<<< - * dc.col_labels.append(col_label) - * +static __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_f_10pyreadstat_16_readstat_parser_transform_variable_format(PyObject *__pyx_v_var_format, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format) { + __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("transform_variable_format", 0); + + /* "pyreadstat/_readstat_parser.pyx":159 + * Transforms a readstat var_format to a date, datetime or time format label + * """ + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * if var_format in sas_all_formats: + * if var_format in sas_date_formats: */ - /*else*/ { - __pyx_t_8 = __Pyx_PyStr_FromString(__pyx_v_var_label); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 478, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __pyx_t_8; - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_col_label = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - } - __pyx_L13:; + switch (__pyx_v_file_format) { + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: - /* "pyreadstat/_readstat_parser.pyx":479 - * else: - * col_label = var_label - * dc.col_labels.append(col_label) # <<<<<<<<<<<<<< - * - * # format, we have to transform it in something more usable + /* "pyreadstat/_readstat_parser.pyx":160 + * """ + * if file_format == FILE_FORMAT_SAS: + * if var_format in sas_all_formats: # <<<<<<<<<<<<<< + * if var_format in sas_date_formats: + * return DATE_FORMAT_DATE */ - if (unlikely(__pyx_v_dc->col_labels == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); - __PYX_ERR(0, 479, __pyx_L1_error) - } - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_dc->col_labels, __pyx_v_col_label); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_all_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 160, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":482 - * - * # format, we have to transform it in something more usable - * var_format = readstat_variable_get_format(variable) # <<<<<<<<<<<<<< - * if var_format == NULL: - * col_format_original = "NULL" + /* "pyreadstat/_readstat_parser.pyx":161 + * if file_format == FILE_FORMAT_SAS: + * if var_format in sas_all_formats: + * if var_format in sas_date_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATE + * elif var_format in sas_datetime_formats: */ - __pyx_v_var_format = readstat_variable_get_format(__pyx_v_variable); + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 161, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":483 - * # format, we have to transform it in something more usable - * var_format = readstat_variable_get_format(variable) - * if var_format == NULL: # <<<<<<<<<<<<<< - * col_format_original = "NULL" - * else: + /* "pyreadstat/_readstat_parser.pyx":162 + * if var_format in sas_all_formats: + * if var_format in sas_date_formats: + * return DATE_FORMAT_DATE # <<<<<<<<<<<<<< + * elif var_format in sas_datetime_formats: + * return DATE_FORMAT_DATETIME */ - __pyx_t_2 = ((__pyx_v_var_format == NULL) != 0); - if (__pyx_t_2) { + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":484 - * var_format = readstat_variable_get_format(variable) - * if var_format == NULL: - * col_format_original = "NULL" # <<<<<<<<<<<<<< - * else: - * col_format_original = var_format + /* "pyreadstat/_readstat_parser.pyx":161 + * if file_format == FILE_FORMAT_SAS: + * if var_format in sas_all_formats: + * if var_format in sas_date_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATE + * elif var_format in sas_datetime_formats: */ - __Pyx_INCREF(__pyx_n_s_NULL); - __pyx_v_col_format_original = __pyx_n_s_NULL; + } - /* "pyreadstat/_readstat_parser.pyx":483 - * # format, we have to transform it in something more usable - * var_format = readstat_variable_get_format(variable) - * if var_format == NULL: # <<<<<<<<<<<<<< - * col_format_original = "NULL" - * else: + /* "pyreadstat/_readstat_parser.pyx":163 + * if var_format in sas_date_formats: + * return DATE_FORMAT_DATE + * elif var_format in sas_datetime_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATETIME + * elif var_format in sas_time_formats: */ - goto __pyx_L14; - } + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 163, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":486 - * col_format_original = "NULL" - * else: - * col_format_original = var_format # <<<<<<<<<<<<<< - * file_format = dc.file_format - * dc.col_formats_original.append(col_format_original) + /* "pyreadstat/_readstat_parser.pyx":164 + * return DATE_FORMAT_DATE + * elif var_format in sas_datetime_formats: + * return DATE_FORMAT_DATETIME # <<<<<<<<<<<<<< + * elif var_format in sas_time_formats: + * return DATE_FORMAT_TIME */ - /*else*/ { - __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_var_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_col_format_original = ((PyObject*)__pyx_t_8); - __pyx_t_8 = 0; - } - __pyx_L14:; + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":487 - * else: - * col_format_original = var_format - * file_format = dc.file_format # <<<<<<<<<<<<<< - * dc.col_formats_original.append(col_format_original) - * col_format_final = transform_variable_format(col_format_original, file_format) + /* "pyreadstat/_readstat_parser.pyx":163 + * if var_format in sas_date_formats: + * return DATE_FORMAT_DATE + * elif var_format in sas_datetime_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATETIME + * elif var_format in sas_time_formats: */ - __pyx_t_10 = __pyx_v_dc->file_format; - __pyx_v_file_format = __pyx_t_10; + } - /* "pyreadstat/_readstat_parser.pyx":488 - * col_format_original = var_format - * file_format = dc.file_format - * dc.col_formats_original.append(col_format_original) # <<<<<<<<<<<<<< - * col_format_final = transform_variable_format(col_format_original, file_format) - * dc.col_formats.append(col_format_final) + /* "pyreadstat/_readstat_parser.pyx":165 + * elif var_format in sas_datetime_formats: + * return DATE_FORMAT_DATETIME + * elif var_format in sas_time_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_TIME + * else: */ - if (unlikely(__pyx_v_dc->col_formats_original == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); - __PYX_ERR(0, 488, __pyx_L1_error) - } - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_dc->col_formats_original, __pyx_v_col_format_original); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_sas_time_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 165, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":489 - * file_format = dc.file_format - * dc.col_formats_original.append(col_format_original) - * col_format_final = transform_variable_format(col_format_original, file_format) # <<<<<<<<<<<<<< - * dc.col_formats.append(col_format_final) - * # readstat type + /* "pyreadstat/_readstat_parser.pyx":166 + * return DATE_FORMAT_DATETIME + * elif var_format in sas_time_formats: + * return DATE_FORMAT_TIME # <<<<<<<<<<<<<< + * else: + * return DATE_FORMAT_NOTADATE */ - __pyx_v_col_format_final = __pyx_f_10pyreadstat_16_readstat_parser_transform_variable_format(__pyx_v_col_format_original, __pyx_v_file_format); + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":490 - * dc.col_formats_original.append(col_format_original) - * col_format_final = transform_variable_format(col_format_original, file_format) - * dc.col_formats.append(col_format_final) # <<<<<<<<<<<<<< - * # readstat type - * var_type = readstat_variable_get_type(variable) + /* "pyreadstat/_readstat_parser.pyx":165 + * elif var_format in sas_datetime_formats: + * return DATE_FORMAT_DATETIME + * elif var_format in sas_time_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_TIME + * else: */ - if (unlikely(__pyx_v_dc->col_formats == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); - __PYX_ERR(0, 490, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format(__pyx_v_col_format_final); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_dc->col_formats, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } - /* "pyreadstat/_readstat_parser.pyx":492 - * dc.col_formats.append(col_format_final) - * # readstat type - * var_type = readstat_variable_get_type(variable) # <<<<<<<<<<<<<< - * dc.col_dtypes.append(var_type) - * # equivalent numpy type + /* "pyreadstat/_readstat_parser.pyx":160 + * """ + * if file_format == FILE_FORMAT_SAS: + * if var_format in sas_all_formats: # <<<<<<<<<<<<<< + * if var_format in sas_date_formats: + * return DATE_FORMAT_DATE */ - __pyx_v_var_type = readstat_variable_get_type(__pyx_v_variable); + goto __pyx_L3; + } - /* "pyreadstat/_readstat_parser.pyx":493 - * # readstat type - * var_type = readstat_variable_get_type(variable) - * dc.col_dtypes.append(var_type) # <<<<<<<<<<<<<< - * # equivalent numpy type - * # if it's a date then we need object + /* "pyreadstat/_readstat_parser.pyx":168 + * return DATE_FORMAT_TIME + * else: + * return DATE_FORMAT_NOTADATE # <<<<<<<<<<<<<< + * + * elif file_format == FILE_FORMAT_SPSS: */ - if (unlikely(__pyx_v_dc->col_dtypes == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); - __PYX_ERR(0, 493, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_PyInt_From_readstat_type_t(__pyx_v_var_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_dc->col_dtypes, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + /*else*/ { + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE; + goto __pyx_L0; + } + __pyx_L3:; - /* "pyreadstat/_readstat_parser.pyx":496 - * # equivalent numpy type - * # if it's a date then we need object - * if col_format_final != DATE_FORMAT_NOTADATE and dc.no_datetime_conversion == 0: # <<<<<<<<<<<<<< - * curnptype = object - * else: + /* "pyreadstat/_readstat_parser.pyx":159 + * Transforms a readstat var_format to a date, datetime or time format label + * """ + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * if var_format in sas_all_formats: + * if var_format in sas_date_formats: */ - __pyx_t_5 = ((__pyx_v_col_format_final != __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE) != 0); - if (__pyx_t_5) { - } else { - __pyx_t_2 = __pyx_t_5; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_5 = ((__pyx_v_dc->no_datetime_conversion == 0) != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L16_bool_binop_done:; - if (__pyx_t_2) { + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: - /* "pyreadstat/_readstat_parser.pyx":497 - * # if it's a date then we need object - * if col_format_final != DATE_FORMAT_NOTADATE and dc.no_datetime_conversion == 0: - * curnptype = object # <<<<<<<<<<<<<< - * else: - * curnptype = readstat_to_numpy_types[var_type] + /* "pyreadstat/_readstat_parser.pyx":171 + * + * elif file_format == FILE_FORMAT_SPSS: + * if var_format in spss_all_formats: # <<<<<<<<<<<<<< + * if var_format in spss_date_formats: + * return DATE_FORMAT_DATE */ - __Pyx_INCREF(__pyx_builtin_object); - __pyx_v_curnptype = __pyx_builtin_object; + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_all_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 171, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":496 - * # equivalent numpy type - * # if it's a date then we need object - * if col_format_final != DATE_FORMAT_NOTADATE and dc.no_datetime_conversion == 0: # <<<<<<<<<<<<<< - * curnptype = object - * else: + /* "pyreadstat/_readstat_parser.pyx":172 + * elif file_format == FILE_FORMAT_SPSS: + * if var_format in spss_all_formats: + * if var_format in spss_date_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATE + * elif var_format in spss_datetime_formats: */ - goto __pyx_L15; - } + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 172, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":499 - * curnptype = object - * else: - * curnptype = readstat_to_numpy_types[var_type] # <<<<<<<<<<<<<< - * iscurnptypefloat = 0 - * iscurnptypeobject = 0 + /* "pyreadstat/_readstat_parser.pyx":173 + * if var_format in spss_all_formats: + * if var_format in spss_date_formats: + * return DATE_FORMAT_DATE # <<<<<<<<<<<<<< + * elif var_format in spss_datetime_formats: + * return DATE_FORMAT_DATETIME */ - /*else*/ { - if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 499, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_PyInt_From_readstat_type_t(__pyx_v_var_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_curnptype = __pyx_t_1; - __pyx_t_1 = 0; - } - __pyx_L15:; + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":500 - * else: - * curnptype = readstat_to_numpy_types[var_type] - * iscurnptypefloat = 0 # <<<<<<<<<<<<<< - * iscurnptypeobject = 0 - * # book keeping numpy types + /* "pyreadstat/_readstat_parser.pyx":172 + * elif file_format == FILE_FORMAT_SPSS: + * if var_format in spss_all_formats: + * if var_format in spss_date_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATE + * elif var_format in spss_datetime_formats: */ - __pyx_v_iscurnptypefloat = 0; + } - /* "pyreadstat/_readstat_parser.pyx":501 - * curnptype = readstat_to_numpy_types[var_type] - * iscurnptypefloat = 0 - * iscurnptypeobject = 0 # <<<<<<<<<<<<<< - * # book keeping numpy types - * dc.col_numpy_dtypes[index] = curnptype + /* "pyreadstat/_readstat_parser.pyx":174 + * if var_format in spss_date_formats: + * return DATE_FORMAT_DATE + * elif var_format in spss_datetime_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATETIME + * elif var_format in spss_time_formats: */ - __pyx_v_iscurnptypeobject = 0; + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 174, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":503 - * iscurnptypeobject = 0 - * # book keeping numpy types - * dc.col_numpy_dtypes[index] = curnptype # <<<<<<<<<<<<<< - * if curnptype == object: - * iscurnptypeobject = 1 + /* "pyreadstat/_readstat_parser.pyx":175 + * return DATE_FORMAT_DATE + * elif var_format in spss_datetime_formats: + * return DATE_FORMAT_DATETIME # <<<<<<<<<<<<<< + * elif var_format in spss_time_formats: + * return DATE_FORMAT_TIME */ - if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 503, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, __pyx_v_curnptype, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 503, __pyx_L1_error) + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":504 - * # book keeping numpy types - * dc.col_numpy_dtypes[index] = curnptype - * if curnptype == object: # <<<<<<<<<<<<<< - * iscurnptypeobject = 1 - * if curnptype == np.float64: + /* "pyreadstat/_readstat_parser.pyx":174 + * if var_format in spss_date_formats: + * return DATE_FORMAT_DATE + * elif var_format in spss_datetime_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATETIME + * elif var_format in spss_time_formats: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_curnptype, __pyx_builtin_object, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 504, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + } - /* "pyreadstat/_readstat_parser.pyx":505 - * dc.col_numpy_dtypes[index] = curnptype - * if curnptype == object: - * iscurnptypeobject = 1 # <<<<<<<<<<<<<< - * if curnptype == np.float64: - * iscurnptypefloat = 1 + /* "pyreadstat/_readstat_parser.pyx":176 + * elif var_format in spss_datetime_formats: + * return DATE_FORMAT_DATETIME + * elif var_format in spss_time_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_TIME + * else: */ - __pyx_v_iscurnptypeobject = 1; + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_spss_time_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 176, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":504 - * # book keeping numpy types - * dc.col_numpy_dtypes[index] = curnptype - * if curnptype == object: # <<<<<<<<<<<<<< - * iscurnptypeobject = 1 - * if curnptype == np.float64: + /* "pyreadstat/_readstat_parser.pyx":177 + * return DATE_FORMAT_DATETIME + * elif var_format in spss_time_formats: + * return DATE_FORMAT_TIME # <<<<<<<<<<<<<< + * else: + * return DATE_FORMAT_NOTADATE */ - } + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":506 - * if curnptype == object: - * iscurnptypeobject = 1 - * if curnptype == np.float64: # <<<<<<<<<<<<<< - * iscurnptypefloat = 1 - * dc.col_dtypes_isobject[index] = iscurnptypeobject + /* "pyreadstat/_readstat_parser.pyx":176 + * elif var_format in spss_datetime_formats: + * return DATE_FORMAT_DATETIME + * elif var_format in spss_time_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_TIME + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_curnptype, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 506, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + } - /* "pyreadstat/_readstat_parser.pyx":507 - * iscurnptypeobject = 1 - * if curnptype == np.float64: - * iscurnptypefloat = 1 # <<<<<<<<<<<<<< - * dc.col_dtypes_isobject[index] = iscurnptypeobject - * dc.col_dytpes_isfloat[index] = iscurnptypefloat + /* "pyreadstat/_readstat_parser.pyx":171 + * + * elif file_format == FILE_FORMAT_SPSS: + * if var_format in spss_all_formats: # <<<<<<<<<<<<<< + * if var_format in spss_date_formats: + * return DATE_FORMAT_DATE */ - __pyx_v_iscurnptypefloat = 1; + goto __pyx_L5; + } - /* "pyreadstat/_readstat_parser.pyx":506 - * if curnptype == object: - * iscurnptypeobject = 1 - * if curnptype == np.float64: # <<<<<<<<<<<<<< - * iscurnptypefloat = 1 - * dc.col_dtypes_isobject[index] = iscurnptypeobject + /* "pyreadstat/_readstat_parser.pyx":179 + * return DATE_FORMAT_TIME + * else: + * return DATE_FORMAT_NOTADATE # <<<<<<<<<<<<<< + * + * elif file_format == FILE_FORMAT_STATA: */ - } + /*else*/ { + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE; + goto __pyx_L0; + } + __pyx_L5:; - /* "pyreadstat/_readstat_parser.pyx":508 - * if curnptype == np.float64: - * iscurnptypefloat = 1 - * dc.col_dtypes_isobject[index] = iscurnptypeobject # <<<<<<<<<<<<<< - * dc.col_dytpes_isfloat[index] = iscurnptypefloat - * metaonly = dc.metaonly + /* "pyreadstat/_readstat_parser.pyx":170 + * return DATE_FORMAT_NOTADATE + * + * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< + * if var_format in spss_all_formats: + * if var_format in spss_date_formats: */ - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_iscurnptypeobject); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 508, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: - /* "pyreadstat/_readstat_parser.pyx":509 - * iscurnptypefloat = 1 - * dc.col_dtypes_isobject[index] = iscurnptypeobject - * dc.col_dytpes_isfloat[index] = iscurnptypefloat # <<<<<<<<<<<<<< - * metaonly = dc.metaonly - * # pre-allocate data + /* "pyreadstat/_readstat_parser.pyx":182 + * + * elif file_format == FILE_FORMAT_STATA: + * if var_format in stata_all_formats: # <<<<<<<<<<<<<< + * if var_format in stata_date_formats: + * return DATE_FORMAT_DATE */ - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_iscurnptypefloat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__pyx_v_dc->col_dytpes_isfloat == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 509, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_dytpes_isfloat, __pyx_v_index, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 509, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_all_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 182, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":510 - * dc.col_dtypes_isobject[index] = iscurnptypeobject - * dc.col_dytpes_isfloat[index] = iscurnptypefloat - * metaonly = dc.metaonly # <<<<<<<<<<<<<< - * # pre-allocate data - * if metaonly: + /* "pyreadstat/_readstat_parser.pyx":183 + * elif file_format == FILE_FORMAT_STATA: + * if var_format in stata_all_formats: + * if var_format in stata_date_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATE + * elif var_format in stata_datetime_formats: */ - __pyx_t_2 = __pyx_v_dc->metaonly; - __pyx_v_metaonly = __pyx_t_2; + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 183, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":512 - * metaonly = dc.metaonly - * # pre-allocate data - * if metaonly: # <<<<<<<<<<<<<< - * row = np.empty(1, dtype=curnptype) - * else: + /* "pyreadstat/_readstat_parser.pyx":184 + * if var_format in stata_all_formats: + * if var_format in stata_date_formats: + * return DATE_FORMAT_DATE # <<<<<<<<<<<<<< + * elif var_format in stata_datetime_formats: + * return DATE_FORMAT_DATETIME */ - __pyx_t_2 = (__pyx_v_metaonly != 0); - if (__pyx_t_2) { + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":513 - * # pre-allocate data - * if metaonly: - * row = np.empty(1, dtype=curnptype) # <<<<<<<<<<<<<< - * else: - * obs_count = dc.n_obs + /* "pyreadstat/_readstat_parser.pyx":183 + * elif file_format == FILE_FORMAT_STATA: + * if var_format in stata_all_formats: + * if var_format in stata_date_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATE + * elif var_format in stata_datetime_formats: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_curnptype) < 0) __PYX_ERR(0, 513, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__4, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 513, __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_v_row = __pyx_t_6; - __pyx_t_6 = 0; + } - /* "pyreadstat/_readstat_parser.pyx":512 - * metaonly = dc.metaonly - * # pre-allocate data - * if metaonly: # <<<<<<<<<<<<<< - * row = np.empty(1, dtype=curnptype) - * else: + /* "pyreadstat/_readstat_parser.pyx":185 + * if var_format in stata_date_formats: + * return DATE_FORMAT_DATE + * elif var_format in stata_datetime_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATETIME + * elif var_format in stata_time_formats: */ - goto __pyx_L20; - } + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 185, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":515 - * row = np.empty(1, dtype=curnptype) - * else: - * obs_count = dc.n_obs # <<<<<<<<<<<<<< - * row = np.empty(obs_count, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: + /* "pyreadstat/_readstat_parser.pyx":186 + * return DATE_FORMAT_DATE + * elif var_format in stata_datetime_formats: + * return DATE_FORMAT_DATETIME # <<<<<<<<<<<<<< + * elif var_format in stata_time_formats: + * return DATE_FORMAT_TIME */ - /*else*/ { - __pyx_t_7 = __pyx_v_dc->n_obs; - __pyx_v_obs_count = __pyx_t_7; + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":516 - * else: - * obs_count = dc.n_obs - * row = np.empty(obs_count, dtype=curnptype) # <<<<<<<<<<<<<< - * if iscurnptypeobject or iscurnptypefloat: - * row.fill(np.nan) + /* "pyreadstat/_readstat_parser.pyx":185 + * if var_format in stata_date_formats: + * return DATE_FORMAT_DATE + * elif var_format in stata_datetime_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_DATETIME + * elif var_format in stata_time_formats: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_obs_count); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_v_curnptype) < 0) __PYX_ERR(0, 516, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_row = __pyx_t_3; - __pyx_t_3 = 0; + } - /* "pyreadstat/_readstat_parser.pyx":517 - * obs_count = dc.n_obs - * row = np.empty(obs_count, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< - * row.fill(np.nan) - * dc.col_data.append(row) + /* "pyreadstat/_readstat_parser.pyx":187 + * elif var_format in stata_datetime_formats: + * return DATE_FORMAT_DATETIME + * elif var_format in stata_time_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_TIME + * else: */ - __pyx_t_5 = (__pyx_v_iscurnptypeobject != 0); - if (!__pyx_t_5) { - } else { - __pyx_t_2 = __pyx_t_5; - goto __pyx_L22_bool_binop_done; - } - __pyx_t_5 = (__pyx_v_iscurnptypefloat != 0); - __pyx_t_2 = __pyx_t_5; - __pyx_L22_bool_binop_done:; - if (__pyx_t_2) { + __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_format, __pyx_v_10pyreadstat_16_readstat_parser_stata_time_formats, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 187, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":518 - * row = np.empty(obs_count, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: - * row.fill(np.nan) # <<<<<<<<<<<<<< - * dc.col_data.append(row) - * + /* "pyreadstat/_readstat_parser.pyx":188 + * return DATE_FORMAT_DATETIME + * elif var_format in stata_time_formats: + * return DATE_FORMAT_TIME # <<<<<<<<<<<<<< + * else: + * return DATE_FORMAT_NOTADATE + */ + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME; + goto __pyx_L0; + + /* "pyreadstat/_readstat_parser.pyx":187 + * elif var_format in stata_datetime_formats: + * return DATE_FORMAT_DATETIME + * elif var_format in stata_time_formats: # <<<<<<<<<<<<<< + * return DATE_FORMAT_TIME + * else: */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_fill); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 518, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_nan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(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_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":517 - * obs_count = dc.n_obs - * row = np.empty(obs_count, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< - * row.fill(np.nan) - * dc.col_data.append(row) + /* "pyreadstat/_readstat_parser.pyx":182 + * + * elif file_format == FILE_FORMAT_STATA: + * if var_format in stata_all_formats: # <<<<<<<<<<<<<< + * if var_format in stata_date_formats: + * return DATE_FORMAT_DATE */ + goto __pyx_L7; } - } - __pyx_L20:; - /* "pyreadstat/_readstat_parser.pyx":519 - * if iscurnptypeobject or iscurnptypefloat: - * row.fill(np.nan) - * dc.col_data.append(row) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":190 + * return DATE_FORMAT_TIME + * else: + * return DATE_FORMAT_NOTADATE # <<<<<<<<<<<<<< * - * # missing values + * cdef object transform_datetime(py_datetime_format var_format, double tstamp, py_file_format file_format, object origin, bint dates_as_pandas): */ - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); - __PYX_ERR(0, 519, __pyx_L1_error) - } - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_dc->col_data, __pyx_v_row); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 519, __pyx_L1_error) + /*else*/ { + __pyx_r = __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE; + goto __pyx_L0; + } + __pyx_L7:; - /* "pyreadstat/_readstat_parser.pyx":522 + /* "pyreadstat/_readstat_parser.pyx":181 + * return DATE_FORMAT_NOTADATE * - * # missing values - * if dc.usernan: # <<<<<<<<<<<<<< - * n_ranges = readstat_variable_get_missing_ranges_count(variable) - * if n_ranges>0: + * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * if var_format in stata_all_formats: + * if var_format in stata_date_formats: */ - __pyx_t_2 = (__pyx_v_dc->usernan != 0); - if (__pyx_t_2) { + break; + default: break; + } - /* "pyreadstat/_readstat_parser.pyx":523 - * # missing values - * if dc.usernan: - * n_ranges = readstat_variable_get_missing_ranges_count(variable) # <<<<<<<<<<<<<< - * if n_ranges>0: - * missing_ranges = list() + /* "pyreadstat/_readstat_parser.pyx":155 + * + * + * cdef py_datetime_format transform_variable_format(str var_format, py_file_format file_format): # <<<<<<<<<<<<<< + * """ + * Transforms a readstat var_format to a date, datetime or time format label */ - __pyx_v_n_ranges = readstat_variable_get_missing_ranges_count(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":524 - * if dc.usernan: - * n_ranges = readstat_variable_get_missing_ranges_count(variable) - * if n_ranges>0: # <<<<<<<<<<<<<< - * missing_ranges = list() - * for i in range(0, n_ranges): - */ - __pyx_t_2 = ((__pyx_v_n_ranges > 0) != 0); - if (__pyx_t_2) { + /* function exit code */ + __pyx_r = (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pyreadstat._readstat_parser.transform_variable_format", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":525 - * n_ranges = readstat_variable_get_missing_ranges_count(variable) - * if n_ranges>0: - * missing_ranges = list() # <<<<<<<<<<<<<< - * for i in range(0, n_ranges): - * loval = readstat_variable_get_missing_range_lo(variable, i) +/* "pyreadstat/_readstat_parser.pyx":192 + * return DATE_FORMAT_NOTADATE + * + * cdef object transform_datetime(py_datetime_format var_format, double tstamp, py_file_format file_format, object origin, bint dates_as_pandas): # <<<<<<<<<<<<<< + * """ + * Transforms a tstamp integer value to a date, time or datetime pyton object. */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_missing_ranges = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":526 - * if n_ranges>0: - * missing_ranges = list() - * for i in range(0, n_ranges): # <<<<<<<<<<<<<< - * loval = readstat_variable_get_missing_range_lo(variable, i) - * pyloval = convert_readstat_to_python_value(loval, index, dc) - */ - __pyx_t_7 = __pyx_v_n_ranges; - __pyx_t_11 = __pyx_t_7; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_i = __pyx_t_12; +static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_transform_datetime(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_var_format, double __pyx_v_tstamp, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format, PyObject *__pyx_v_origin, int __pyx_v_dates_as_pandas) { + PyObject *__pyx_v_tdelta = 0; + int __pyx_v_days; + int __pyx_v_secs; + double __pyx_v_msecs; + int __pyx_v_usecs; + PyObject *__pyx_v_mydat = 0; + 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("transform_datetime", 0); - /* "pyreadstat/_readstat_parser.pyx":527 - * missing_ranges = list() - * for i in range(0, n_ranges): - * loval = readstat_variable_get_missing_range_lo(variable, i) # <<<<<<<<<<<<<< - * pyloval = convert_readstat_to_python_value(loval, index, dc) - * hival = readstat_variable_get_missing_range_hi(variable, i) + /* "pyreadstat/_readstat_parser.pyx":205 + * cdef object mydat + * + * if var_format == DATE_FORMAT_DATE: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_SPSS: + * # tstamp is in seconds */ - __pyx_v_loval = readstat_variable_get_missing_range_lo(__pyx_v_variable, __pyx_v_i); + switch (__pyx_v_var_format) { + case __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATE: - /* "pyreadstat/_readstat_parser.pyx":528 - * for i in range(0, n_ranges): - * loval = readstat_variable_get_missing_range_lo(variable, i) - * pyloval = convert_readstat_to_python_value(loval, index, dc) # <<<<<<<<<<<<<< - * hival = readstat_variable_get_missing_range_hi(variable, i) - * pyhival = convert_readstat_to_python_value(hival, index, dc) + /* "pyreadstat/_readstat_parser.pyx":206 + * + * if var_format == DATE_FORMAT_DATE: + * if file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< + * # tstamp is in seconds + * days = (floor(tstamp / 86400)) */ - __pyx_t_3 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_loval, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_pyloval, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS); + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":529 - * loval = readstat_variable_get_missing_range_lo(variable, i) - * pyloval = convert_readstat_to_python_value(loval, index, dc) - * hival = readstat_variable_get_missing_range_hi(variable, i) # <<<<<<<<<<<<<< - * pyhival = convert_readstat_to_python_value(hival, index, dc) - * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) + /* "pyreadstat/_readstat_parser.pyx":208 + * if file_format == FILE_FORMAT_SPSS: + * # tstamp is in seconds + * days = (floor(tstamp / 86400)) # <<<<<<<<<<<<<< + * secs = (tstamp % 86400) + * tdelta = timedelta_new(days, secs, 0) */ - __pyx_v_hival = readstat_variable_get_missing_range_hi(__pyx_v_variable, __pyx_v_i); + __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400.0))); - /* "pyreadstat/_readstat_parser.pyx":530 - * pyloval = convert_readstat_to_python_value(loval, index, dc) - * hival = readstat_variable_get_missing_range_hi(variable, i) - * pyhival = convert_readstat_to_python_value(hival, index, dc) # <<<<<<<<<<<<<< - * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) - * dc.missing_ranges[col_name] = missing_ranges + /* "pyreadstat/_readstat_parser.pyx":209 + * # tstamp is in seconds + * days = (floor(tstamp / 86400)) + * secs = (tstamp % 86400) # <<<<<<<<<<<<<< + * tdelta = timedelta_new(days, secs, 0) + * #tdelta = timedelta(seconds=tstamp) */ - __pyx_t_3 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_hival, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_pyhival, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_secs = ((int)__Pyx_mod_double(__pyx_v_tstamp, 86400.0)); - /* "pyreadstat/_readstat_parser.pyx":531 - * hival = readstat_variable_get_missing_range_hi(variable, i) - * pyhival = convert_readstat_to_python_value(hival, index, dc) - * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) # <<<<<<<<<<<<<< - * dc.missing_ranges[col_name] = missing_ranges - * + /* "pyreadstat/_readstat_parser.pyx":210 + * days = (floor(tstamp / 86400)) + * secs = (tstamp % 86400) + * tdelta = timedelta_new(days, secs, 0) # <<<<<<<<<<<<<< + * #tdelta = timedelta(seconds=tstamp) + * else: */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_lo, __pyx_v_pyloval) < 0) __PYX_ERR(0, 531, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_hi, __pyx_v_pyhival) < 0) __PYX_ERR(0, 531, __pyx_L1_error) - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_missing_ranges, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } + __pyx_t_2 = ((PyObject *)__pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_tdelta = __pyx_t_2; + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":532 - * pyhival = convert_readstat_to_python_value(hival, index, dc) - * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) - * dc.missing_ranges[col_name] = missing_ranges # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":206 * - * cdef size_t storage_width - */ - if (unlikely(__pyx_v_dc->missing_ranges == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 532, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_dc->missing_ranges, __pyx_v_col_name, __pyx_v_missing_ranges) < 0)) __PYX_ERR(0, 532, __pyx_L1_error) - - /* "pyreadstat/_readstat_parser.pyx":524 - * if dc.usernan: - * n_ranges = readstat_variable_get_missing_ranges_count(variable) - * if n_ranges>0: # <<<<<<<<<<<<<< - * missing_ranges = list() - * for i in range(0, n_ranges): + * if var_format == DATE_FORMAT_DATE: + * if file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< + * # tstamp is in seconds + * days = (floor(tstamp / 86400)) */ + goto __pyx_L3; } - /* "pyreadstat/_readstat_parser.pyx":522 - * - * # missing values - * if dc.usernan: # <<<<<<<<<<<<<< - * n_ranges = readstat_variable_get_missing_ranges_count(variable) - * if n_ranges>0: + /* "pyreadstat/_readstat_parser.pyx":214 + * else: + * # tstamp is in days + * days = tstamp # <<<<<<<<<<<<<< + * tdelta = timedelta_new(days, 0, 0) + * #tdelta = timedelta(days=tstamp) */ - } + /*else*/ { + __pyx_v_days = ((int)__pyx_v_tstamp); - /* "pyreadstat/_readstat_parser.pyx":535 - * - * cdef size_t storage_width - * storage_width = readstat_variable_get_storage_width(variable) # <<<<<<<<<<<<<< - * dc.variable_storage_width[col_name] = storage_width - * + /* "pyreadstat/_readstat_parser.pyx":215 + * # tstamp is in days + * days = tstamp + * tdelta = timedelta_new(days, 0, 0) # <<<<<<<<<<<<<< + * #tdelta = timedelta(days=tstamp) + * mydat = origin + tdelta */ - __pyx_v_storage_width = readstat_variable_get_storage_width(__pyx_v_variable); + __pyx_t_2 = ((PyObject *)__pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, 0, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_tdelta = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L3:; - /* "pyreadstat/_readstat_parser.pyx":536 - * cdef size_t storage_width - * storage_width = readstat_variable_get_storage_width(variable) - * dc.variable_storage_width[col_name] = storage_width # <<<<<<<<<<<<<< - * - * dc.variable_display_width[col_name] = readstat_variable_get_display_width(variable) + /* "pyreadstat/_readstat_parser.pyx":217 + * tdelta = timedelta_new(days, 0, 0) + * #tdelta = timedelta(days=tstamp) + * mydat = origin + tdelta # <<<<<<<<<<<<<< + * if dates_as_pandas: + * return mydat */ - __pyx_t_3 = __Pyx_PyInt_From_int(((int)__pyx_v_storage_width)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__pyx_v_dc->variable_storage_width == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 536, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_dc->variable_storage_width, __pyx_v_col_name, __pyx_t_3) < 0)) __PYX_ERR(0, 536, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_v_origin, __pyx_v_tdelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_mydat = __pyx_t_2; + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":538 - * dc.variable_storage_width[col_name] = storage_width - * - * dc.variable_display_width[col_name] = readstat_variable_get_display_width(variable) # <<<<<<<<<<<<<< - * - * cdef readstat_alignment_t align + /* "pyreadstat/_readstat_parser.pyx":218 + * #tdelta = timedelta(days=tstamp) + * mydat = origin + tdelta + * if dates_as_pandas: # <<<<<<<<<<<<<< + * return mydat + * else: */ - __pyx_t_3 = __Pyx_PyInt_From_int(readstat_variable_get_display_width(__pyx_v_variable)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_v_dc->variable_display_width, __pyx_v_col_name, __pyx_t_3) < 0)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_v_dates_as_pandas) { - /* "pyreadstat/_readstat_parser.pyx":542 - * cdef readstat_alignment_t align - * cdef str pyalign - * align = readstat_variable_get_alignment(variable) # <<<<<<<<<<<<<< - * if align == READSTAT_ALIGNMENT_UNKNOWN: - * pyalign = "unknown" + /* "pyreadstat/_readstat_parser.pyx":219 + * mydat = origin + tdelta + * if dates_as_pandas: + * return mydat # <<<<<<<<<<<<<< + * else: + * return mydat.date() */ - __pyx_v_align = readstat_variable_get_alignment(__pyx_v_variable); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_mydat); + __pyx_r = __pyx_v_mydat; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":543 - * cdef str pyalign - * align = readstat_variable_get_alignment(variable) - * if align == READSTAT_ALIGNMENT_UNKNOWN: # <<<<<<<<<<<<<< - * pyalign = "unknown" - * elif align == READSTAT_ALIGNMENT_LEFT: + /* "pyreadstat/_readstat_parser.pyx":218 + * #tdelta = timedelta(days=tstamp) + * mydat = origin + tdelta + * if dates_as_pandas: # <<<<<<<<<<<<<< + * return mydat + * else: */ - switch (__pyx_v_align) { - case READSTAT_ALIGNMENT_UNKNOWN: + } - /* "pyreadstat/_readstat_parser.pyx":544 - * align = readstat_variable_get_alignment(variable) - * if align == READSTAT_ALIGNMENT_UNKNOWN: - * pyalign = "unknown" # <<<<<<<<<<<<<< - * elif align == READSTAT_ALIGNMENT_LEFT: - * pyalign = "left" + /* "pyreadstat/_readstat_parser.pyx":221 + * return mydat + * else: + * return mydat.date() # <<<<<<<<<<<<<< + * elif var_format == DATE_FORMAT_DATETIME: + * if file_format == FILE_FORMAT_STATA: */ - __Pyx_INCREF(__pyx_n_s_unknown); - __pyx_v_pyalign = __pyx_n_s_unknown; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_mydat, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + 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_5 = 1; + } + } + { + PyObject *__pyx_callargs[1] = {__pyx_t_4, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + } - /* "pyreadstat/_readstat_parser.pyx":543 - * cdef str pyalign - * align = readstat_variable_get_alignment(variable) - * if align == READSTAT_ALIGNMENT_UNKNOWN: # <<<<<<<<<<<<<< - * pyalign = "unknown" - * elif align == READSTAT_ALIGNMENT_LEFT: + /* "pyreadstat/_readstat_parser.pyx":205 + * cdef object mydat + * + * if var_format == DATE_FORMAT_DATE: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_SPSS: + * # tstamp is in seconds */ break; - case READSTAT_ALIGNMENT_LEFT: + case __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_DATETIME: - /* "pyreadstat/_readstat_parser.pyx":546 - * pyalign = "unknown" - * elif align == READSTAT_ALIGNMENT_LEFT: - * pyalign = "left" # <<<<<<<<<<<<<< - * elif align == READSTAT_ALIGNMENT_CENTER: - * pyalign = "center" + /* "pyreadstat/_readstat_parser.pyx":223 + * return mydat.date() + * elif var_format == DATE_FORMAT_DATETIME: + * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) */ - __Pyx_INCREF(__pyx_n_s_left); - __pyx_v_pyalign = __pyx_n_s_left; + __pyx_t_1 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA); + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":545 - * if align == READSTAT_ALIGNMENT_UNKNOWN: - * pyalign = "unknown" - * elif align == READSTAT_ALIGNMENT_LEFT: # <<<<<<<<<<<<<< - * pyalign = "left" - * elif align == READSTAT_ALIGNMENT_CENTER: + /* "pyreadstat/_readstat_parser.pyx":225 + * if file_format == FILE_FORMAT_STATA: + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) # <<<<<<<<<<<<<< + * msecs = tstamp % 86400000 + * secs = (msecs/1000) */ - break; - case READSTAT_ALIGNMENT_CENTER: + __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400000.0))); - /* "pyreadstat/_readstat_parser.pyx":548 - * pyalign = "left" - * elif align == READSTAT_ALIGNMENT_CENTER: - * pyalign = "center" # <<<<<<<<<<<<<< - * elif align == READSTAT_ALIGNMENT_RIGHT: - * pyalign = "right" + /* "pyreadstat/_readstat_parser.pyx":226 + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) + * msecs = tstamp % 86400000 # <<<<<<<<<<<<<< + * secs = (msecs/1000) + * usecs = ((msecs % 1000) * 1000 ) */ - __Pyx_INCREF(__pyx_n_s_center); - __pyx_v_pyalign = __pyx_n_s_center; + __pyx_v_msecs = __Pyx_mod_double(__pyx_v_tstamp, 86400000.0); - /* "pyreadstat/_readstat_parser.pyx":547 - * elif align == READSTAT_ALIGNMENT_LEFT: - * pyalign = "left" - * elif align == READSTAT_ALIGNMENT_CENTER: # <<<<<<<<<<<<<< - * pyalign = "center" - * elif align == READSTAT_ALIGNMENT_RIGHT: + /* "pyreadstat/_readstat_parser.pyx":227 + * days = (floor(tstamp / 86400000)) + * msecs = tstamp % 86400000 + * secs = (msecs/1000) # <<<<<<<<<<<<<< + * usecs = ((msecs % 1000) * 1000 ) + * tdelta = timedelta_new(days, secs, usecs) */ - break; - case READSTAT_ALIGNMENT_RIGHT: + __pyx_v_secs = ((int)(__pyx_v_msecs / 1000.0)); - /* "pyreadstat/_readstat_parser.pyx":550 - * pyalign = "center" - * elif align == READSTAT_ALIGNMENT_RIGHT: - * pyalign = "right" # <<<<<<<<<<<<<< - * else: - * pyalign = "undetermined" + /* "pyreadstat/_readstat_parser.pyx":228 + * msecs = tstamp % 86400000 + * secs = (msecs/1000) + * usecs = ((msecs % 1000) * 1000 ) # <<<<<<<<<<<<<< + * tdelta = timedelta_new(days, secs, usecs) + * #tdelta = timedelta(milliseconds=tstamp) */ - __Pyx_INCREF(__pyx_n_s_right); - __pyx_v_pyalign = __pyx_n_s_right; + __pyx_v_usecs = ((int)(__Pyx_mod_double(__pyx_v_msecs, 1000.0) * 1000.0)); - /* "pyreadstat/_readstat_parser.pyx":549 - * elif align == READSTAT_ALIGNMENT_CENTER: - * pyalign = "center" - * elif align == READSTAT_ALIGNMENT_RIGHT: # <<<<<<<<<<<<<< - * pyalign = "right" - * else: + /* "pyreadstat/_readstat_parser.pyx":229 + * secs = (msecs/1000) + * usecs = ((msecs % 1000) * 1000 ) + * tdelta = timedelta_new(days, secs, usecs) # <<<<<<<<<<<<<< + * #tdelta = timedelta(milliseconds=tstamp) + * else: */ - break; - default: + __pyx_t_2 = ((PyObject *)__pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, __pyx_v_usecs)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_tdelta = __pyx_t_2; + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":552 - * pyalign = "right" - * else: - * pyalign = "undetermined" # <<<<<<<<<<<<<< - * - * dc.variable_alignment[col_name] = pyalign + /* "pyreadstat/_readstat_parser.pyx":223 + * return mydat.date() + * elif var_format == DATE_FORMAT_DATETIME: + * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) */ - __Pyx_INCREF(__pyx_n_s_undetermined); - __pyx_v_pyalign = __pyx_n_s_undetermined; - break; - } + goto __pyx_L5; + } - /* "pyreadstat/_readstat_parser.pyx":554 - * pyalign = "undetermined" - * - * dc.variable_alignment[col_name] = pyalign # <<<<<<<<<<<<<< - * - * cdef readstat_measure_t measure + /* "pyreadstat/_readstat_parser.pyx":233 + * else: + * # tstamp in seconds + * days = (floor(tstamp / 86400)) # <<<<<<<<<<<<<< + * secs = (tstamp % 86400) + * tdelta = timedelta_new(days, secs, 0) */ - if (unlikely(PyObject_SetItem(__pyx_v_dc->variable_alignment, __pyx_v_col_name, __pyx_v_pyalign) < 0)) __PYX_ERR(0, 554, __pyx_L1_error) + /*else*/ { + __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400.0))); - /* "pyreadstat/_readstat_parser.pyx":558 - * cdef readstat_measure_t measure - * cdef str pymeasure - * measure = readstat_variable_get_measure(variable) # <<<<<<<<<<<<<< - * if measure == READSTAT_MEASURE_UNKNOWN: - * pymeasure = "unknown" + /* "pyreadstat/_readstat_parser.pyx":234 + * # tstamp in seconds + * days = (floor(tstamp / 86400)) + * secs = (tstamp % 86400) # <<<<<<<<<<<<<< + * tdelta = timedelta_new(days, secs, 0) + * #tdelta = timedelta(seconds=tstamp) */ - __pyx_v_measure = readstat_variable_get_measure(__pyx_v_variable); + __pyx_v_secs = ((int)__Pyx_mod_double(__pyx_v_tstamp, 86400.0)); - /* "pyreadstat/_readstat_parser.pyx":559 - * cdef str pymeasure - * measure = readstat_variable_get_measure(variable) - * if measure == READSTAT_MEASURE_UNKNOWN: # <<<<<<<<<<<<<< - * pymeasure = "unknown" - * elif measure == READSTAT_MEASURE_NOMINAL: + /* "pyreadstat/_readstat_parser.pyx":235 + * days = (floor(tstamp / 86400)) + * secs = (tstamp % 86400) + * tdelta = timedelta_new(days, secs, 0) # <<<<<<<<<<<<<< + * #tdelta = timedelta(seconds=tstamp) + * mydat = origin + tdelta */ - switch (__pyx_v_measure) { - case READSTAT_MEASURE_UNKNOWN: + __pyx_t_2 = ((PyObject *)__pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_tdelta = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L5:; - /* "pyreadstat/_readstat_parser.pyx":560 - * measure = readstat_variable_get_measure(variable) - * if measure == READSTAT_MEASURE_UNKNOWN: - * pymeasure = "unknown" # <<<<<<<<<<<<<< - * elif measure == READSTAT_MEASURE_NOMINAL: - * pymeasure = "nominal" + /* "pyreadstat/_readstat_parser.pyx":237 + * tdelta = timedelta_new(days, secs, 0) + * #tdelta = timedelta(seconds=tstamp) + * mydat = origin + tdelta # <<<<<<<<<<<<<< + * return mydat + * elif var_format == DATE_FORMAT_TIME: */ - __Pyx_INCREF(__pyx_n_s_unknown); - __pyx_v_pymeasure = __pyx_n_s_unknown; + __pyx_t_2 = PyNumber_Add(__pyx_v_origin, __pyx_v_tdelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_mydat = __pyx_t_2; + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":559 - * cdef str pymeasure - * measure = readstat_variable_get_measure(variable) - * if measure == READSTAT_MEASURE_UNKNOWN: # <<<<<<<<<<<<<< - * pymeasure = "unknown" - * elif measure == READSTAT_MEASURE_NOMINAL: + /* "pyreadstat/_readstat_parser.pyx":238 + * #tdelta = timedelta(seconds=tstamp) + * mydat = origin + tdelta + * return mydat # <<<<<<<<<<<<<< + * elif var_format == DATE_FORMAT_TIME: + * if file_format == FILE_FORMAT_STATA: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_mydat); + __pyx_r = __pyx_v_mydat; + goto __pyx_L0; + + /* "pyreadstat/_readstat_parser.pyx":222 + * else: + * return mydat.date() + * elif var_format == DATE_FORMAT_DATETIME: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_STATA: + * # tstamp is in millisecons */ break; - case READSTAT_MEASURE_NOMINAL: + case __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_TIME: - /* "pyreadstat/_readstat_parser.pyx":562 - * pymeasure = "unknown" - * elif measure == READSTAT_MEASURE_NOMINAL: - * pymeasure = "nominal" # <<<<<<<<<<<<<< - * elif measure == READSTAT_MEASURE_ORDINAL: - * pymeasure = "ordinal" + /* "pyreadstat/_readstat_parser.pyx":240 + * return mydat + * elif var_format == DATE_FORMAT_TIME: + * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) */ - __Pyx_INCREF(__pyx_n_s_nominal); - __pyx_v_pymeasure = __pyx_n_s_nominal; + __pyx_t_1 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA); + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":561 - * if measure == READSTAT_MEASURE_UNKNOWN: - * pymeasure = "unknown" - * elif measure == READSTAT_MEASURE_NOMINAL: # <<<<<<<<<<<<<< - * pymeasure = "nominal" - * elif measure == READSTAT_MEASURE_ORDINAL: + /* "pyreadstat/_readstat_parser.pyx":242 + * if file_format == FILE_FORMAT_STATA: + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) # <<<<<<<<<<<<<< + * msecs = tstamp % 86400000 + * secs = (msecs/1000) */ - break; - case READSTAT_MEASURE_ORDINAL: + __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400000.0))); - /* "pyreadstat/_readstat_parser.pyx":564 - * pymeasure = "nominal" - * elif measure == READSTAT_MEASURE_ORDINAL: - * pymeasure = "ordinal" # <<<<<<<<<<<<<< - * elif measure == READSTAT_MEASURE_SCALE: - * pymeasure = "scale" + /* "pyreadstat/_readstat_parser.pyx":243 + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) + * msecs = tstamp % 86400000 # <<<<<<<<<<<<<< + * secs = (msecs/1000) + * usecs = ((msecs % 1000) * 1000 ) */ - __Pyx_INCREF(__pyx_n_s_ordinal); - __pyx_v_pymeasure = __pyx_n_s_ordinal; + __pyx_v_msecs = __Pyx_mod_double(__pyx_v_tstamp, 86400000.0); - /* "pyreadstat/_readstat_parser.pyx":563 - * elif measure == READSTAT_MEASURE_NOMINAL: - * pymeasure = "nominal" - * elif measure == READSTAT_MEASURE_ORDINAL: # <<<<<<<<<<<<<< - * pymeasure = "ordinal" - * elif measure == READSTAT_MEASURE_SCALE: + /* "pyreadstat/_readstat_parser.pyx":244 + * days = (floor(tstamp / 86400000)) + * msecs = tstamp % 86400000 + * secs = (msecs/1000) # <<<<<<<<<<<<<< + * usecs = ((msecs % 1000) * 1000 ) + * tdelta = timedelta_new(days, secs, usecs) */ - break; - case READSTAT_MEASURE_SCALE: + __pyx_v_secs = ((int)(__pyx_v_msecs / 1000.0)); - /* "pyreadstat/_readstat_parser.pyx":566 - * pymeasure = "ordinal" - * elif measure == READSTAT_MEASURE_SCALE: - * pymeasure = "scale" # <<<<<<<<<<<<<< - * else: - * pymeasure = "undetermined" + /* "pyreadstat/_readstat_parser.pyx":245 + * msecs = tstamp % 86400000 + * secs = (msecs/1000) + * usecs = ((msecs % 1000) * 1000 ) # <<<<<<<<<<<<<< + * tdelta = timedelta_new(days, secs, usecs) + * #tdelta = timedelta(milliseconds=tstamp) */ - __Pyx_INCREF(__pyx_n_s_scale); - __pyx_v_pymeasure = __pyx_n_s_scale; + __pyx_v_usecs = ((int)(__Pyx_mod_double(__pyx_v_msecs, 1000.0) * 1000.0)); - /* "pyreadstat/_readstat_parser.pyx":565 - * elif measure == READSTAT_MEASURE_ORDINAL: - * pymeasure = "ordinal" - * elif measure == READSTAT_MEASURE_SCALE: # <<<<<<<<<<<<<< - * pymeasure = "scale" - * else: + /* "pyreadstat/_readstat_parser.pyx":246 + * secs = (msecs/1000) + * usecs = ((msecs % 1000) * 1000 ) + * tdelta = timedelta_new(days, secs, usecs) # <<<<<<<<<<<<<< + * #tdelta = timedelta(milliseconds=tstamp) + * else: */ - break; - default: + __pyx_t_2 = ((PyObject *)__pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, __pyx_v_usecs)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_tdelta = __pyx_t_2; + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":568 - * pymeasure = "scale" - * else: - * pymeasure = "undetermined" # <<<<<<<<<<<<<< - * - * dc.variable_measure[col_name] = pymeasure + /* "pyreadstat/_readstat_parser.pyx":240 + * return mydat + * elif var_format == DATE_FORMAT_TIME: + * if file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * # tstamp is in millisecons + * days = (floor(tstamp / 86400000)) */ - __Pyx_INCREF(__pyx_n_s_undetermined); - __pyx_v_pymeasure = __pyx_n_s_undetermined; - break; - } + goto __pyx_L6; + } - /* "pyreadstat/_readstat_parser.pyx":570 - * pymeasure = "undetermined" - * - * dc.variable_measure[col_name] = pymeasure # <<<<<<<<<<<<<< - * - * return READSTAT_HANDLER_OK + /* "pyreadstat/_readstat_parser.pyx":250 + * else: + * # tstamp in seconds + * days = (floor(tstamp / 86400)) # <<<<<<<<<<<<<< + * secs = (tstamp % 86400) + * tdelta = timedelta_new(days, secs, 0) */ - if (unlikely(PyObject_SetItem(__pyx_v_dc->variable_measure, __pyx_v_col_name, __pyx_v_pymeasure) < 0)) __PYX_ERR(0, 570, __pyx_L1_error) + /*else*/ { + __pyx_v_days = ((int)floor((__pyx_v_tstamp / 86400.0))); - /* "pyreadstat/_readstat_parser.pyx":572 - * dc.variable_measure[col_name] = pymeasure - * - * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< - * - * + /* "pyreadstat/_readstat_parser.pyx":251 + * # tstamp in seconds + * days = (floor(tstamp / 86400)) + * secs = (tstamp % 86400) # <<<<<<<<<<<<<< + * tdelta = timedelta_new(days, secs, 0) + * #tdelta = timedelta(seconds=tstamp) */ - __pyx_r = READSTAT_HANDLER_OK; - goto __pyx_L0; + __pyx_v_secs = ((int)__Pyx_mod_double(__pyx_v_tstamp, 86400.0)); - /* "pyreadstat/_readstat_parser.pyx":408 - * return READSTAT_HANDLER_OK - * - * cdef int handle_variable(int index, readstat_variable_t *variable, # <<<<<<<<<<<<<< - * char *val_labels, void *ctx) except READSTAT_HANDLER_ABORT: - * """ + /* "pyreadstat/_readstat_parser.pyx":252 + * days = (floor(tstamp / 86400)) + * secs = (tstamp % 86400) + * tdelta = timedelta_new(days, secs, 0) # <<<<<<<<<<<<<< + * #tdelta = timedelta(seconds=tstamp) + * mydat = origin + tdelta */ + __pyx_t_2 = ((PyObject *)__pyx_f_7cpython_8datetime_timedelta_new(__pyx_v_days, __pyx_v_secs, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_tdelta = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_L6:; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); + /* "pyreadstat/_readstat_parser.pyx":254 + * tdelta = timedelta_new(days, secs, 0) + * #tdelta = timedelta(seconds=tstamp) + * mydat = origin + tdelta # <<<<<<<<<<<<<< + * return mydat.time() + * + */ + __pyx_t_2 = PyNumber_Add(__pyx_v_origin, __pyx_v_tdelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_mydat = __pyx_t_2; + __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":255 + * #tdelta = timedelta(seconds=tstamp) + * mydat = origin + tdelta + * return mydat.time() # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_mydat, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + 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_5 = 1; + } + } + { + PyObject *__pyx_callargs[1] = {__pyx_t_4, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pyreadstat/_readstat_parser.pyx":239 + * mydat = origin + tdelta + * return mydat + * elif var_format == DATE_FORMAT_TIME: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_STATA: + * # tstamp is in millisecons + */ + break; + default: break; + } + + /* "pyreadstat/_readstat_parser.pyx":192 + * return DATE_FORMAT_NOTADATE + * + * cdef object transform_datetime(py_datetime_format var_format, double tstamp, py_file_format file_format, object origin, bint dates_as_pandas): # <<<<<<<<<<<<<< + * """ + * Transforms a tstamp integer value to a date, time or datetime pyton object. + */ + + /* 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_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = READSTAT_HANDLER_ABORT; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyreadstat._readstat_parser.transform_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_col_name); - __Pyx_XDECREF(__pyx_v_col_label); - __Pyx_XDECREF(__pyx_v_label_name); - __Pyx_XDECREF(__pyx_v_col_format_original); - __Pyx_XDECREF(__pyx_v_pyloval); - __Pyx_XDECREF(__pyx_v_pyhival); - __Pyx_XDECREF(__pyx_v_missing_ranges); - __Pyx_XDECREF(__pyx_v_curnptype); - __Pyx_XDECREF(__pyx_v_row); - __Pyx_XDECREF(__pyx_v_newcolname); - __Pyx_XDECREF((PyObject *)__pyx_v_dc); - __Pyx_XDECREF(__pyx_v_msg); - __Pyx_XDECREF(__pyx_v_pyalign); - __Pyx_XDECREF(__pyx_v_pymeasure); + __Pyx_XDECREF(__pyx_v_tdelta); + __Pyx_XDECREF(__pyx_v_mydat); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":575 +/* "pyreadstat/_readstat_parser.pyx":258 * * - * cdef int handle_value(int obs_index, readstat_variable_t * variable, readstat_value_t value, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * cdef object convert_readstat_to_python_value(readstat_value_t value, int index, data_container dc): # <<<<<<<<<<<<<< * """ - * This function transforms every value to python types, and to datetime if + * Converts a readstat value to a python value. */ -static int __pyx_f_10pyreadstat_16_readstat_parser_handle_value(int __pyx_v_obs_index, readstat_variable_t *__pyx_v_variable, readstat_value_t __pyx_v_value, void *__pyx_v_ctx) { - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; - int __pyx_v_index; - int __pyx_v_max_n_obs; - int __pyx_v_is_unkown_number_rows; - int __pyx_v_var_max_rows; - PyObject *__pyx_v_buf_list = 0; - int __pyx_v_iscurnptypeobject; - int __pyx_v_iscurnptypefloat; - int __pyx_v_missing_tag; - PyObject *__pyx_v_pyvalue = 0; - PyObject *__pyx_v_curset = 0; - PyObject *__pyx_v_curnptype = 0; - int __pyx_r; +static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(readstat_value_t __pyx_v_value, int __pyx_v_index, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc) { + readstat_type_t __pyx_v_var_type; + __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_var_format; + __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format __pyx_v_pyformat; + PyObject *__pyx_v_origin = 0; + int __pyx_v_dates_as_pandas; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + PyObject *__pyx_v_result = 0; + char *__pyx_v_c_str_value; + PyObject *__pyx_v_py_str_value = 0; + int8_t __pyx_v_c_int8_value; + int16_t __pyx_v_c_int16_value; + int32_t __pyx_v_c_int32_value; + float __pyx_v_c_float_value; + double __pyx_v_c_double_value; + long __pyx_v_py_long_value; + double __pyx_v_py_float_value; + double __pyx_v_tstamp; + 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_t_6; + readstat_type_t __pyx_t_2; + __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_3; + int __pyx_t_4; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_t_5; + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_8; int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle_value", 0); + __Pyx_RefNannySetupContext("convert_readstat_to_python_value", 0); - /* "pyreadstat/_readstat_parser.pyx":597 + /* "pyreadstat/_readstat_parser.pyx":285 + * cdef double tstamp * - * # extract variables we need from data container - * dc = ctx # <<<<<<<<<<<<<< - * index = readstat_variable_get_index_after_skipping(variable) - * max_n_obs = dc.max_n_obs - */ - __pyx_t_1 = ((PyObject *)__pyx_v_ctx); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "pyreadstat/_readstat_parser.pyx":598 - * # extract variables we need from data container - * dc = ctx - * index = readstat_variable_get_index_after_skipping(variable) # <<<<<<<<<<<<<< - * max_n_obs = dc.max_n_obs - * is_unkown_number_rows = dc.is_unkown_number_rows - */ - __pyx_v_index = readstat_variable_get_index_after_skipping(__pyx_v_variable); - - /* "pyreadstat/_readstat_parser.pyx":599 - * dc = ctx - * index = readstat_variable_get_index_after_skipping(variable) - * max_n_obs = dc.max_n_obs # <<<<<<<<<<<<<< - * is_unkown_number_rows = dc.is_unkown_number_rows - * #iscurnptypeobject = dc.col_dtypes_isobject[index] - */ - __pyx_t_2 = __pyx_v_dc->max_n_obs; - __pyx_v_max_n_obs = __pyx_t_2; - - /* "pyreadstat/_readstat_parser.pyx":600 - * index = readstat_variable_get_index_after_skipping(variable) - * max_n_obs = dc.max_n_obs - * is_unkown_number_rows = dc.is_unkown_number_rows # <<<<<<<<<<<<<< - * #iscurnptypeobject = dc.col_dtypes_isobject[index] - * #iscurnptypefloat = dc.col_dytpes_isfloat[index] - */ - __pyx_t_3 = __pyx_v_dc->is_unkown_number_rows; - __pyx_v_is_unkown_number_rows = __pyx_t_3; - - /* "pyreadstat/_readstat_parser.pyx":606 - * # check that we still have enough room in our pre-allocated lists - * # if not, add more room - * iscurnptypeobject = dc.col_dtypes_isobject[index] # <<<<<<<<<<<<<< - * iscurnptypefloat = dc.col_dytpes_isfloat[index] - * if is_unkown_number_rows: + * var_type = dc.col_dtypes[index] # <<<<<<<<<<<<<< + * var_format = dc.col_formats[index] + * origin = dc.origin */ - if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { + if (unlikely(__pyx_v_dc->col_dtypes == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 606, __pyx_L1_error) + __PYX_ERR(0, 285, __pyx_L1_error) } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dtypes, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_t_2 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_iscurnptypeobject = __pyx_t_3; + __pyx_v_var_type = __pyx_t_2; - /* "pyreadstat/_readstat_parser.pyx":607 - * # if not, add more room - * iscurnptypeobject = dc.col_dtypes_isobject[index] - * iscurnptypefloat = dc.col_dytpes_isfloat[index] # <<<<<<<<<<<<<< - * if is_unkown_number_rows: - * if max_n_obs <= obs_index: + /* "pyreadstat/_readstat_parser.pyx":286 + * + * var_type = dc.col_dtypes[index] + * var_format = dc.col_formats[index] # <<<<<<<<<<<<<< + * origin = dc.origin + * dates_as_pandas = dc.dates_as_pandas */ - if (unlikely(__pyx_v_dc->col_dytpes_isfloat == Py_None)) { + if (unlikely(__pyx_v_dc->col_formats == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 607, __pyx_L1_error) + __PYX_ERR(0, 286, __pyx_L1_error) } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dytpes_isfloat, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_formats, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 607, __pyx_L1_error) + __pyx_t_3 = ((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_iscurnptypefloat = __pyx_t_3; + __pyx_v_var_format = __pyx_t_3; - /* "pyreadstat/_readstat_parser.pyx":608 - * iscurnptypeobject = dc.col_dtypes_isobject[index] - * iscurnptypefloat = dc.col_dytpes_isfloat[index] - * if is_unkown_number_rows: # <<<<<<<<<<<<<< - * if max_n_obs <= obs_index: - * dc.max_n_obs = obs_index + 1 + /* "pyreadstat/_readstat_parser.pyx":287 + * var_type = dc.col_dtypes[index] + * var_format = dc.col_formats[index] + * origin = dc.origin # <<<<<<<<<<<<<< + * dates_as_pandas = dc.dates_as_pandas + * file_format = dc.file_format */ - __pyx_t_3 = (__pyx_v_is_unkown_number_rows != 0); - if (__pyx_t_3) { + __pyx_t_1 = __pyx_v_dc->origin; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_origin = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":609 - * iscurnptypefloat = dc.col_dytpes_isfloat[index] - * if is_unkown_number_rows: - * if max_n_obs <= obs_index: # <<<<<<<<<<<<<< - * dc.max_n_obs = obs_index + 1 - * var_max_rows = dc.col_data_len[index] + /* "pyreadstat/_readstat_parser.pyx":288 + * var_format = dc.col_formats[index] + * origin = dc.origin + * dates_as_pandas = dc.dates_as_pandas # <<<<<<<<<<<<<< + * file_format = dc.file_format + * */ - __pyx_t_3 = ((__pyx_v_max_n_obs <= __pyx_v_obs_index) != 0); - if (__pyx_t_3) { - - /* "pyreadstat/_readstat_parser.pyx":610 - * if is_unkown_number_rows: - * if max_n_obs <= obs_index: - * dc.max_n_obs = obs_index + 1 # <<<<<<<<<<<<<< - * var_max_rows = dc.col_data_len[index] - * if var_max_rows <= obs_index: - */ - __pyx_v_dc->max_n_obs = (__pyx_v_obs_index + 1); + __pyx_t_4 = __pyx_v_dc->dates_as_pandas; + __pyx_v_dates_as_pandas = __pyx_t_4; - /* "pyreadstat/_readstat_parser.pyx":609 - * iscurnptypefloat = dc.col_dytpes_isfloat[index] - * if is_unkown_number_rows: - * if max_n_obs <= obs_index: # <<<<<<<<<<<<<< - * dc.max_n_obs = obs_index + 1 - * var_max_rows = dc.col_data_len[index] + /* "pyreadstat/_readstat_parser.pyx":289 + * origin = dc.origin + * dates_as_pandas = dc.dates_as_pandas + * file_format = dc.file_format # <<<<<<<<<<<<<< + * + * # transform to values cython can deal with */ - } + __pyx_t_5 = __pyx_v_dc->file_format; + __pyx_v_file_format = __pyx_t_5; - /* "pyreadstat/_readstat_parser.pyx":611 - * if max_n_obs <= obs_index: - * dc.max_n_obs = obs_index + 1 - * var_max_rows = dc.col_data_len[index] # <<<<<<<<<<<<<< - * if var_max_rows <= obs_index: - * curnptype = dc.col_numpy_dtypes[index] + /* "pyreadstat/_readstat_parser.pyx":292 + * + * # transform to values cython can deal with + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< + * c_str_value = readstat_string_value(value) + * if c_str_value != NULL: */ - if (unlikely(__pyx_v_dc->col_data_len == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 611, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data_len, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __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, 611, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_var_max_rows = __pyx_t_2; + switch (__pyx_v_var_type) { + case READSTAT_TYPE_STRING: + case READSTAT_TYPE_STRING_REF: - /* "pyreadstat/_readstat_parser.pyx":612 - * dc.max_n_obs = obs_index + 1 - * var_max_rows = dc.col_data_len[index] - * if var_max_rows <= obs_index: # <<<<<<<<<<<<<< - * curnptype = dc.col_numpy_dtypes[index] - * buf_list = np.empty(100000, dtype=curnptype) + /* "pyreadstat/_readstat_parser.pyx":293 + * # transform to values cython can deal with + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: + * c_str_value = readstat_string_value(value) # <<<<<<<<<<<<<< + * if c_str_value != NULL: + * py_str_value = c_str_value */ - __pyx_t_3 = ((__pyx_v_var_max_rows <= __pyx_v_obs_index) != 0); - if (__pyx_t_3) { + __pyx_v_c_str_value = readstat_string_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":613 - * var_max_rows = dc.col_data_len[index] - * if var_max_rows <= obs_index: - * curnptype = dc.col_numpy_dtypes[index] # <<<<<<<<<<<<<< - * buf_list = np.empty(100000, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: + /* "pyreadstat/_readstat_parser.pyx":294 + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: + * c_str_value = readstat_string_value(value) + * if c_str_value != NULL: # <<<<<<<<<<<<<< + * py_str_value = c_str_value + * else: */ - if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 613, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_curnptype = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_4 = (__pyx_v_c_str_value != NULL); + if (__pyx_t_4) { - /* "pyreadstat/_readstat_parser.pyx":614 - * if var_max_rows <= obs_index: - * curnptype = dc.col_numpy_dtypes[index] - * buf_list = np.empty(100000, dtype=curnptype) # <<<<<<<<<<<<<< - * if iscurnptypeobject or iscurnptypefloat: - * buf_list.fill(np.nan) + /* "pyreadstat/_readstat_parser.pyx":295 + * c_str_value = readstat_string_value(value) + * if c_str_value != NULL: + * py_str_value = c_str_value # <<<<<<<<<<<<<< + * else: + * py_str_value = '' */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_c_str_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_curnptype) < 0) __PYX_ERR(0, 614, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__5, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_buf_list = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_py_str_value = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; - /* "pyreadstat/_readstat_parser.pyx":615 - * curnptype = dc.col_numpy_dtypes[index] - * buf_list = np.empty(100000, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< - * buf_list.fill(np.nan) - * dc.col_data[index] = np.append(dc.col_data[index], buf_list) + /* "pyreadstat/_readstat_parser.pyx":294 + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: + * c_str_value = readstat_string_value(value) + * if c_str_value != NULL: # <<<<<<<<<<<<<< + * py_str_value = c_str_value + * else: */ - __pyx_t_6 = (__pyx_v_iscurnptypeobject != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_3 = __pyx_t_6; - goto __pyx_L7_bool_binop_done; - } - __pyx_t_6 = (__pyx_v_iscurnptypefloat != 0); - __pyx_t_3 = __pyx_t_6; - __pyx_L7_bool_binop_done:; - if (__pyx_t_3) { + goto __pyx_L3; + } - /* "pyreadstat/_readstat_parser.pyx":616 - * buf_list = np.empty(100000, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: - * buf_list.fill(np.nan) # <<<<<<<<<<<<<< - * dc.col_data[index] = np.append(dc.col_data[index], buf_list) - * var_max_rows += 100000 + /* "pyreadstat/_readstat_parser.pyx":297 + * py_str_value = c_str_value + * else: + * py_str_value = '' # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_STRING + * elif var_type == READSTAT_TYPE_INT8: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_buf_list, __pyx_n_s_fill); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nan); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 616, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + /*else*/ { + __Pyx_INCREF(__pyx_kp_s__2); + __pyx_v_py_str_value = __pyx_kp_s__2; + } + __pyx_L3:; - /* "pyreadstat/_readstat_parser.pyx":615 - * curnptype = dc.col_numpy_dtypes[index] - * buf_list = np.empty(100000, dtype=curnptype) - * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< - * buf_list.fill(np.nan) - * dc.col_data[index] = np.append(dc.col_data[index], buf_list) + /* "pyreadstat/_readstat_parser.pyx":298 + * else: + * py_str_value = '' + * pyformat = VAR_FORMAT_STRING # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_INT8: + * c_int8_value = readstat_int8_value(value) */ - } + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING; - /* "pyreadstat/_readstat_parser.pyx":617 - * if iscurnptypeobject or iscurnptypefloat: - * buf_list.fill(np.nan) - * dc.col_data[index] = np.append(dc.col_data[index], buf_list) # <<<<<<<<<<<<<< - * var_max_rows += 100000 - * dc.col_data_len[index] = var_max_rows + /* "pyreadstat/_readstat_parser.pyx":292 + * + * # transform to values cython can deal with + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< + * c_str_value = readstat_string_value(value) + * if c_str_value != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_append); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 617, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = NULL; - __pyx_t_2 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_2 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_buf_list}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_buf_list}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_2, __pyx_t_1); - __Pyx_INCREF(__pyx_v_buf_list); - __Pyx_GIVEREF(__pyx_v_buf_list); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_2, __pyx_v_buf_list); - __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 617, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_data, __pyx_v_index, __pyx_t_5, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + break; + case READSTAT_TYPE_INT8: - /* "pyreadstat/_readstat_parser.pyx":618 - * buf_list.fill(np.nan) - * dc.col_data[index] = np.append(dc.col_data[index], buf_list) - * var_max_rows += 100000 # <<<<<<<<<<<<<< - * dc.col_data_len[index] = var_max_rows - * + /* "pyreadstat/_readstat_parser.pyx":300 + * pyformat = VAR_FORMAT_STRING + * elif var_type == READSTAT_TYPE_INT8: + * c_int8_value = readstat_int8_value(value) # <<<<<<<<<<<<<< + * py_long_value = c_int8_value + * pyformat = VAR_FORMAT_LONG */ - __pyx_v_var_max_rows = (__pyx_v_var_max_rows + 0x186A0); + __pyx_v_c_int8_value = readstat_int8_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":619 - * dc.col_data[index] = np.append(dc.col_data[index], buf_list) - * var_max_rows += 100000 - * dc.col_data_len[index] = var_max_rows # <<<<<<<<<<<<<< - * - * # transform to python value types + /* "pyreadstat/_readstat_parser.pyx":301 + * elif var_type == READSTAT_TYPE_INT8: + * c_int8_value = readstat_int8_value(value) + * py_long_value = c_int8_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_INT16: */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_var_max_rows); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_dc->col_data_len == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 619, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_data_len, __pyx_v_index, __pyx_t_5, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 619, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_py_long_value = ((long)__pyx_v_c_int8_value); - /* "pyreadstat/_readstat_parser.pyx":612 - * dc.max_n_obs = obs_index + 1 - * var_max_rows = dc.col_data_len[index] - * if var_max_rows <= obs_index: # <<<<<<<<<<<<<< - * curnptype = dc.col_numpy_dtypes[index] - * buf_list = np.empty(100000, dtype=curnptype) + /* "pyreadstat/_readstat_parser.pyx":302 + * c_int8_value = readstat_int8_value(value) + * py_long_value = c_int8_value + * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_INT16: + * c_int16_value = readstat_int16_value(value) */ - } + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* "pyreadstat/_readstat_parser.pyx":608 - * iscurnptypeobject = dc.col_dtypes_isobject[index] - * iscurnptypefloat = dc.col_dytpes_isfloat[index] - * if is_unkown_number_rows: # <<<<<<<<<<<<<< - * if max_n_obs <= obs_index: - * dc.max_n_obs = obs_index + 1 + /* "pyreadstat/_readstat_parser.pyx":299 + * py_str_value = '' + * pyformat = VAR_FORMAT_STRING + * elif var_type == READSTAT_TYPE_INT8: # <<<<<<<<<<<<<< + * c_int8_value = readstat_int8_value(value) + * py_long_value = c_int8_value */ - } + break; + case READSTAT_TYPE_INT16: - /* "pyreadstat/_readstat_parser.pyx":622 - * - * # transform to python value types - * if readstat_value_is_missing(value, variable): # <<<<<<<<<<<<<< - * # The user does not want to retrieve missing values - * if not dc.usernan or readstat_value_is_system_missing(value): + /* "pyreadstat/_readstat_parser.pyx":304 + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_INT16: + * c_int16_value = readstat_int16_value(value) # <<<<<<<<<<<<<< + * py_long_value = c_int16_value + * pyformat = VAR_FORMAT_LONG */ - __pyx_t_3 = (readstat_value_is_missing(__pyx_v_value, __pyx_v_variable) != 0); - if (__pyx_t_3) { + __pyx_v_c_int16_value = readstat_int16_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":624 - * if readstat_value_is_missing(value, variable): - * # The user does not want to retrieve missing values - * if not dc.usernan or readstat_value_is_system_missing(value): # <<<<<<<<<<<<<< - * if iscurnptypefloat == 1 or iscurnptypeobject == 1: - * # already allocated + /* "pyreadstat/_readstat_parser.pyx":305 + * elif var_type == READSTAT_TYPE_INT16: + * c_int16_value = readstat_int16_value(value) + * py_long_value = c_int16_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_INT32: */ - __pyx_t_6 = ((!(__pyx_v_dc->usernan != 0)) != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_3 = __pyx_t_6; - goto __pyx_L11_bool_binop_done; - } - __pyx_t_6 = (readstat_value_is_system_missing(__pyx_v_value) != 0); - __pyx_t_3 = __pyx_t_6; - __pyx_L11_bool_binop_done:; - if (__pyx_t_3) { + __pyx_v_py_long_value = ((long)__pyx_v_c_int16_value); - /* "pyreadstat/_readstat_parser.pyx":625 - * # The user does not want to retrieve missing values - * if not dc.usernan or readstat_value_is_system_missing(value): - * if iscurnptypefloat == 1 or iscurnptypeobject == 1: # <<<<<<<<<<<<<< - * # already allocated - * pass + /* "pyreadstat/_readstat_parser.pyx":306 + * c_int16_value = readstat_int16_value(value) + * py_long_value = c_int16_value + * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_INT32: + * c_int32_value = readstat_int32_value(value) */ - __pyx_t_6 = ((__pyx_v_iscurnptypefloat == 1) != 0); - if (!__pyx_t_6) { - } else { - __pyx_t_3 = __pyx_t_6; - goto __pyx_L14_bool_binop_done; - } - __pyx_t_6 = ((__pyx_v_iscurnptypeobject == 1) != 0); - __pyx_t_3 = __pyx_t_6; - __pyx_L14_bool_binop_done:; - if (__pyx_t_3) { - goto __pyx_L13; - } + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* "pyreadstat/_readstat_parser.pyx":631 - * # for any type except float, the numpy type will be object as now we have nans - * else: - * dc.col_numpy_dtypes[index] = object # <<<<<<<<<<<<<< - * dc.col_dtypes_isobject[index] = 1 - * iscurnptypeobject = 1 + /* "pyreadstat/_readstat_parser.pyx":303 + * py_long_value = c_int8_value + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_INT16: # <<<<<<<<<<<<<< + * c_int16_value = readstat_int16_value(value) + * py_long_value = c_int16_value */ - /*else*/ { - if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 631, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, __pyx_builtin_object, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 631, __pyx_L1_error) + break; + case READSTAT_TYPE_INT32: - /* "pyreadstat/_readstat_parser.pyx":632 - * else: - * dc.col_numpy_dtypes[index] = object - * dc.col_dtypes_isobject[index] = 1 # <<<<<<<<<<<<<< - * iscurnptypeobject = 1 - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) + /* "pyreadstat/_readstat_parser.pyx":308 + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_INT32: + * c_int32_value = readstat_int32_value(value) # <<<<<<<<<<<<<< + * py_long_value = c_int32_value + * pyformat = VAR_FORMAT_LONG */ - if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 632, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, __pyx_int_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 632, __pyx_L1_error) + __pyx_v_c_int32_value = readstat_int32_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":633 - * dc.col_numpy_dtypes[index] = object - * dc.col_dtypes_isobject[index] = 1 - * iscurnptypeobject = 1 # <<<<<<<<<<<<<< - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) - * dc.col_data[index][obs_index:] = np.nan + /* "pyreadstat/_readstat_parser.pyx":309 + * elif var_type == READSTAT_TYPE_INT32: + * c_int32_value = readstat_int32_value(value) + * py_long_value = c_int32_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_FLOAT: */ - __pyx_v_iscurnptypeobject = 1; + __pyx_v_py_long_value = ((long)__pyx_v_c_int32_value); - /* "pyreadstat/_readstat_parser.pyx":634 - * dc.col_dtypes_isobject[index] = 1 - * iscurnptypeobject = 1 - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) # <<<<<<<<<<<<<< - * dc.col_data[index][obs_index:] = np.nan - * #dc.col_data[index][obs_index] = NAN + /* "pyreadstat/_readstat_parser.pyx":310 + * c_int32_value = readstat_int32_value(value) + * py_long_value = c_int32_value + * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_FLOAT: + * c_float_value = readstat_float_value(value) */ - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 634, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(0, 634, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__6, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 634, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_data, __pyx_v_index, __pyx_t_8, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* "pyreadstat/_readstat_parser.pyx":635 - * iscurnptypeobject = 1 - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) - * dc.col_data[index][obs_index:] = np.nan # <<<<<<<<<<<<<< - * #dc.col_data[index][obs_index] = NAN - * elif readstat_value_is_defined_missing(value, variable): + /* "pyreadstat/_readstat_parser.pyx":307 + * py_long_value = c_int16_value + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_INT32: # <<<<<<<<<<<<<< + * c_int32_value = readstat_int32_value(value) + * py_long_value = c_int32_value */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_nan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 635, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_PyObject_SetSlice(__pyx_t_8, __pyx_t_5, __pyx_v_obs_index, 0, NULL, NULL, NULL, 1, 0, 1) < 0) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_L13:; + break; + case READSTAT_TYPE_FLOAT: - /* "pyreadstat/_readstat_parser.pyx":624 - * if readstat_value_is_missing(value, variable): - * # The user does not want to retrieve missing values - * if not dc.usernan or readstat_value_is_system_missing(value): # <<<<<<<<<<<<<< - * if iscurnptypefloat == 1 or iscurnptypeobject == 1: - * # already allocated + /* "pyreadstat/_readstat_parser.pyx":312 + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_FLOAT: + * c_float_value = readstat_float_value(value) # <<<<<<<<<<<<<< + * py_float_value = c_float_value + * pyformat = VAR_FORMAT_FLOAT */ - goto __pyx_L10; - } + __pyx_v_c_float_value = readstat_float_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":637 - * dc.col_data[index][obs_index:] = np.nan - * #dc.col_data[index][obs_index] = NAN - * elif readstat_value_is_defined_missing(value, variable): # <<<<<<<<<<<<<< - * # SPSS missing values - * pyvalue = convert_readstat_to_python_value(value, index, dc) + /* "pyreadstat/_readstat_parser.pyx":313 + * elif var_type == READSTAT_TYPE_FLOAT: + * c_float_value = readstat_float_value(value) + * py_float_value = c_float_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_FLOAT + * elif var_type == READSTAT_TYPE_DOUBLE: */ - __pyx_t_3 = (readstat_value_is_defined_missing(__pyx_v_value, __pyx_v_variable) != 0); - if (__pyx_t_3) { + __pyx_v_py_float_value = ((double)__pyx_v_c_float_value); - /* "pyreadstat/_readstat_parser.pyx":639 - * elif readstat_value_is_defined_missing(value, variable): - * # SPSS missing values - * pyvalue = convert_readstat_to_python_value(value, index, dc) # <<<<<<<<<<<<<< - * dc.col_data[index][obs_index] = pyvalue - * elif readstat_value_is_tagged_missing(value): + /* "pyreadstat/_readstat_parser.pyx":314 + * c_float_value = readstat_float_value(value) + * py_float_value = c_float_value + * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_DOUBLE: + * c_double_value = readstat_double_value(value); */ - __pyx_t_5 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_value, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_v_pyvalue = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; - /* "pyreadstat/_readstat_parser.pyx":640 - * # SPSS missing values - * pyvalue = convert_readstat_to_python_value(value, index, dc) - * dc.col_data[index][obs_index] = pyvalue # <<<<<<<<<<<<<< - * elif readstat_value_is_tagged_missing(value): - * iscurnptypeobject = dc.col_dtypes_isobject[index] + /* "pyreadstat/_readstat_parser.pyx":311 + * py_long_value = c_int32_value + * pyformat = VAR_FORMAT_LONG + * elif var_type == READSTAT_TYPE_FLOAT: # <<<<<<<<<<<<<< + * c_float_value = readstat_float_value(value) + * py_float_value = c_float_value */ - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 640, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_SetItemInt(__pyx_t_5, __pyx_v_obs_index, __pyx_v_pyvalue, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 640, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + break; + case READSTAT_TYPE_DOUBLE: - /* "pyreadstat/_readstat_parser.pyx":637 - * dc.col_data[index][obs_index:] = np.nan - * #dc.col_data[index][obs_index] = NAN - * elif readstat_value_is_defined_missing(value, variable): # <<<<<<<<<<<<<< - * # SPSS missing values - * pyvalue = convert_readstat_to_python_value(value, index, dc) + /* "pyreadstat/_readstat_parser.pyx":316 + * pyformat = VAR_FORMAT_FLOAT + * elif var_type == READSTAT_TYPE_DOUBLE: + * c_double_value = readstat_double_value(value); # <<<<<<<<<<<<<< + * py_float_value = c_double_value + * pyformat = VAR_FORMAT_FLOAT */ - goto __pyx_L10; - } + __pyx_v_c_double_value = readstat_double_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":641 - * pyvalue = convert_readstat_to_python_value(value, index, dc) - * dc.col_data[index][obs_index] = pyvalue - * elif readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< - * iscurnptypeobject = dc.col_dtypes_isobject[index] - * # SAS and Stata missing values + /* "pyreadstat/_readstat_parser.pyx":317 + * elif var_type == READSTAT_TYPE_DOUBLE: + * c_double_value = readstat_double_value(value); + * py_float_value = c_double_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_FLOAT + * else: */ - __pyx_t_3 = (readstat_value_is_tagged_missing(__pyx_v_value) != 0); - if (__pyx_t_3) { + __pyx_v_py_float_value = ((double)__pyx_v_c_double_value); - /* "pyreadstat/_readstat_parser.pyx":642 - * dc.col_data[index][obs_index] = pyvalue - * elif readstat_value_is_tagged_missing(value): - * iscurnptypeobject = dc.col_dtypes_isobject[index] # <<<<<<<<<<<<<< - * # SAS and Stata missing values - * missing_tag = readstat_value_tag(value) + /* "pyreadstat/_readstat_parser.pyx":318 + * c_double_value = readstat_double_value(value); + * py_float_value = c_double_value + * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("Unkown data type") */ - if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 642, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_iscurnptypeobject = __pyx_t_3; + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; - /* "pyreadstat/_readstat_parser.pyx":644 - * iscurnptypeobject = dc.col_dtypes_isobject[index] - * # SAS and Stata missing values - * missing_tag = readstat_value_tag(value) # <<<<<<<<<<<<<< - * # In SAS missing values are A to Z or _ in stata a to z - * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): + /* "pyreadstat/_readstat_parser.pyx":315 + * py_float_value = c_float_value + * pyformat = VAR_FORMAT_FLOAT + * elif var_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< + * c_double_value = readstat_double_value(value); + * py_float_value = c_double_value */ - __pyx_v_missing_tag = ((int)readstat_value_tag(__pyx_v_value)); + break; + default: - /* "pyreadstat/_readstat_parser.pyx":647 - * # In SAS missing values are A to Z or _ in stata a to z - * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): - * if iscurnptypeobject == 1: # <<<<<<<<<<<<<< - * dc.col_data[index][obs_index] = chr(missing_tag) - * else: + /* "pyreadstat/_readstat_parser.pyx":320 + * pyformat = VAR_FORMAT_FLOAT + * else: + * raise PyreadstatError("Unkown data type") # <<<<<<<<<<<<<< + * + * # final transformation and storage */ - __pyx_t_3 = ((__pyx_v_iscurnptypeobject == 1) != 0); - if (__pyx_t_3) { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = NULL; + __pyx_t_8 = 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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_Unkown_data_type}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 320, __pyx_L1_error) + break; + } - /* "pyreadstat/_readstat_parser.pyx":648 - * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): - * if iscurnptypeobject == 1: - * dc.col_data[index][obs_index] = chr(missing_tag) # <<<<<<<<<<<<<< - * else: - * dc.col_numpy_dtypes[index] = object + /* "pyreadstat/_readstat_parser.pyx":324 + * # final transformation and storage + * + * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + * result = py_str_value */ - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 648, __pyx_L1_error) - } - __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_SetItemInt(__pyx_t_5, __pyx_v_obs_index, __pyx_t_8, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 648, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + switch (__pyx_v_pyformat) { + case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING: - /* "pyreadstat/_readstat_parser.pyx":647 - * # In SAS missing values are A to Z or _ in stata a to z - * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): - * if iscurnptypeobject == 1: # <<<<<<<<<<<<<< - * dc.col_data[index][obs_index] = chr(missing_tag) - * else: + /* "pyreadstat/_readstat_parser.pyx":325 + * + * if pyformat == VAR_FORMAT_STRING: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< + * result = py_str_value + * else: */ - goto __pyx_L16; - } + __pyx_t_9 = (__pyx_v_var_format == __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE); + if (!__pyx_t_9) { + } else { + __pyx_t_4 = __pyx_t_9; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_4 = __pyx_v_dc->no_datetime_conversion; + __pyx_L5_bool_binop_done:; + if (likely(__pyx_t_4)) { - /* "pyreadstat/_readstat_parser.pyx":650 - * dc.col_data[index][obs_index] = chr(missing_tag) - * else: - * dc.col_numpy_dtypes[index] = object # <<<<<<<<<<<<<< - * dc.col_dtypes_isobject[index] = 1 - * dc.col_dytpes_isfloat[index] = 0 + /* "pyreadstat/_readstat_parser.pyx":326 + * if pyformat == VAR_FORMAT_STRING: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + * result = py_str_value # <<<<<<<<<<<<<< + * else: + * #str_byte_val = py_str_value.encode("UTF-8") */ - /*else*/ { - if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 650, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, __pyx_builtin_object, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 650, __pyx_L1_error) + if (unlikely(!__pyx_v_py_str_value)) { __Pyx_RaiseUnboundLocalError("py_str_value"); __PYX_ERR(0, 326, __pyx_L1_error) } + __Pyx_INCREF(__pyx_v_py_str_value); + __pyx_v_result = __pyx_v_py_str_value; - /* "pyreadstat/_readstat_parser.pyx":651 - * else: - * dc.col_numpy_dtypes[index] = object - * dc.col_dtypes_isobject[index] = 1 # <<<<<<<<<<<<<< - * dc.col_dytpes_isfloat[index] = 0 - * iscurnptypeobject = 1 + /* "pyreadstat/_readstat_parser.pyx":325 + * + * if pyformat == VAR_FORMAT_STRING: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< + * result = py_str_value + * else: */ - if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 651, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, __pyx_int_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 651, __pyx_L1_error) + goto __pyx_L4; + } - /* "pyreadstat/_readstat_parser.pyx":652 - * dc.col_numpy_dtypes[index] = object - * dc.col_dtypes_isobject[index] = 1 - * dc.col_dytpes_isfloat[index] = 0 # <<<<<<<<<<<<<< - * iscurnptypeobject = 1 - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) + /* "pyreadstat/_readstat_parser.pyx":329 + * else: + * #str_byte_val = py_str_value.encode("UTF-8") + * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) # <<<<<<<<<<<<<< + * elif pyformat == VAR_FORMAT_LONG: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: */ - if (unlikely(__pyx_v_dc->col_dytpes_isfloat == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 652, __pyx_L1_error) + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(!__pyx_v_py_str_value)) { __Pyx_RaiseUnboundLocalError("py_str_value"); __PYX_ERR(0, 329, __pyx_L1_error) } + if (unlikely(__pyx_v_dc->col_names == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 329, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_dc->col_names, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_py_str_value); + __Pyx_GIVEREF(__pyx_v_py_str_value); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_py_str_value); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_STRING_type_with_value_s_with_da, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_8 = 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_8 = 1; } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_dytpes_isfloat, __pyx_v_index, __pyx_int_0, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 652, __pyx_L1_error) + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 329, __pyx_L1_error) + } + __pyx_L4:; - /* "pyreadstat/_readstat_parser.pyx":653 - * dc.col_dtypes_isobject[index] = 1 - * dc.col_dytpes_isfloat[index] = 0 - * iscurnptypeobject = 1 # <<<<<<<<<<<<<< - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) - * dc.col_data[index][obs_index] = chr(missing_tag) + /* "pyreadstat/_readstat_parser.pyx":324 + * # final transformation and storage + * + * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + * result = py_str_value */ - __pyx_v_iscurnptypeobject = 1; + break; + case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG: - /* "pyreadstat/_readstat_parser.pyx":654 - * dc.col_dytpes_isfloat[index] = 0 - * iscurnptypeobject = 1 - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) # <<<<<<<<<<<<<< - * dc.col_data[index][obs_index] = chr(missing_tag) - * curset = dc.missing_user_values.get(index) + /* "pyreadstat/_readstat_parser.pyx":331 + * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) + * elif pyformat == VAR_FORMAT_LONG: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< + * result = py_long_value + * else: */ - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 654, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(0, 654, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__7, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 654, __pyx_L1_error) - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_dc->col_data, __pyx_v_index, __pyx_t_7, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_9 = (__pyx_v_var_format == __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE); + if (!__pyx_t_9) { + } else { + __pyx_t_4 = __pyx_t_9; + goto __pyx_L8_bool_binop_done; + } + __pyx_t_4 = __pyx_v_dc->no_datetime_conversion; + __pyx_L8_bool_binop_done:; + if (__pyx_t_4) { - /* "pyreadstat/_readstat_parser.pyx":655 - * iscurnptypeobject = 1 - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) - * dc.col_data[index][obs_index] = chr(missing_tag) # <<<<<<<<<<<<<< - * curset = dc.missing_user_values.get(index) - * if curset is None: + /* "pyreadstat/_readstat_parser.pyx":332 + * elif pyformat == VAR_FORMAT_LONG: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + * result = py_long_value # <<<<<<<<<<<<<< + * else: + * tstamp = py_long_value */ - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 655, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (unlikely(__Pyx_SetItemInt(__pyx_t_7, __pyx_v_obs_index, __pyx_t_8, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 655, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __pyx_L16:; + __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_py_long_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_result = __pyx_t_6; + __pyx_t_6 = 0; - /* "pyreadstat/_readstat_parser.pyx":656 - * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) - * dc.col_data[index][obs_index] = chr(missing_tag) - * curset = dc.missing_user_values.get(index) # <<<<<<<<<<<<<< - * if curset is None: - * curset = set() + /* "pyreadstat/_readstat_parser.pyx":331 + * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) + * elif pyformat == VAR_FORMAT_LONG: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< + * result = py_long_value + * else: */ - if (unlikely(__pyx_v_dc->missing_user_values == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 656, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyDict_GetItemDefault(__pyx_v_dc->missing_user_values, __pyx_t_8, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 656, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(PySet_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 656, __pyx_L1_error) - __pyx_v_curset = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; + goto __pyx_L7; + } - /* "pyreadstat/_readstat_parser.pyx":657 - * dc.col_data[index][obs_index] = chr(missing_tag) - * curset = dc.missing_user_values.get(index) - * if curset is None: # <<<<<<<<<<<<<< - * curset = set() - * curset.add(chr(missing_tag)) + /* "pyreadstat/_readstat_parser.pyx":334 + * result = py_long_value + * else: + * tstamp = py_long_value # <<<<<<<<<<<<<< + * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) + * elif pyformat == VAR_FORMAT_FLOAT: */ - __pyx_t_3 = (__pyx_v_curset == ((PyObject*)Py_None)); - __pyx_t_6 = (__pyx_t_3 != 0); - if (__pyx_t_6) { + /*else*/ { + __pyx_v_tstamp = ((double)__pyx_v_py_long_value); - /* "pyreadstat/_readstat_parser.pyx":658 - * curset = dc.missing_user_values.get(index) - * if curset is None: - * curset = set() # <<<<<<<<<<<<<< - * curset.add(chr(missing_tag)) - * dc.missing_user_values[index] = curset + /* "pyreadstat/_readstat_parser.pyx":335 + * else: + * tstamp = py_long_value + * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) # <<<<<<<<<<<<<< + * elif pyformat == VAR_FORMAT_FLOAT: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: */ - __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 658, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF_SET(__pyx_v_curset, ((PyObject*)__pyx_t_7)); - __pyx_t_7 = 0; + __pyx_t_6 = __pyx_f_10pyreadstat_16_readstat_parser_transform_datetime(__pyx_v_var_format, __pyx_v_tstamp, __pyx_v_file_format, __pyx_v_origin, __pyx_v_dates_as_pandas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 335, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_result = __pyx_t_6; + __pyx_t_6 = 0; + } + __pyx_L7:; - /* "pyreadstat/_readstat_parser.pyx":657 - * dc.col_data[index][obs_index] = chr(missing_tag) - * curset = dc.missing_user_values.get(index) - * if curset is None: # <<<<<<<<<<<<<< - * curset = set() - * curset.add(chr(missing_tag)) + /* "pyreadstat/_readstat_parser.pyx":330 + * #str_byte_val = py_str_value.encode("UTF-8") + * raise PyreadstatError("STRING type with value '%s' with date type in column '%s'" % (py_str_value, dc.col_names[index])) + * elif pyformat == VAR_FORMAT_LONG: # <<<<<<<<<<<<<< + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + * result = py_long_value */ - } + break; + case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT: - /* "pyreadstat/_readstat_parser.pyx":659 - * if curset is None: - * curset = set() - * curset.add(chr(missing_tag)) # <<<<<<<<<<<<<< - * dc.missing_user_values[index] = curset - * else: + /* "pyreadstat/_readstat_parser.pyx":337 + * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) + * elif pyformat == VAR_FORMAT_FLOAT: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< + * result = py_float_value + * else: */ - if (unlikely(__pyx_v_curset == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add"); - __PYX_ERR(0, 659, __pyx_L1_error) - } - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_9 = PySet_Add(__pyx_v_curset, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 659, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_9 = (__pyx_v_var_format == __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE); + if (!__pyx_t_9) { + } else { + __pyx_t_4 = __pyx_t_9; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_4 = __pyx_v_dc->no_datetime_conversion; + __pyx_L11_bool_binop_done:; + if (__pyx_t_4) { - /* "pyreadstat/_readstat_parser.pyx":660 - * curset = set() - * curset.add(chr(missing_tag)) - * dc.missing_user_values[index] = curset # <<<<<<<<<<<<<< - * else: - * pyvalue = convert_readstat_to_python_value(value, index, dc) + /* "pyreadstat/_readstat_parser.pyx":338 + * elif pyformat == VAR_FORMAT_FLOAT: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + * result = py_float_value # <<<<<<<<<<<<<< + * else: + * #tstamp = py_float_value */ - if (unlikely(__pyx_v_dc->missing_user_values == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 660, __pyx_L1_error) - } - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyDict_SetItem(__pyx_v_dc->missing_user_values, __pyx_t_8, __pyx_v_curset) < 0)) __PYX_ERR(0, 660, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_py_float_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 338, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_result = __pyx_t_6; + __pyx_t_6 = 0; - /* "pyreadstat/_readstat_parser.pyx":641 - * pyvalue = convert_readstat_to_python_value(value, index, dc) - * dc.col_data[index][obs_index] = pyvalue - * elif readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< - * iscurnptypeobject = dc.col_dtypes_isobject[index] - * # SAS and Stata missing values + /* "pyreadstat/_readstat_parser.pyx":337 + * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) + * elif pyformat == VAR_FORMAT_FLOAT: + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: # <<<<<<<<<<<<<< + * result = py_float_value + * else: */ + goto __pyx_L10; } - __pyx_L10:; - /* "pyreadstat/_readstat_parser.pyx":622 - * - * # transform to python value types - * if readstat_value_is_missing(value, variable): # <<<<<<<<<<<<<< - * # The user does not want to retrieve missing values - * if not dc.usernan or readstat_value_is_system_missing(value): + /* "pyreadstat/_readstat_parser.pyx":341 + * else: + * #tstamp = py_float_value + * tstamp = py_float_value # <<<<<<<<<<<<<< + * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) + * #elif pyformat == VAR_FORMAT_MISSING: */ - goto __pyx_L9; - } + /*else*/ { + __pyx_v_tstamp = __pyx_v_py_float_value; - /* "pyreadstat/_readstat_parser.pyx":662 - * dc.missing_user_values[index] = curset - * else: - * pyvalue = convert_readstat_to_python_value(value, index, dc) # <<<<<<<<<<<<<< - * dc.col_data[index][obs_index] = pyvalue - * + /* "pyreadstat/_readstat_parser.pyx":342 + * #tstamp = py_float_value + * tstamp = py_float_value + * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) # <<<<<<<<<<<<<< + * #elif pyformat == VAR_FORMAT_MISSING: + * # pass */ - /*else*/ { - __pyx_t_8 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_value, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 662, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_v_pyvalue = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_6 = __pyx_f_10pyreadstat_16_readstat_parser_transform_datetime(__pyx_v_var_format, __pyx_v_tstamp, __pyx_v_file_format, __pyx_v_origin, __pyx_v_dates_as_pandas); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_v_result = __pyx_t_6; + __pyx_t_6 = 0; + } + __pyx_L10:; - /* "pyreadstat/_readstat_parser.pyx":663 + /* "pyreadstat/_readstat_parser.pyx":336 + * tstamp = py_long_value + * result = transform_datetime(var_format, tstamp, file_format, origin, dates_as_pandas) + * elif pyformat == VAR_FORMAT_FLOAT: # <<<<<<<<<<<<<< + * if var_format == DATE_FORMAT_NOTADATE or dc.no_datetime_conversion: + * result = py_float_value + */ + break; + default: + + /* "pyreadstat/_readstat_parser.pyx":346 + * # pass * else: - * pyvalue = convert_readstat_to_python_value(value, index, dc) - * dc.col_data[index][obs_index] = pyvalue # <<<<<<<<<<<<<< + * raise PyreadstatError("Failed convert C to python value") # <<<<<<<<<<<<<< * - * return READSTAT_HANDLER_OK + * return result */ - if (unlikely(__pyx_v_dc->col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = NULL; + __pyx_t_8 = 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_8 = 1; + } } - __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(__Pyx_SetItemInt(__pyx_t_8, __pyx_v_obs_index, __pyx_v_pyvalue, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 663, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_Failed_convert_C_to_python_value}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 346, __pyx_L1_error) + break; } - __pyx_L9:; - /* "pyreadstat/_readstat_parser.pyx":665 - * dc.col_data[index][obs_index] = pyvalue + /* "pyreadstat/_readstat_parser.pyx":348 + * raise PyreadstatError("Failed convert C to python value") * - * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + * return result # <<<<<<<<<<<<<< * * */ - __pyx_r = READSTAT_HANDLER_OK; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":575 + /* "pyreadstat/_readstat_parser.pyx":258 * * - * cdef int handle_value(int obs_index, readstat_variable_t * variable, readstat_value_t value, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * cdef object convert_readstat_to_python_value(readstat_value_t value, int index, data_container dc): # <<<<<<<<<<<<<< * """ - * This function transforms every value to python types, and to datetime if + * Converts a readstat value to a python value. */ /* 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_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = READSTAT_HANDLER_ABORT; + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("pyreadstat._readstat_parser.convert_readstat_to_python_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_dc); - __Pyx_XDECREF(__pyx_v_buf_list); - __Pyx_XDECREF(__pyx_v_pyvalue); - __Pyx_XDECREF(__pyx_v_curset); - __Pyx_XDECREF(__pyx_v_curnptype); + __Pyx_XDECREF(__pyx_v_origin); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_py_str_value); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":668 +/* "pyreadstat/_readstat_parser.pyx":351 * * - * cdef int handle_value_label(char *val_labels, readstat_value_t value, char *label, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * cdef int handle_metadata(readstat_metadata_t *metadata, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< * """ - * Reads the label for the value that belongs to the label set val_labels. In Handle variable we need to do a map + * This function sets the number of observations(rows), number of variables */ -static int __pyx_f_10pyreadstat_16_readstat_parser_handle_value_label(char *__pyx_v_val_labels, readstat_value_t __pyx_v_value, char *__pyx_v_label, void *__pyx_v_ctx) { +static int __pyx_f_10pyreadstat_16_readstat_parser_handle_metadata(readstat_metadata_t *__pyx_v_metadata, void *__pyx_v_ctx) { + int __pyx_v_var_count; + int __pyx_v_obs_count; struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; - char *__pyx_v_c_str_value; - PyObject *__pyx_v_py_str_value = 0; - int8_t __pyx_v_c_int8_value; - int16_t __pyx_v_c_int16_value; - int32_t __pyx_v_c_int32_value; - float __pyx_v_c_float_value; - double __pyx_v_c_double_value; - long __pyx_v_py_long_value; - double __pyx_v_py_float_value; - __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format __pyx_v_pyformat; - PyObject *__pyx_v_labels_raw = 0; - PyObject *__pyx_v_var_label = 0; - PyObject *__pyx_v_value_label_name = 0; - readstat_type_t __pyx_v_value_type; - PyObject *__pyx_v_cur_dict = NULL; - int __pyx_v_missing_tag; + char *__pyx_v_flabel_orig; + char *__pyx_v_fencoding_orig; + PyObject *__pyx_v_flabel = 0; + PyObject *__pyx_v_fencoding = 0; + CYTHON_UNUSED int __pyx_v_metaonly; + char *__pyx_v_table; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle_value_label", 0); + __Pyx_RefNannySetupContext("handle_metadata", 0); - /* "pyreadstat/_readstat_parser.pyx":674 - * """ + /* "pyreadstat/_readstat_parser.pyx":360 * + * cdef int var_count, obs_count * cdef data_container dc = ctx # <<<<<<<<<<<<<< - * - * cdef char * c_str_value + * #cdef object row + * cdef char * flabel_orig */ __pyx_t_1 = ((PyObject *)__pyx_v_ctx); __Pyx_INCREF(__pyx_t_1); __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":692 - * cdef str value_label_name + /* "pyreadstat/_readstat_parser.pyx":368 + * cdef char * table * - * var_label = val_labels # <<<<<<<<<<<<<< - * value_label_name = label + * metaonly = dc.metaonly # <<<<<<<<<<<<<< * + * var_count = readstat_get_var_count(metadata) */ - __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_val_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_var_label = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_2 = __pyx_v_dc->metaonly; + __pyx_v_metaonly = __pyx_t_2; - /* "pyreadstat/_readstat_parser.pyx":693 - * - * var_label = val_labels - * value_label_name = label # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":370 + * metaonly = dc.metaonly * - * cdef readstat_type_t value_type + * var_count = readstat_get_var_count(metadata) # <<<<<<<<<<<<<< + * if var_count<0: + * raise PyreadstatError("Failed to read number of variables") */ - __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __pyx_t_2; - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_value_label_name = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_var_count = readstat_get_var_count(__pyx_v_metadata); - /* "pyreadstat/_readstat_parser.pyx":696 - * - * cdef readstat_type_t value_type - * value_type = readstat_value_type(value) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":371 * - * labels_raw = dc.labels_raw + * var_count = readstat_get_var_count(metadata) + * if var_count<0: # <<<<<<<<<<<<<< + * raise PyreadstatError("Failed to read number of variables") + * obs_count = readstat_get_row_count(metadata) */ - __pyx_v_value_type = readstat_value_type(__pyx_v_value); + __pyx_t_2 = (__pyx_v_var_count < 0); + if (unlikely(__pyx_t_2)) { - /* "pyreadstat/_readstat_parser.pyx":698 - * value_type = readstat_value_type(value) - * - * labels_raw = dc.labels_raw # <<<<<<<<<<<<<< - * cur_dict = labels_raw.get(var_label) - * if not cur_dict: + /* "pyreadstat/_readstat_parser.pyx":372 + * var_count = readstat_get_var_count(metadata) + * if var_count<0: + * raise PyreadstatError("Failed to read number of variables") # <<<<<<<<<<<<<< + * obs_count = readstat_get_row_count(metadata) + * if obs_count <0: */ - __pyx_t_1 = __pyx_v_dc->labels_raw; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_labels_raw = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 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_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_s_Failed_to_read_number_of_variabl}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __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, 372, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":699 + /* "pyreadstat/_readstat_parser.pyx":371 * - * labels_raw = dc.labels_raw - * cur_dict = labels_raw.get(var_label) # <<<<<<<<<<<<<< - * if not cur_dict: - * cur_dict = dict() + * var_count = readstat_get_var_count(metadata) + * if var_count<0: # <<<<<<<<<<<<<< + * raise PyreadstatError("Failed to read number of variables") + * obs_count = readstat_get_row_count(metadata) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_labels_raw, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __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_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_var_label) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_var_label); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_cur_dict = __pyx_t_1; - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":700 - * labels_raw = dc.labels_raw - * cur_dict = labels_raw.get(var_label) - * if not cur_dict: # <<<<<<<<<<<<<< - * cur_dict = dict() - * + /* "pyreadstat/_readstat_parser.pyx":373 + * if var_count<0: + * raise PyreadstatError("Failed to read number of variables") + * obs_count = readstat_get_row_count(metadata) # <<<<<<<<<<<<<< + * if obs_count <0: + * # if <0 it means the number of rows is not known, allocate 100 000 */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_cur_dict); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 700, __pyx_L1_error) - __pyx_t_5 = ((!__pyx_t_4) != 0); - if (__pyx_t_5) { + __pyx_v_obs_count = readstat_get_row_count(__pyx_v_metadata); - /* "pyreadstat/_readstat_parser.pyx":701 - * cur_dict = labels_raw.get(var_label) - * if not cur_dict: - * cur_dict = dict() # <<<<<<<<<<<<<< - * - * if readstat_value_is_tagged_missing(value): + /* "pyreadstat/_readstat_parser.pyx":374 + * raise PyreadstatError("Failed to read number of variables") + * obs_count = readstat_get_row_count(metadata) + * if obs_count <0: # <<<<<<<<<<<<<< + * # if <0 it means the number of rows is not known, allocate 100 000 + * obs_count = 100000 */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_cur_dict, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_v_obs_count < 0); + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":700 - * labels_raw = dc.labels_raw - * cur_dict = labels_raw.get(var_label) - * if not cur_dict: # <<<<<<<<<<<<<< - * cur_dict = dict() + /* "pyreadstat/_readstat_parser.pyx":376 + * if obs_count <0: + * # if <0 it means the number of rows is not known, allocate 100 000 + * obs_count = 100000 # <<<<<<<<<<<<<< + * dc.is_unkown_number_rows = 1 * */ - } + __pyx_v_obs_count = 0x186A0; - /* "pyreadstat/_readstat_parser.pyx":703 - * cur_dict = dict() + /* "pyreadstat/_readstat_parser.pyx":377 + * # if <0 it means the number of rows is not known, allocate 100 000 + * obs_count = 100000 + * dc.is_unkown_number_rows = 1 # <<<<<<<<<<<<<< * - * if readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< - * # SAS and Stata missing values - * missing_tag = readstat_value_tag(value) + * dc.n_obs = obs_count */ - __pyx_t_5 = (readstat_value_is_tagged_missing(__pyx_v_value) != 0); - if (__pyx_t_5) { + __pyx_v_dc->is_unkown_number_rows = 1; - /* "pyreadstat/_readstat_parser.pyx":705 - * if readstat_value_is_tagged_missing(value): - * # SAS and Stata missing values - * missing_tag = readstat_value_tag(value) # <<<<<<<<<<<<<< - * # In SAS missing values are A to Z or _ in stata a to z - * cur_dict[chr(missing_tag)] = value_label_name + /* "pyreadstat/_readstat_parser.pyx":374 + * raise PyreadstatError("Failed to read number of variables") + * obs_count = readstat_get_row_count(metadata) + * if obs_count <0: # <<<<<<<<<<<<<< + * # if <0 it means the number of rows is not known, allocate 100 000 + * obs_count = 100000 */ - __pyx_v_missing_tag = ((int)readstat_value_tag(__pyx_v_value)); + } - /* "pyreadstat/_readstat_parser.pyx":707 - * missing_tag = readstat_value_tag(value) - * # In SAS missing values are A to Z or _ in stata a to z - * cur_dict[chr(missing_tag)] = value_label_name # <<<<<<<<<<<<<< - * else: + /* "pyreadstat/_readstat_parser.pyx":379 + * dc.is_unkown_number_rows = 1 + * + * dc.n_obs = obs_count # <<<<<<<<<<<<<< + * dc.n_vars = var_count * */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 707, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_cur_dict, __pyx_t_2, __pyx_v_value_label_name) < 0)) __PYX_ERR(0, 707, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_dc->n_obs = __pyx_v_obs_count; - /* "pyreadstat/_readstat_parser.pyx":703 - * cur_dict = dict() + /* "pyreadstat/_readstat_parser.pyx":380 * - * if readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< - * # SAS and Stata missing values - * missing_tag = readstat_value_tag(value) + * dc.n_obs = obs_count + * dc.n_vars = var_count # <<<<<<<<<<<<<< + * + * dc.col_data_len = [obs_count] * var_count */ - goto __pyx_L4; - } + __pyx_v_dc->n_vars = __pyx_v_var_count; - /* "pyreadstat/_readstat_parser.pyx":710 - * else: + /* "pyreadstat/_readstat_parser.pyx":382 + * dc.n_vars = var_count * - * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< - * c_str_value = readstat_string_value(value) - * py_str_value = c_str_value + * dc.col_data_len = [obs_count] * var_count # <<<<<<<<<<<<<< + * dc.col_numpy_dtypes = [None] * var_count + * dc.col_dytpes_isfloat = [0] * var_count */ - /*else*/ { + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_obs_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_t_1); + } + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_dc->col_data_len); + __Pyx_DECREF(__pyx_v_dc->col_data_len); + __pyx_v_dc->col_data_len = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":730 - * py_float_value = c_float_value - * pyformat = VAR_FORMAT_FLOAT - * elif value_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< - * c_double_value = readstat_double_value(value); - * py_float_value = c_double_value + /* "pyreadstat/_readstat_parser.pyx":383 + * + * dc.col_data_len = [obs_count] * var_count + * dc.col_numpy_dtypes = [None] * var_count # <<<<<<<<<<<<<< + * dc.col_dytpes_isfloat = [0] * var_count + * dc.col_dtypes_isobject = [0] * var_count */ - switch (__pyx_v_value_type) { - case READSTAT_TYPE_STRING: + __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None); + } + } + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_dc->col_numpy_dtypes); + __Pyx_DECREF(__pyx_v_dc->col_numpy_dtypes); + __pyx_v_dc->col_numpy_dtypes = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":710 - * else: + /* "pyreadstat/_readstat_parser.pyx":384 + * dc.col_data_len = [obs_count] * var_count + * dc.col_numpy_dtypes = [None] * var_count + * dc.col_dytpes_isfloat = [0] * var_count # <<<<<<<<<<<<<< + * dc.col_dtypes_isobject = [0] * var_count * - * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< - * c_str_value = readstat_string_value(value) - * py_str_value = c_str_value */ - case READSTAT_TYPE_STRING_REF: + __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_int_0); + } + } + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_dc->col_dytpes_isfloat); + __Pyx_DECREF(__pyx_v_dc->col_dytpes_isfloat); + __pyx_v_dc->col_dytpes_isfloat = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":711 + /* "pyreadstat/_readstat_parser.pyx":385 + * dc.col_numpy_dtypes = [None] * var_count + * dc.col_dytpes_isfloat = [0] * var_count + * dc.col_dtypes_isobject = [0] * var_count # <<<<<<<<<<<<<< * - * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: - * c_str_value = readstat_string_value(value) # <<<<<<<<<<<<<< - * py_str_value = c_str_value - * pyformat = VAR_FORMAT_STRING + * # read other metadata */ - __pyx_v_c_str_value = readstat_string_value(__pyx_v_value); + __pyx_t_3 = PyList_New(1 * ((__pyx_v_var_count<0) ? 0:__pyx_v_var_count)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_var_count; __pyx_temp++) { + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_int_0); + } + } + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_dc->col_dtypes_isobject); + __Pyx_DECREF(__pyx_v_dc->col_dtypes_isobject); + __pyx_v_dc->col_dtypes_isobject = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":712 - * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: - * c_str_value = readstat_string_value(value) - * py_str_value = c_str_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_STRING - * elif value_type == READSTAT_TYPE_INT8: + /* "pyreadstat/_readstat_parser.pyx":388 + * + * # read other metadata + * flabel_orig = readstat_get_file_label(metadata); # <<<<<<<<<<<<<< + * fencoding_orig = readstat_get_file_encoding(metadata) + * if flabel_orig != NULL and flabel_orig[0]: */ - __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_c_str_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __pyx_t_2; - __Pyx_INCREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_py_str_value = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_flabel_orig = readstat_get_file_label(__pyx_v_metadata); - /* "pyreadstat/_readstat_parser.pyx":713 - * c_str_value = readstat_string_value(value) - * py_str_value = c_str_value - * pyformat = VAR_FORMAT_STRING # <<<<<<<<<<<<<< - * elif value_type == READSTAT_TYPE_INT8: - * c_int8_value = readstat_int8_value(value) + /* "pyreadstat/_readstat_parser.pyx":389 + * # read other metadata + * flabel_orig = readstat_get_file_label(metadata); + * fencoding_orig = readstat_get_file_encoding(metadata) # <<<<<<<<<<<<<< + * if flabel_orig != NULL and flabel_orig[0]: + * flabel = flabel_orig */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING; + __pyx_v_fencoding_orig = readstat_get_file_encoding(__pyx_v_metadata); - /* "pyreadstat/_readstat_parser.pyx":710 + /* "pyreadstat/_readstat_parser.pyx":390 + * flabel_orig = readstat_get_file_label(metadata); + * fencoding_orig = readstat_get_file_encoding(metadata) + * if flabel_orig != NULL and flabel_orig[0]: # <<<<<<<<<<<<<< + * flabel = flabel_orig * else: - * - * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< - * c_str_value = readstat_string_value(value) - * py_str_value = c_str_value */ - break; - case READSTAT_TYPE_INT8: + __pyx_t_6 = (__pyx_v_flabel_orig != NULL); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_flabel_orig[0]) != 0); + __pyx_t_2 = __pyx_t_6; + __pyx_L6_bool_binop_done:; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":715 - * pyformat = VAR_FORMAT_STRING - * elif value_type == READSTAT_TYPE_INT8: - * c_int8_value = readstat_int8_value(value) # <<<<<<<<<<<<<< - * py_long_value = c_int8_value - * pyformat = VAR_FORMAT_LONG + /* "pyreadstat/_readstat_parser.pyx":391 + * fencoding_orig = readstat_get_file_encoding(metadata) + * if flabel_orig != NULL and flabel_orig[0]: + * flabel = flabel_orig # <<<<<<<<<<<<<< + * else: + * flabel = None */ - __pyx_v_c_int8_value = readstat_int8_value(__pyx_v_value); + __pyx_t_3 = __Pyx_PyStr_FromString(__pyx_v_flabel_orig); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_flabel = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":716 - * elif value_type == READSTAT_TYPE_INT8: - * c_int8_value = readstat_int8_value(value) - * py_long_value = c_int8_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_INT16: + /* "pyreadstat/_readstat_parser.pyx":390 + * flabel_orig = readstat_get_file_label(metadata); + * fencoding_orig = readstat_get_file_encoding(metadata) + * if flabel_orig != NULL and flabel_orig[0]: # <<<<<<<<<<<<<< + * flabel = flabel_orig + * else: */ - __pyx_v_py_long_value = ((long)__pyx_v_c_int8_value); + goto __pyx_L5; + } - /* "pyreadstat/_readstat_parser.pyx":717 - * c_int8_value = readstat_int8_value(value) - * py_long_value = c_int8_value - * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< - * elif value_type == READSTAT_TYPE_INT16: - * c_int16_value = readstat_int16_value(value) - */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - - /* "pyreadstat/_readstat_parser.pyx":714 - * py_str_value = c_str_value - * pyformat = VAR_FORMAT_STRING - * elif value_type == READSTAT_TYPE_INT8: # <<<<<<<<<<<<<< - * c_int8_value = readstat_int8_value(value) - * py_long_value = c_int8_value + /* "pyreadstat/_readstat_parser.pyx":393 + * flabel = flabel_orig + * else: + * flabel = None # <<<<<<<<<<<<<< + * if fencoding_orig != NULL and fencoding_orig[0]: + * fencoding = fencoding_orig */ - break; - case READSTAT_TYPE_INT16: + /*else*/ { + __Pyx_INCREF(Py_None); + __pyx_v_flabel = ((PyObject*)Py_None); + } + __pyx_L5:; - /* "pyreadstat/_readstat_parser.pyx":719 - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_INT16: - * c_int16_value = readstat_int16_value(value) # <<<<<<<<<<<<<< - * py_long_value = c_int16_value - * pyformat = VAR_FORMAT_LONG + /* "pyreadstat/_readstat_parser.pyx":394 + * else: + * flabel = None + * if fencoding_orig != NULL and fencoding_orig[0]: # <<<<<<<<<<<<<< + * fencoding = fencoding_orig + * else: */ - __pyx_v_c_int16_value = readstat_int16_value(__pyx_v_value); + __pyx_t_6 = (__pyx_v_fencoding_orig != NULL); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L9_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_fencoding_orig[0]) != 0); + __pyx_t_2 = __pyx_t_6; + __pyx_L9_bool_binop_done:; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":720 - * elif value_type == READSTAT_TYPE_INT16: - * c_int16_value = readstat_int16_value(value) - * py_long_value = c_int16_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_INT32: + /* "pyreadstat/_readstat_parser.pyx":395 + * flabel = None + * if fencoding_orig != NULL and fencoding_orig[0]: + * fencoding = fencoding_orig # <<<<<<<<<<<<<< + * else: + * fencoding = None */ - __pyx_v_py_long_value = ((long)__pyx_v_c_int16_value); + __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_fencoding_orig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_fencoding = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":721 - * c_int16_value = readstat_int16_value(value) - * py_long_value = c_int16_value - * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< - * elif value_type == READSTAT_TYPE_INT32: - * c_int32_value = readstat_int32_value(value) + /* "pyreadstat/_readstat_parser.pyx":394 + * else: + * flabel = None + * if fencoding_orig != NULL and fencoding_orig[0]: # <<<<<<<<<<<<<< + * fencoding = fencoding_orig + * else: */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; + goto __pyx_L8; + } - /* "pyreadstat/_readstat_parser.pyx":718 - * py_long_value = c_int8_value - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_INT16: # <<<<<<<<<<<<<< - * c_int16_value = readstat_int16_value(value) - * py_long_value = c_int16_value + /* "pyreadstat/_readstat_parser.pyx":397 + * fencoding = fencoding_orig + * else: + * fencoding = None # <<<<<<<<<<<<<< + * + * dc.file_encoding = fencoding */ - break; - case READSTAT_TYPE_INT32: + /*else*/ { + __Pyx_INCREF(Py_None); + __pyx_v_fencoding = ((PyObject*)Py_None); + } + __pyx_L8:; - /* "pyreadstat/_readstat_parser.pyx":723 - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_INT32: - * c_int32_value = readstat_int32_value(value) # <<<<<<<<<<<<<< - * py_long_value = c_int32_value - * pyformat = VAR_FORMAT_LONG + /* "pyreadstat/_readstat_parser.pyx":399 + * fencoding = None + * + * dc.file_encoding = fencoding # <<<<<<<<<<<<<< + * dc.file_label = flabel + * */ - __pyx_v_c_int32_value = readstat_int32_value(__pyx_v_value); + __Pyx_INCREF(__pyx_v_fencoding); + __Pyx_GIVEREF(__pyx_v_fencoding); + __Pyx_GOTREF(__pyx_v_dc->file_encoding); + __Pyx_DECREF(__pyx_v_dc->file_encoding); + __pyx_v_dc->file_encoding = __pyx_v_fencoding; - /* "pyreadstat/_readstat_parser.pyx":724 - * elif value_type == READSTAT_TYPE_INT32: - * c_int32_value = readstat_int32_value(value) - * py_long_value = c_int32_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_FLOAT: + /* "pyreadstat/_readstat_parser.pyx":400 + * + * dc.file_encoding = fencoding + * dc.file_label = flabel # <<<<<<<<<<<<<< + * + * table = readstat_get_table_name(metadata) */ - __pyx_v_py_long_value = ((long)__pyx_v_c_int32_value); + __Pyx_INCREF(__pyx_v_flabel); + __Pyx_GIVEREF(__pyx_v_flabel); + __Pyx_GOTREF(__pyx_v_dc->file_label); + __Pyx_DECREF(__pyx_v_dc->file_label); + __pyx_v_dc->file_label = __pyx_v_flabel; - /* "pyreadstat/_readstat_parser.pyx":725 - * c_int32_value = readstat_int32_value(value) - * py_long_value = c_int32_value - * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< - * elif value_type == READSTAT_TYPE_FLOAT: - * c_float_value = readstat_float_value(value) + /* "pyreadstat/_readstat_parser.pyx":402 + * dc.file_label = flabel + * + * table = readstat_get_table_name(metadata) # <<<<<<<<<<<<<< + * if table != NULL and table[0]: + * dc.table_name = table */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; + __pyx_v_table = readstat_get_table_name(__pyx_v_metadata); - /* "pyreadstat/_readstat_parser.pyx":722 - * py_long_value = c_int16_value - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_INT32: # <<<<<<<<<<<<<< - * c_int32_value = readstat_int32_value(value) - * py_long_value = c_int32_value + /* "pyreadstat/_readstat_parser.pyx":403 + * + * table = readstat_get_table_name(metadata) + * if table != NULL and table[0]: # <<<<<<<<<<<<<< + * dc.table_name = table + * */ - break; - case READSTAT_TYPE_FLOAT: + __pyx_t_6 = (__pyx_v_table != NULL); + if (__pyx_t_6) { + } else { + __pyx_t_2 = __pyx_t_6; + goto __pyx_L12_bool_binop_done; + } + __pyx_t_6 = ((__pyx_v_table[0]) != 0); + __pyx_t_2 = __pyx_t_6; + __pyx_L12_bool_binop_done:; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":727 - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_FLOAT: - * c_float_value = readstat_float_value(value) # <<<<<<<<<<<<<< - * py_float_value = c_float_value - * pyformat = VAR_FORMAT_FLOAT + /* "pyreadstat/_readstat_parser.pyx":404 + * table = readstat_get_table_name(metadata) + * if table != NULL and table[0]: + * dc.table_name = table # <<<<<<<<<<<<<< + * + * return READSTAT_HANDLER_OK */ - __pyx_v_c_float_value = readstat_float_value(__pyx_v_value); + __pyx_t_3 = __Pyx_PyStr_FromString(__pyx_v_table); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_dc->table_name); + __Pyx_DECREF(__pyx_v_dc->table_name); + __pyx_v_dc->table_name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":728 - * elif value_type == READSTAT_TYPE_FLOAT: - * c_float_value = readstat_float_value(value) - * py_float_value = c_float_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_FLOAT - * elif value_type == READSTAT_TYPE_DOUBLE: + /* "pyreadstat/_readstat_parser.pyx":403 + * + * table = readstat_get_table_name(metadata) + * if table != NULL and table[0]: # <<<<<<<<<<<<<< + * dc.table_name = table + * */ - __pyx_v_py_float_value = ((double)__pyx_v_c_float_value); + } - /* "pyreadstat/_readstat_parser.pyx":729 - * c_float_value = readstat_float_value(value) - * py_float_value = c_float_value - * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< - * elif value_type == READSTAT_TYPE_DOUBLE: - * c_double_value = readstat_double_value(value); + /* "pyreadstat/_readstat_parser.pyx":406 + * dc.table_name = table + * + * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + * + * cdef int handle_variable(int index, readstat_variable_t *variable, */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; + __pyx_r = READSTAT_HANDLER_OK; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":726 - * py_long_value = c_int32_value - * pyformat = VAR_FORMAT_LONG - * elif value_type == READSTAT_TYPE_FLOAT: # <<<<<<<<<<<<<< - * c_float_value = readstat_float_value(value) - * py_float_value = c_float_value + /* "pyreadstat/_readstat_parser.pyx":351 + * + * + * cdef int handle_metadata(readstat_metadata_t *metadata, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * This function sets the number of observations(rows), number of variables */ - break; - case READSTAT_TYPE_DOUBLE: - /* "pyreadstat/_readstat_parser.pyx":731 - * pyformat = VAR_FORMAT_FLOAT - * elif value_type == READSTAT_TYPE_DOUBLE: - * c_double_value = readstat_double_value(value); # <<<<<<<<<<<<<< - * py_float_value = c_double_value - * pyformat = VAR_FORMAT_FLOAT - */ - __pyx_v_c_double_value = readstat_double_value(__pyx_v_value); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = READSTAT_HANDLER_ABORT; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_dc); + __Pyx_XDECREF(__pyx_v_flabel); + __Pyx_XDECREF(__pyx_v_fencoding); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":732 - * elif value_type == READSTAT_TYPE_DOUBLE: - * c_double_value = readstat_double_value(value); - * py_float_value = c_double_value # <<<<<<<<<<<<<< - * pyformat = VAR_FORMAT_FLOAT - * else: - */ - __pyx_v_py_float_value = ((double)__pyx_v_c_double_value); - - /* "pyreadstat/_readstat_parser.pyx":733 - * c_double_value = readstat_double_value(value); - * py_float_value = c_double_value - * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("Unkown data type") +/* "pyreadstat/_readstat_parser.pyx":408 + * return READSTAT_HANDLER_OK + * + * cdef int handle_variable(int index, readstat_variable_t *variable, # <<<<<<<<<<<<<< + * char *val_labels, void *ctx) except READSTAT_HANDLER_ABORT: + * """ */ - __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; - /* "pyreadstat/_readstat_parser.pyx":730 - * py_float_value = c_float_value - * pyformat = VAR_FORMAT_FLOAT - * elif value_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< - * c_double_value = readstat_double_value(value); - * py_float_value = c_double_value - */ - break; - default: +static int __pyx_f_10pyreadstat_16_readstat_parser_handle_variable(int __pyx_v_index, readstat_variable_t *__pyx_v_variable, char *__pyx_v_val_labels, void *__pyx_v_ctx) { + char *__pyx_v_var_name; + char *__pyx_v_var_label; + char *__pyx_v_var_format; + PyObject *__pyx_v_col_name = 0; + PyObject *__pyx_v_col_label = 0; + PyObject *__pyx_v_label_name = 0; + PyObject *__pyx_v_col_format_original = 0; + __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_col_format_final; + readstat_type_t __pyx_v_var_type; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + int __pyx_v_n_ranges; + readstat_value_t __pyx_v_loval; + readstat_value_t __pyx_v_hival; + PyObject *__pyx_v_pyloval = 0; + PyObject *__pyx_v_pyhival = 0; + PyObject *__pyx_v_missing_ranges = 0; + PyObject *__pyx_v_curnptype = 0; + PyObject *__pyx_v_row = 0; + int __pyx_v_metaonly; + int __pyx_v_obs_count; + int __pyx_v_iscurnptypefloat; + int __pyx_v_iscurnptypeobject; + PyObject *__pyx_v_newcolname = 0; + int __pyx_v_dupcolcnt; + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; + PyObject *__pyx_v_msg = NULL; + long __pyx_v_i; + size_t __pyx_v_storage_width; + readstat_alignment_t __pyx_v_align; + PyObject *__pyx_v_pyalign = 0; + readstat_measure_t __pyx_v_measure; + PyObject *__pyx_v_pymeasure = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_t_8; + __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + long __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_variable", 0); - /* "pyreadstat/_readstat_parser.pyx":735 - * pyformat = VAR_FORMAT_FLOAT - * else: - * raise PyreadstatError("Unkown data type") # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":437 + * cdef int dupcolcnt * + * cdef data_container dc = ctx # <<<<<<<<<<<<<< * + * # get variable name, label, format and type and put into our data container */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __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, __pyx_kp_s_Unkown_data_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Unkown_data_type); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 735, __pyx_L1_error) - break; - } + __pyx_t_1 = ((PyObject *)__pyx_v_ctx); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":738 - * + /* "pyreadstat/_readstat_parser.pyx":440 * - * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< - * cur_dict[py_str_value] = value_label_name - * elif pyformat == VAR_FORMAT_LONG: + * # get variable name, label, format and type and put into our data container + * var_name = readstat_variable_get_name(variable) # <<<<<<<<<<<<<< + * if var_name == NULL: + * col_name = None */ - switch (__pyx_v_pyformat) { - case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING: + __pyx_v_var_name = readstat_variable_get_name(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":739 - * - * if pyformat == VAR_FORMAT_STRING: - * cur_dict[py_str_value] = value_label_name # <<<<<<<<<<<<<< - * elif pyformat == VAR_FORMAT_LONG: - * cur_dict[py_long_value] = value_label_name + /* "pyreadstat/_readstat_parser.pyx":441 + * # get variable name, label, format and type and put into our data container + * var_name = readstat_variable_get_name(variable) + * if var_name == NULL: # <<<<<<<<<<<<<< + * col_name = None + * else: */ - if (unlikely(!__pyx_v_py_str_value)) { __Pyx_RaiseUnboundLocalError("py_str_value"); __PYX_ERR(0, 739, __pyx_L1_error) } - if (unlikely(PyObject_SetItem(__pyx_v_cur_dict, __pyx_v_py_str_value, __pyx_v_value_label_name) < 0)) __PYX_ERR(0, 739, __pyx_L1_error) + __pyx_t_2 = (__pyx_v_var_name == NULL); + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":738 - * - * - * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< - * cur_dict[py_str_value] = value_label_name - * elif pyformat == VAR_FORMAT_LONG: + /* "pyreadstat/_readstat_parser.pyx":442 + * var_name = readstat_variable_get_name(variable) + * if var_name == NULL: + * col_name = None # <<<<<<<<<<<<<< + * else: + * col_name = var_name */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG: + __Pyx_INCREF(Py_None); + __pyx_v_col_name = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":741 - * cur_dict[py_str_value] = value_label_name - * elif pyformat == VAR_FORMAT_LONG: - * cur_dict[py_long_value] = value_label_name # <<<<<<<<<<<<<< - * elif pyformat == VAR_FORMAT_FLOAT: - * cur_dict[py_float_value] = value_label_name + /* "pyreadstat/_readstat_parser.pyx":441 + * # get variable name, label, format and type and put into our data container + * var_name = readstat_variable_get_name(variable) + * if var_name == NULL: # <<<<<<<<<<<<<< + * col_name = None + * else: */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_cur_dict, __pyx_v_py_long_value, __pyx_v_value_label_name, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 741, __pyx_L1_error) + goto __pyx_L3; + } - /* "pyreadstat/_readstat_parser.pyx":740 - * if pyformat == VAR_FORMAT_STRING: - * cur_dict[py_str_value] = value_label_name - * elif pyformat == VAR_FORMAT_LONG: # <<<<<<<<<<<<<< - * cur_dict[py_long_value] = value_label_name - * elif pyformat == VAR_FORMAT_FLOAT: + /* "pyreadstat/_readstat_parser.pyx":444 + * col_name = None + * else: + * col_name = var_name # <<<<<<<<<<<<<< + * + * # if the user introduced a list of columns to include, continue only if the column is in the list */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT: + /*else*/ { + __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_var_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_col_name = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L3:; - /* "pyreadstat/_readstat_parser.pyx":743 - * cur_dict[py_long_value] = value_label_name - * elif pyformat == VAR_FORMAT_FLOAT: - * cur_dict[py_float_value] = value_label_name # <<<<<<<<<<<<<< - * elif pyformat == VAR_FORMAT_MISSING: - * pass + /* "pyreadstat/_readstat_parser.pyx":447 + * + * # if the user introduced a list of columns to include, continue only if the column is in the list + * if dc.filter_cols and not (col_name in dc.use_cols): # <<<<<<<<<<<<<< + * dc.n_vars -= 1 + * return READSTAT_HANDLER_SKIP_VARIABLE */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_py_float_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_v_cur_dict, __pyx_t_1, __pyx_v_value_label_name) < 0)) __PYX_ERR(0, 743, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_v_dc->filter_cols) { + } else { + __pyx_t_2 = __pyx_v_dc->filter_cols; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_name, __pyx_v_dc->use_cols, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_2 = __pyx_t_4; + __pyx_L5_bool_binop_done:; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":742 - * elif pyformat == VAR_FORMAT_LONG: - * cur_dict[py_long_value] = value_label_name - * elif pyformat == VAR_FORMAT_FLOAT: # <<<<<<<<<<<<<< - * cur_dict[py_float_value] = value_label_name - * elif pyformat == VAR_FORMAT_MISSING: + /* "pyreadstat/_readstat_parser.pyx":448 + * # if the user introduced a list of columns to include, continue only if the column is in the list + * if dc.filter_cols and not (col_name in dc.use_cols): + * dc.n_vars -= 1 # <<<<<<<<<<<<<< + * return READSTAT_HANDLER_SKIP_VARIABLE + * */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_MISSING: + __pyx_v_dc->n_vars = (__pyx_v_dc->n_vars - 1); - /* "pyreadstat/_readstat_parser.pyx":744 - * elif pyformat == VAR_FORMAT_FLOAT: - * cur_dict[py_float_value] = value_label_name - * elif pyformat == VAR_FORMAT_MISSING: # <<<<<<<<<<<<<< - * pass - * else: + /* "pyreadstat/_readstat_parser.pyx":449 + * if dc.filter_cols and not (col_name in dc.use_cols): + * dc.n_vars -= 1 + * return READSTAT_HANDLER_SKIP_VARIABLE # <<<<<<<<<<<<<< + * + * index = readstat_variable_get_index_after_skipping(variable) */ - break; - default: + __pyx_r = READSTAT_HANDLER_SKIP_VARIABLE; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":747 - * pass - * else: - * raise PyreadstatError("Failed convert C to python value") # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":447 * - * dc.labels_raw[var_label] = cur_dict + * # if the user introduced a list of columns to include, continue only if the column is in the list + * if dc.filter_cols and not (col_name in dc.use_cols): # <<<<<<<<<<<<<< + * dc.n_vars -= 1 + * return READSTAT_HANDLER_SKIP_VARIABLE */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __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, __pyx_kp_s_Failed_convert_C_to_python_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Failed_convert_C_to_python_value); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 747, __pyx_L1_error) - break; - } } - __pyx_L4:; - /* "pyreadstat/_readstat_parser.pyx":749 - * raise PyreadstatError("Failed convert C to python value") + /* "pyreadstat/_readstat_parser.pyx":451 + * return READSTAT_HANDLER_SKIP_VARIABLE * - * dc.labels_raw[var_label] = cur_dict # <<<<<<<<<<<<<< + * index = readstat_variable_get_index_after_skipping(variable) # <<<<<<<<<<<<<< * - * return READSTAT_HANDLER_OK + * if col_name in dc.col_names: */ - if (unlikely(PyObject_SetItem(__pyx_v_dc->labels_raw, __pyx_v_var_label, __pyx_v_cur_dict) < 0)) __PYX_ERR(0, 749, __pyx_L1_error) + __pyx_v_index = readstat_variable_get_index_after_skipping(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":751 - * dc.labels_raw[var_label] = cur_dict - * - * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":453 + * index = readstat_variable_get_index_after_skipping(variable) * - * cdef int handle_note (int note_index, char *note, void *ctx) except READSTAT_HANDLER_ABORT: + * if col_name in dc.col_names: # <<<<<<<<<<<<<< + * dupcolcnt = 1 + * while True: */ - __pyx_r = READSTAT_HANDLER_OK; - goto __pyx_L0; + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_name, __pyx_v_dc->col_names, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 453, __pyx_L1_error) + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":668 - * + /* "pyreadstat/_readstat_parser.pyx":454 * - * cdef int handle_value_label(char *val_labels, readstat_value_t value, char *label, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< - * """ - * Reads the label for the value that belongs to the label set val_labels. In Handle variable we need to do a map + * if col_name in dc.col_names: + * dupcolcnt = 1 # <<<<<<<<<<<<<< + * while True: + * newcolname = col_name + "_duplicated" + str(dupcolcnt) */ + __pyx_v_dupcolcnt = 1; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_value_label", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = READSTAT_HANDLER_ABORT; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_dc); - __Pyx_XDECREF(__pyx_v_py_str_value); - __Pyx_XDECREF(__pyx_v_labels_raw); - __Pyx_XDECREF(__pyx_v_var_label); - __Pyx_XDECREF(__pyx_v_value_label_name); - __Pyx_XDECREF(__pyx_v_cur_dict); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":455 + * if col_name in dc.col_names: + * dupcolcnt = 1 + * while True: # <<<<<<<<<<<<<< + * newcolname = col_name + "_duplicated" + str(dupcolcnt) + * if newcolname in col_name: + */ + while (1) { -/* "pyreadstat/_readstat_parser.pyx":753 - * return READSTAT_HANDLER_OK - * - * cdef int handle_note (int note_index, char *note, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< - * """ - * Collects notes (text annotations) attached to the documents. It happens for spss and stata + /* "pyreadstat/_readstat_parser.pyx":456 + * dupcolcnt = 1 + * while True: + * newcolname = col_name + "_duplicated" + str(dupcolcnt) # <<<<<<<<<<<<<< + * if newcolname in col_name: + * dupcolcnt += 1 */ + __pyx_t_3 = __Pyx_PyStr_ConcatSafe(__pyx_v_col_name, __pyx_n_s_duplicated); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dupcolcnt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_Str(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_newcolname, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; -static int __pyx_f_10pyreadstat_16_readstat_parser_handle_note(CYTHON_UNUSED int __pyx_v_note_index, char *__pyx_v_note, void *__pyx_v_ctx) { - PyObject *__pyx_v_pynote = 0; - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle_note", 0); + /* "pyreadstat/_readstat_parser.pyx":457 + * while True: + * newcolname = col_name + "_duplicated" + str(dupcolcnt) + * if newcolname in col_name: # <<<<<<<<<<<<<< + * dupcolcnt += 1 + * continue + */ + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_newcolname, __pyx_v_col_name, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 457, __pyx_L1_error) + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":759 - * - * cdef str pynote - * cdef data_container dc = ctx # <<<<<<<<<<<<<< - * - * pynote = note + /* "pyreadstat/_readstat_parser.pyx":458 + * newcolname = col_name + "_duplicated" + str(dupcolcnt) + * if newcolname in col_name: + * dupcolcnt += 1 # <<<<<<<<<<<<<< + * continue + * else: */ - __pyx_t_1 = ((PyObject *)__pyx_v_ctx); - __Pyx_INCREF(__pyx_t_1); - __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_dupcolcnt = (__pyx_v_dupcolcnt + 1); - /* "pyreadstat/_readstat_parser.pyx":761 - * cdef data_container dc = ctx - * - * pynote = note # <<<<<<<<<<<<<< - * dc.notes.append(pynote) + /* "pyreadstat/_readstat_parser.pyx":459 + * if newcolname in col_name: + * dupcolcnt += 1 + * continue # <<<<<<<<<<<<<< + * else: + * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) + */ + goto __pyx_L8_continue; + + /* "pyreadstat/_readstat_parser.pyx":457 + * while True: + * newcolname = col_name + "_duplicated" + str(dupcolcnt) + * if newcolname in col_name: # <<<<<<<<<<<<<< + * dupcolcnt += 1 + * continue + */ + } + + /* "pyreadstat/_readstat_parser.pyx":461 + * continue + * else: + * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) # <<<<<<<<<<<<<< + * warnings.warn(msg) + * col_name = newcolname + */ + /*else*/ { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_column_0_is_duplicated_renamed_t, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + 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_6 = 1; + } + } + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_col_name, __pyx_v_newcolname}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_v_msg = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pyreadstat/_readstat_parser.pyx":462 + * else: + * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) + * warnings.warn(msg) # <<<<<<<<<<<<<< + * col_name = newcolname + * break + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_warnings); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_msg}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __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; + + /* "pyreadstat/_readstat_parser.pyx":463 + * msg = "column '{0}' is duplicated, renamed to '{1}'".format(col_name, newcolname) + * warnings.warn(msg) + * col_name = newcolname # <<<<<<<<<<<<<< + * break * */ - __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_note); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_pynote = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v_newcolname); + __Pyx_DECREF_SET(__pyx_v_col_name, __pyx_v_newcolname); - /* "pyreadstat/_readstat_parser.pyx":762 + /* "pyreadstat/_readstat_parser.pyx":464 + * warnings.warn(msg) + * col_name = newcolname + * break # <<<<<<<<<<<<<< * - * pynote = note - * dc.notes.append(pynote) # <<<<<<<<<<<<<< + * dc.col_names.append(col_name) + */ + goto __pyx_L9_break; + } + __pyx_L8_continue:; + } + __pyx_L9_break:; + + /* "pyreadstat/_readstat_parser.pyx":453 + * index = readstat_variable_get_index_after_skipping(variable) * - * return READSTAT_HANDLER_OK + * if col_name in dc.col_names: # <<<<<<<<<<<<<< + * dupcolcnt = 1 + * while True: */ - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_dc->notes, __pyx_v_pynote); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 762, __pyx_L1_error) + } - /* "pyreadstat/_readstat_parser.pyx":764 - * dc.notes.append(pynote) + /* "pyreadstat/_readstat_parser.pyx":466 + * break * - * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + * dc.col_names.append(col_name) # <<<<<<<<<<<<<< * - * cdef int handle_open(const char *u8_path, void *io_ctx) except READSTAT_HANDLER_ABORT: + * # the name of the value label for the variable */ - __pyx_r = READSTAT_HANDLER_OK; - goto __pyx_L0; + if (unlikely(__pyx_v_dc->col_names == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 466, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_dc->col_names, __pyx_v_col_name); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 466, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":753 - * return READSTAT_HANDLER_OK + /* "pyreadstat/_readstat_parser.pyx":469 * - * cdef int handle_note (int note_index, char *note, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< - * """ - * Collects notes (text annotations) attached to the documents. It happens for spss and stata + * # the name of the value label for the variable + * if val_labels != NULL: # <<<<<<<<<<<<<< + * label_name = val_labels + * if label_name: */ + __pyx_t_2 = (__pyx_v_val_labels != NULL); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_note", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = READSTAT_HANDLER_ABORT; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_pynote); - __Pyx_XDECREF((PyObject *)__pyx_v_dc); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pyreadstat/_readstat_parser.pyx":766 - * return READSTAT_HANDLER_OK - * - * cdef int handle_open(const char *u8_path, void *io_ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< - * """ - * Special open handler for windows in order to be able to handle paths with international characters + /* "pyreadstat/_readstat_parser.pyx":470 + * # the name of the value label for the variable + * if val_labels != NULL: + * label_name = val_labels # <<<<<<<<<<<<<< + * if label_name: + * dc.label_to_var_name[col_name] = label_name */ + __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_val_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_label_name = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; -static int __pyx_f_10pyreadstat_16_readstat_parser_handle_open(char const *__pyx_v_u8_path, void *__pyx_v_io_ctx) { - int __pyx_v_fd; - Py_ssize_t __pyx_v_length; - wchar_t *__pyx_v_u16_path; - int __pyx_r; - __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; - int __pyx_t_6; - wchar_t *__pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("handle_open", 0); - - /* "pyreadstat/_readstat_parser.pyx":776 - * cdef Py_ssize_t length - * - * if not os.path.isfile(u8_path): # <<<<<<<<<<<<<< - * return -1 + /* "pyreadstat/_readstat_parser.pyx":471 + * if val_labels != NULL: + * label_name = val_labels + * if label_name: # <<<<<<<<<<<<<< + * dc.label_to_var_name[col_name] = label_name * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyUnicode_FromString(__pyx_v_u8_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = ((!__pyx_t_5) != 0); - if (__pyx_t_6) { + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_label_name); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 471, __pyx_L1_error) + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":777 - * - * if not os.path.isfile(u8_path): - * return -1 # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":472 + * label_name = val_labels + * if label_name: + * dc.label_to_var_name[col_name] = label_name # <<<<<<<<<<<<<< * - * #IF UNAME_SYSNAME == 'Windows': + * var_label = readstat_variable_get_label(variable) */ - __pyx_r = -1; - goto __pyx_L0; + if (unlikely((PyObject_SetItem(__pyx_v_dc->label_to_var_name, __pyx_v_col_name, __pyx_v_label_name) < 0))) __PYX_ERR(0, 472, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":776 - * cdef Py_ssize_t length - * - * if not os.path.isfile(u8_path): # <<<<<<<<<<<<<< - * return -1 + /* "pyreadstat/_readstat_parser.pyx":471 + * if val_labels != NULL: + * label_name = val_labels + * if label_name: # <<<<<<<<<<<<<< + * dc.label_to_var_name[col_name] = label_name * */ - } + } - /* "pyreadstat/_readstat_parser.pyx":780 - * - * #IF UNAME_SYSNAME == 'Windows': - * if os.name == "nt": # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":469 * - * u16_path = PyUnicode_AsWideCharString(u8_path, &length) + * # the name of the value label for the variable + * if val_labels != NULL: # <<<<<<<<<<<<<< + * label_name = val_labels + * if label_name: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_nt, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_6) { + } - /* "pyreadstat/_readstat_parser.pyx":782 - * if os.name == "nt": + /* "pyreadstat/_readstat_parser.pyx":474 + * dc.label_to_var_name[col_name] = label_name * - * u16_path = PyUnicode_AsWideCharString(u8_path, &length) # <<<<<<<<<<<<<< - * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) - * assign_fd(io_ctx, fd) + * var_label = readstat_variable_get_label(variable) # <<<<<<<<<<<<<< + * if var_label == NULL: + * col_label = None */ - __pyx_t_2 = __Pyx_PyUnicode_FromString(__pyx_v_u8_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyUnicode_AsWideCharString(__pyx_t_2, (&__pyx_v_length)); if (unlikely(__pyx_t_7 == ((wchar_t *)NULL))) __PYX_ERR(0, 782, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_u16_path = __pyx_t_7; + __pyx_v_var_label = readstat_variable_get_label(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":783 + /* "pyreadstat/_readstat_parser.pyx":475 * - * u16_path = PyUnicode_AsWideCharString(u8_path, &length) - * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) # <<<<<<<<<<<<<< - * assign_fd(io_ctx, fd) - * return fd - */ - __pyx_v_fd = _wsopen(__pyx_v_u16_path, (_O_RDONLY | _O_BINARY), _SH_DENYWR, 0); - - /* "pyreadstat/_readstat_parser.pyx":784 - * u16_path = PyUnicode_AsWideCharString(u8_path, &length) - * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) - * assign_fd(io_ctx, fd) # <<<<<<<<<<<<<< - * return fd - * #ELSE: + * var_label = readstat_variable_get_label(variable) + * if var_label == NULL: # <<<<<<<<<<<<<< + * col_label = None + * else: */ - assign_fd(__pyx_v_io_ctx, __pyx_v_fd); + __pyx_t_2 = (__pyx_v_var_label == NULL); + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":785 - * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) - * assign_fd(io_ctx, fd) - * return fd # <<<<<<<<<<<<<< - * #ELSE: - * else: + /* "pyreadstat/_readstat_parser.pyx":476 + * var_label = readstat_variable_get_label(variable) + * if var_label == NULL: + * col_label = None # <<<<<<<<<<<<<< + * else: + * col_label = var_label */ - __pyx_r = __pyx_v_fd; - goto __pyx_L0; + __Pyx_INCREF(Py_None); + __pyx_v_col_label = ((PyObject*)Py_None); - /* "pyreadstat/_readstat_parser.pyx":780 - * - * #IF UNAME_SYSNAME == 'Windows': - * if os.name == "nt": # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":475 * - * u16_path = PyUnicode_AsWideCharString(u8_path, &length) + * var_label = readstat_variable_get_label(variable) + * if var_label == NULL: # <<<<<<<<<<<<<< + * col_label = None + * else: */ + goto __pyx_L13; } - /* "pyreadstat/_readstat_parser.pyx":788 - * #ELSE: - * else: - * return -1 # <<<<<<<<<<<<<< - * ELSE: - * return -1 + /* "pyreadstat/_readstat_parser.pyx":478 + * col_label = None + * else: + * col_label = var_label # <<<<<<<<<<<<<< + * dc.col_labels.append(col_label) + * */ /*else*/ { - __pyx_r = -1; - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyStr_FromString(__pyx_v_var_label); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_col_label = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; } + __pyx_L13:; - /* "pyreadstat/_readstat_parser.pyx":766 - * return READSTAT_HANDLER_OK + /* "pyreadstat/_readstat_parser.pyx":479 + * else: + * col_label = var_label + * dc.col_labels.append(col_label) # <<<<<<<<<<<<<< * - * cdef int handle_open(const char *u8_path, void *io_ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< - * """ - * Special open handler for windows in order to be able to handle paths with international characters + * # format, we have to transform it in something more usable */ + if (unlikely(__pyx_v_dc->col_labels == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 479, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_dc->col_labels, __pyx_v_col_label); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 479, __pyx_L1_error) - /* 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_AddTraceback("pyreadstat._readstat_parser.handle_open", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = READSTAT_HANDLER_ABORT; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "pyreadstat/_readstat_parser.pyx":793 - * + /* "pyreadstat/_readstat_parser.pyx":482 * - * cdef void check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< - * """ - * transforms a readstat exit status to a python error if status is not READSTAT OK + * # format, we have to transform it in something more usable + * var_format = readstat_variable_get_format(variable) # <<<<<<<<<<<<<< + * if var_format == NULL: + * col_format_original = "NULL" */ + __pyx_v_var_format = readstat_variable_get_format(__pyx_v_variable); -static void __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_error_t __pyx_v_retcode) { - char *__pyx_v_err_readstat; - PyObject *__pyx_v_err_message = 0; - __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("check_exit_status", 0); - - /* "pyreadstat/_readstat_parser.pyx":800 - * cdef char * err_readstat - * cdef str err_message - * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< - * err_readstat = readstat_error_message(retcode) - * err_message = err_readstat + /* "pyreadstat/_readstat_parser.pyx":483 + * # format, we have to transform it in something more usable + * var_format = readstat_variable_get_format(variable) + * if var_format == NULL: # <<<<<<<<<<<<<< + * col_format_original = "NULL" + * else: */ - __pyx_t_1 = ((__pyx_v_retcode != READSTAT_OK) != 0); - if (unlikely(__pyx_t_1)) { + __pyx_t_2 = (__pyx_v_var_format == NULL); + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":801 - * cdef str err_message - * if retcode != READSTAT_OK: - * err_readstat = readstat_error_message(retcode) # <<<<<<<<<<<<<< - * err_message = err_readstat - * raise ReadstatError(err_message) + /* "pyreadstat/_readstat_parser.pyx":484 + * var_format = readstat_variable_get_format(variable) + * if var_format == NULL: + * col_format_original = "NULL" # <<<<<<<<<<<<<< + * else: + * col_format_original = var_format */ - __pyx_v_err_readstat = readstat_error_message(__pyx_v_retcode); + __Pyx_INCREF(__pyx_n_s_NULL); + __pyx_v_col_format_original = __pyx_n_s_NULL; - /* "pyreadstat/_readstat_parser.pyx":802 - * if retcode != READSTAT_OK: - * err_readstat = readstat_error_message(retcode) - * err_message = err_readstat # <<<<<<<<<<<<<< - * raise ReadstatError(err_message) - * + /* "pyreadstat/_readstat_parser.pyx":483 + * # format, we have to transform it in something more usable + * var_format = readstat_variable_get_format(variable) + * if var_format == NULL: # <<<<<<<<<<<<<< + * col_format_original = "NULL" + * else: */ - __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_err_readstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 802, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_t_2; - __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_err_message = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + goto __pyx_L14; + } - /* "pyreadstat/_readstat_parser.pyx":803 - * err_readstat = readstat_error_message(retcode) - * err_message = err_readstat - * raise ReadstatError(err_message) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ReadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v_err_message) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_err_message); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 803, __pyx_L1_error) - - /* "pyreadstat/_readstat_parser.pyx":800 - * cdef char * err_readstat - * cdef str err_message - * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< - * err_readstat = readstat_error_message(retcode) - * err_message = err_readstat + /* "pyreadstat/_readstat_parser.pyx":486 + * col_format_original = "NULL" + * else: + * col_format_original = var_format # <<<<<<<<<<<<<< + * file_format = dc.file_format + * dc.col_formats_original.append(col_format_original) */ + /*else*/ { + __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_var_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_col_format_original = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; } + __pyx_L14:; - /* "pyreadstat/_readstat_parser.pyx":793 - * - * - * cdef void check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< - * """ - * transforms a readstat exit status to a python error if status is not READSTAT OK + /* "pyreadstat/_readstat_parser.pyx":487 + * else: + * col_format_original = var_format + * file_format = dc.file_format # <<<<<<<<<<<<<< + * dc.col_formats_original.append(col_format_original) + * col_format_final = transform_variable_format(col_format_original, file_format) */ + __pyx_t_8 = __pyx_v_dc->file_format; + __pyx_v_file_format = __pyx_t_8; - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyreadstat._readstat_parser.check_exit_status", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_err_message); - __Pyx_RefNannyFinishContext(); -} - -/* "pyreadstat/_readstat_parser.pyx":806 - * - * - * cdef void run_readstat_parser(char * filename, data_container data, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), long row_limit, long row_offset) except *: # <<<<<<<<<<<<<< - * """ - * Runs the parsing of the file by readstat library + /* "pyreadstat/_readstat_parser.pyx":488 + * col_format_original = var_format + * file_format = dc.file_format + * dc.col_formats_original.append(col_format_original) # <<<<<<<<<<<<<< + * col_format_final = transform_variable_format(col_format_original, file_format) + * dc.col_formats.append(col_format_final) */ + if (unlikely(__pyx_v_dc->col_formats_original == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 488, __pyx_L1_error) + } + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_dc->col_formats_original, __pyx_v_col_format_original); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 488, __pyx_L1_error) -static void __pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser(char *__pyx_v_filename, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_data, readstat_error_t __pyx_v_parse_func(readstat_parser_t *, char const *, void *), long __pyx_v_row_limit, long __pyx_v_row_offset) { - readstat_parser_t *__pyx_v_parser; - readstat_error_t __pyx_v_error; - readstat_metadata_handler __pyx_v_metadata_handler; - readstat_variable_handler __pyx_v_variable_handler; - readstat_value_handler __pyx_v_value_handler; - readstat_value_label_handler __pyx_v_value_label_handler; - readstat_note_handler __pyx_v_note_handler; - void *__pyx_v_ctx; - PyObject *__pyx_v_pyerr; - int __pyx_v_metaonly; - readstat_open_handler __pyx_v_open_handler; - PyObject *__pyx_v_encoding_bytes = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("run_readstat_parser", 0); - - /* "pyreadstat/_readstat_parser.pyx":826 - * cdef bytes encoding_byte - * - * metaonly = data.metaonly # <<<<<<<<<<<<<< - * ctx = data - * + /* "pyreadstat/_readstat_parser.pyx":489 + * file_format = dc.file_format + * dc.col_formats_original.append(col_format_original) + * col_format_final = transform_variable_format(col_format_original, file_format) # <<<<<<<<<<<<<< + * dc.col_formats.append(col_format_final) + * # readstat type */ - __pyx_t_1 = __pyx_v_data->metaonly; - __pyx_v_metaonly = __pyx_t_1; + __pyx_t_9 = __pyx_f_10pyreadstat_16_readstat_parser_transform_variable_format(__pyx_v_col_format_original, __pyx_v_file_format); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_v_col_format_final = __pyx_t_9; - /* "pyreadstat/_readstat_parser.pyx":827 - * - * metaonly = data.metaonly - * ctx = data # <<<<<<<<<<<<<< - * - * #readstat_error_t error = READSTAT_OK; + /* "pyreadstat/_readstat_parser.pyx":490 + * dc.col_formats_original.append(col_format_original) + * col_format_final = transform_variable_format(col_format_original, file_format) + * dc.col_formats.append(col_format_final) # <<<<<<<<<<<<<< + * # readstat type + * var_type = readstat_variable_get_type(variable) */ - __pyx_v_ctx = ((void *)__pyx_v_data); + if (unlikely(__pyx_v_dc->col_formats == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 490, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format(__pyx_v_col_format_final); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_dc->col_formats, __pyx_t_3); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":830 - * - * #readstat_error_t error = READSTAT_OK; - * parser = readstat_parser_init() # <<<<<<<<<<<<<< - * metadata_handler = handle_metadata - * variable_handler = handle_variable + /* "pyreadstat/_readstat_parser.pyx":492 + * dc.col_formats.append(col_format_final) + * # readstat type + * var_type = readstat_variable_get_type(variable) # <<<<<<<<<<<<<< + * dc.col_dtypes.append(var_type) + * # equivalent numpy type */ - __pyx_v_parser = readstat_parser_init(); + __pyx_v_var_type = readstat_variable_get_type(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":831 - * #readstat_error_t error = READSTAT_OK; - * parser = readstat_parser_init() - * metadata_handler = handle_metadata # <<<<<<<<<<<<<< - * variable_handler = handle_variable - * value_handler = handle_value + /* "pyreadstat/_readstat_parser.pyx":493 + * # readstat type + * var_type = readstat_variable_get_type(variable) + * dc.col_dtypes.append(var_type) # <<<<<<<<<<<<<< + * # equivalent numpy type + * # if it's a date then we need object */ - __pyx_v_metadata_handler = ((readstat_metadata_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_metadata); + if (unlikely(__pyx_v_dc->col_dtypes == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 493, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(__pyx_v_var_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_dc->col_dtypes, __pyx_t_3); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 493, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":832 - * parser = readstat_parser_init() - * metadata_handler = handle_metadata - * variable_handler = handle_variable # <<<<<<<<<<<<<< - * value_handler = handle_value - * value_label_handler = handle_value_label + /* "pyreadstat/_readstat_parser.pyx":496 + * # equivalent numpy type + * # if it's a date then we need object + * if col_format_final != DATE_FORMAT_NOTADATE and dc.no_datetime_conversion == 0: # <<<<<<<<<<<<<< + * curnptype = object + * else: */ - __pyx_v_variable_handler = ((readstat_variable_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_variable); + __pyx_t_4 = (__pyx_v_col_format_final != __pyx_e_10pyreadstat_16_readstat_parser_DATE_FORMAT_NOTADATE); + if (__pyx_t_4) { + } else { + __pyx_t_2 = __pyx_t_4; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_4 = (__pyx_v_dc->no_datetime_conversion == 0); + __pyx_t_2 = __pyx_t_4; + __pyx_L16_bool_binop_done:; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":833 - * metadata_handler = handle_metadata - * variable_handler = handle_variable - * value_handler = handle_value # <<<<<<<<<<<<<< - * value_label_handler = handle_value_label - * note_handler = handle_note + /* "pyreadstat/_readstat_parser.pyx":497 + * # if it's a date then we need object + * if col_format_final != DATE_FORMAT_NOTADATE and dc.no_datetime_conversion == 0: + * curnptype = object # <<<<<<<<<<<<<< + * else: + * curnptype = readstat_to_numpy_types[var_type] */ - __pyx_v_value_handler = ((readstat_value_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_value); + __Pyx_INCREF(__pyx_builtin_object); + __pyx_v_curnptype = __pyx_builtin_object; - /* "pyreadstat/_readstat_parser.pyx":834 - * variable_handler = handle_variable - * value_handler = handle_value - * value_label_handler = handle_value_label # <<<<<<<<<<<<<< - * note_handler = handle_note - * + /* "pyreadstat/_readstat_parser.pyx":496 + * # equivalent numpy type + * # if it's a date then we need object + * if col_format_final != DATE_FORMAT_NOTADATE and dc.no_datetime_conversion == 0: # <<<<<<<<<<<<<< + * curnptype = object + * else: */ - __pyx_v_value_label_handler = ((readstat_value_label_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_value_label); + goto __pyx_L15; + } - /* "pyreadstat/_readstat_parser.pyx":835 - * value_handler = handle_value - * value_label_handler = handle_value_label - * note_handler = handle_note # <<<<<<<<<<<<<< - * - * + /* "pyreadstat/_readstat_parser.pyx":499 + * curnptype = object + * else: + * curnptype = readstat_to_numpy_types[var_type] # <<<<<<<<<<<<<< + * iscurnptypefloat = 0 + * iscurnptypeobject = 0 */ - __pyx_v_note_handler = ((readstat_note_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_note); + /*else*/ { + if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 499, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(__pyx_v_var_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_curnptype = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L15:; - /* "pyreadstat/_readstat_parser.pyx":838 - * - * - * check_exit_status(readstat_set_metadata_handler(parser, metadata_handler)) # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) - * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) + /* "pyreadstat/_readstat_parser.pyx":500 + * else: + * curnptype = readstat_to_numpy_types[var_type] + * iscurnptypefloat = 0 # <<<<<<<<<<<<<< + * iscurnptypeobject = 0 + * # book keeping numpy types */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_metadata_handler(__pyx_v_parser, __pyx_v_metadata_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 838, __pyx_L1_error) + __pyx_v_iscurnptypefloat = 0; - /* "pyreadstat/_readstat_parser.pyx":839 - * - * check_exit_status(readstat_set_metadata_handler(parser, metadata_handler)) - * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) - * check_exit_status(readstat_set_note_handler(parser, note_handler)) + /* "pyreadstat/_readstat_parser.pyx":501 + * curnptype = readstat_to_numpy_types[var_type] + * iscurnptypefloat = 0 + * iscurnptypeobject = 0 # <<<<<<<<<<<<<< + * # book keeping numpy types + * dc.col_numpy_dtypes[index] = curnptype */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_variable_handler(__pyx_v_parser, __pyx_v_variable_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 839, __pyx_L1_error) + __pyx_v_iscurnptypeobject = 0; - /* "pyreadstat/_readstat_parser.pyx":840 - * check_exit_status(readstat_set_metadata_handler(parser, metadata_handler)) - * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) - * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_note_handler(parser, note_handler)) - * + /* "pyreadstat/_readstat_parser.pyx":503 + * iscurnptypeobject = 0 + * # book keeping numpy types + * dc.col_numpy_dtypes[index] = curnptype # <<<<<<<<<<<<<< + * if curnptype == object: + * iscurnptypeobject = 1 */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_value_label_handler(__pyx_v_parser, __pyx_v_value_label_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L1_error) + if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 503, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, __pyx_v_curnptype, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 503, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":841 - * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) - * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) - * check_exit_status(readstat_set_note_handler(parser, note_handler)) # <<<<<<<<<<<<<< - * - * # on windows we need a custom open handler in order to deal with internation characters in the path. + /* "pyreadstat/_readstat_parser.pyx":504 + * # book keeping numpy types + * dc.col_numpy_dtypes[index] = curnptype + * if curnptype == object: # <<<<<<<<<<<<<< + * iscurnptypeobject = 1 + * if curnptype == np.float64: */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_note_handler(__pyx_v_parser, __pyx_v_note_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 841, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_curnptype, __pyx_builtin_object, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 504, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":845 - * # on windows we need a custom open handler in order to deal with internation characters in the path. - * IF PY_MAJOR_VERSION >2: - * if os.name == "nt": # <<<<<<<<<<<<<< - * open_handler = handle_open - * readstat_set_open_handler(parser, open_handler) + /* "pyreadstat/_readstat_parser.pyx":505 + * dc.col_numpy_dtypes[index] = curnptype + * if curnptype == object: + * iscurnptypeobject = 1 # <<<<<<<<<<<<<< + * if curnptype == np.float64: + * iscurnptypefloat = 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_nt, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 845, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_1) { + __pyx_v_iscurnptypeobject = 1; - /* "pyreadstat/_readstat_parser.pyx":846 - * IF PY_MAJOR_VERSION >2: - * if os.name == "nt": - * open_handler = handle_open # <<<<<<<<<<<<<< - * readstat_set_open_handler(parser, open_handler) - * ELSE: + /* "pyreadstat/_readstat_parser.pyx":504 + * # book keeping numpy types + * dc.col_numpy_dtypes[index] = curnptype + * if curnptype == object: # <<<<<<<<<<<<<< + * iscurnptypeobject = 1 + * if curnptype == np.float64: */ - __pyx_v_open_handler = ((readstat_open_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_open); + } - /* "pyreadstat/_readstat_parser.pyx":847 - * if os.name == "nt": - * open_handler = handle_open - * readstat_set_open_handler(parser, open_handler) # <<<<<<<<<<<<<< - * ELSE: - * if os.name == "nt": + /* "pyreadstat/_readstat_parser.pyx":506 + * if curnptype == object: + * iscurnptypeobject = 1 + * if curnptype == np.float64: # <<<<<<<<<<<<<< + * iscurnptypefloat = 1 + * dc.col_dtypes_isobject[index] = iscurnptypeobject */ - (void)(readstat_set_open_handler(__pyx_v_parser, __pyx_v_open_handler)); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_v_curnptype, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":845 - * # on windows we need a custom open handler in order to deal with internation characters in the path. - * IF PY_MAJOR_VERSION >2: - * if os.name == "nt": # <<<<<<<<<<<<<< - * open_handler = handle_open - * readstat_set_open_handler(parser, open_handler) + /* "pyreadstat/_readstat_parser.pyx":507 + * iscurnptypeobject = 1 + * if curnptype == np.float64: + * iscurnptypefloat = 1 # <<<<<<<<<<<<<< + * dc.col_dtypes_isobject[index] = iscurnptypeobject + * dc.col_dytpes_isfloat[index] = iscurnptypefloat */ - } + __pyx_v_iscurnptypefloat = 1; - /* "pyreadstat/_readstat_parser.pyx":852 - * raise PyreadstatError("Python 2 on windows not supported!") - * - * if not metaonly: # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_value_handler(parser, value_handler)) - * + /* "pyreadstat/_readstat_parser.pyx":506 + * if curnptype == object: + * iscurnptypeobject = 1 + * if curnptype == np.float64: # <<<<<<<<<<<<<< + * iscurnptypefloat = 1 + * dc.col_dtypes_isobject[index] = iscurnptypeobject */ - __pyx_t_1 = ((!(__pyx_v_metaonly != 0)) != 0); - if (__pyx_t_1) { + } - /* "pyreadstat/_readstat_parser.pyx":853 - * - * if not metaonly: - * check_exit_status(readstat_set_value_handler(parser, value_handler)) # <<<<<<<<<<<<<< - * - * # if the user set the encoding manually + /* "pyreadstat/_readstat_parser.pyx":508 + * if curnptype == np.float64: + * iscurnptypefloat = 1 + * dc.col_dtypes_isobject[index] = iscurnptypeobject # <<<<<<<<<<<<<< + * dc.col_dytpes_isfloat[index] = iscurnptypefloat + * metaonly = dc.metaonly */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_value_handler(__pyx_v_parser, __pyx_v_value_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_iscurnptypeobject); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 508, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 508, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":852 - * raise PyreadstatError("Python 2 on windows not supported!") - * - * if not metaonly: # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_value_handler(parser, value_handler)) - * + /* "pyreadstat/_readstat_parser.pyx":509 + * iscurnptypefloat = 1 + * dc.col_dtypes_isobject[index] = iscurnptypeobject + * dc.col_dytpes_isfloat[index] = iscurnptypefloat # <<<<<<<<<<<<<< + * metaonly = dc.metaonly + * # pre-allocate data */ + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_iscurnptypefloat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(__pyx_v_dc->col_dytpes_isfloat == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 509, __pyx_L1_error) } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_dytpes_isfloat, __pyx_v_index, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 509, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":856 - * - * # if the user set the encoding manually - * if data.user_encoding: # <<<<<<<<<<<<<< - * encoding_bytes = data.user_encoding.encode("utf-8") - * readstat_set_file_character_encoding(parser, encoding_bytes) + /* "pyreadstat/_readstat_parser.pyx":510 + * dc.col_dtypes_isobject[index] = iscurnptypeobject + * dc.col_dytpes_isfloat[index] = iscurnptypefloat + * metaonly = dc.metaonly # <<<<<<<<<<<<<< + * # pre-allocate data + * if metaonly: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_data->user_encoding); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 856, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_dc->metaonly; + __pyx_v_metaonly = __pyx_t_2; - /* "pyreadstat/_readstat_parser.pyx":857 - * # if the user set the encoding manually - * if data.user_encoding: - * encoding_bytes = data.user_encoding.encode("utf-8") # <<<<<<<<<<<<<< - * readstat_set_file_character_encoding(parser, encoding_bytes) - * + /* "pyreadstat/_readstat_parser.pyx":512 + * metaonly = dc.metaonly + * # pre-allocate data + * if metaonly: # <<<<<<<<<<<<<< + * row = np.empty(1, dtype=curnptype) + * else: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data->user_encoding, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_encoding_bytes = __pyx_t_3; - __pyx_t_3 = 0; + if (__pyx_v_metaonly) { - /* "pyreadstat/_readstat_parser.pyx":858 - * if data.user_encoding: - * encoding_bytes = data.user_encoding.encode("utf-8") - * readstat_set_file_character_encoding(parser, encoding_bytes) # <<<<<<<<<<<<<< - * - * if row_limit: + /* "pyreadstat/_readstat_parser.pyx":513 + * # pre-allocate data + * if metaonly: + * row = np.empty(1, dtype=curnptype) # <<<<<<<<<<<<<< + * else: + * obs_count = dc.n_obs */ - __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_encoding_bytes); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 858, __pyx_L1_error) - (void)(readstat_set_file_character_encoding(__pyx_v_parser, ((char *)__pyx_t_5))); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_curnptype) < 0) __PYX_ERR(0, 513, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_row = __pyx_t_5; + __pyx_t_5 = 0; - /* "pyreadstat/_readstat_parser.pyx":856 - * - * # if the user set the encoding manually - * if data.user_encoding: # <<<<<<<<<<<<<< - * encoding_bytes = data.user_encoding.encode("utf-8") - * readstat_set_file_character_encoding(parser, encoding_bytes) + /* "pyreadstat/_readstat_parser.pyx":512 + * metaonly = dc.metaonly + * # pre-allocate data + * if metaonly: # <<<<<<<<<<<<<< + * row = np.empty(1, dtype=curnptype) + * else: */ + goto __pyx_L20; } - /* "pyreadstat/_readstat_parser.pyx":860 - * readstat_set_file_character_encoding(parser, encoding_bytes) - * - * if row_limit: # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_row_limit(parser, row_limit)) - * + /* "pyreadstat/_readstat_parser.pyx":515 + * row = np.empty(1, dtype=curnptype) + * else: + * obs_count = dc.n_obs # <<<<<<<<<<<<<< + * row = np.empty(obs_count, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: */ - __pyx_t_1 = (__pyx_v_row_limit != 0); - if (__pyx_t_1) { + /*else*/ { + __pyx_t_6 = __pyx_v_dc->n_obs; + __pyx_v_obs_count = __pyx_t_6; - /* "pyreadstat/_readstat_parser.pyx":861 - * - * if row_limit: - * check_exit_status(readstat_set_row_limit(parser, row_limit)) # <<<<<<<<<<<<<< - * - * if row_offset: + /* "pyreadstat/_readstat_parser.pyx":516 + * else: + * obs_count = dc.n_obs + * row = np.empty(obs_count, dtype=curnptype) # <<<<<<<<<<<<<< + * if iscurnptypeobject or iscurnptypefloat: + * row.fill(np.nan) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_row_limit(__pyx_v_parser, __pyx_v_row_limit)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_obs_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_v_curnptype) < 0) __PYX_ERR(0, 516, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_row = __pyx_t_10; + __pyx_t_10 = 0; - /* "pyreadstat/_readstat_parser.pyx":860 - * readstat_set_file_character_encoding(parser, encoding_bytes) - * - * if row_limit: # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_row_limit(parser, row_limit)) - * + /* "pyreadstat/_readstat_parser.pyx":517 + * obs_count = dc.n_obs + * row = np.empty(obs_count, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< + * row.fill(np.nan) + * dc.col_data.append(row) */ - } + if (!__pyx_v_iscurnptypeobject) { + } else { + __pyx_t_2 = __pyx_v_iscurnptypeobject; + goto __pyx_L22_bool_binop_done; + } + __pyx_t_2 = __pyx_v_iscurnptypefloat; + __pyx_L22_bool_binop_done:; + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":863 - * check_exit_status(readstat_set_row_limit(parser, row_limit)) - * - * if row_offset: # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_row_offset(parser, row_offset)) + /* "pyreadstat/_readstat_parser.pyx":518 + * row = np.empty(obs_count, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: + * row.fill(np.nan) # <<<<<<<<<<<<<< + * dc.col_data.append(row) * */ - __pyx_t_1 = (__pyx_v_row_offset != 0); - if (__pyx_t_1) { + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_fill); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + 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_6 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_1}; + __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 518, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/_readstat_parser.pyx":864 - * - * if row_offset: - * check_exit_status(readstat_set_row_offset(parser, row_offset)) # <<<<<<<<<<<<<< - * - * # parse! + /* "pyreadstat/_readstat_parser.pyx":517 + * obs_count = dc.n_obs + * row = np.empty(obs_count, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< + * row.fill(np.nan) + * dc.col_data.append(row) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_row_offset(__pyx_v_parser, __pyx_v_row_offset)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L1_error) + } + } + __pyx_L20:; - /* "pyreadstat/_readstat_parser.pyx":863 - * check_exit_status(readstat_set_row_limit(parser, row_limit)) - * - * if row_offset: # <<<<<<<<<<<<<< - * check_exit_status(readstat_set_row_offset(parser, row_offset)) + /* "pyreadstat/_readstat_parser.pyx":519 + * if iscurnptypeobject or iscurnptypefloat: + * row.fill(np.nan) + * dc.col_data.append(row) # <<<<<<<<<<<<<< * + * # missing values */ + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append"); + __PYX_ERR(0, 519, __pyx_L1_error) } + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_dc->col_data, __pyx_v_row); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 519, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":867 + /* "pyreadstat/_readstat_parser.pyx":522 * - * # parse! - * error = parse_func(parser, filename, ctx); # <<<<<<<<<<<<<< - * readstat_parser_free(parser) - * # check if a python error ocurred, if yes, it will be printed by the interpreter, + * # missing values + * if dc.usernan: # <<<<<<<<<<<<<< + * n_ranges = readstat_variable_get_missing_ranges_count(variable) + * if n_ranges>0: */ - __pyx_v_error = __pyx_v_parse_func(__pyx_v_parser, __pyx_v_filename, __pyx_v_ctx); + if (__pyx_v_dc->usernan) { - /* "pyreadstat/_readstat_parser.pyx":868 - * # parse! - * error = parse_func(parser, filename, ctx); - * readstat_parser_free(parser) # <<<<<<<<<<<<<< - * # check if a python error ocurred, if yes, it will be printed by the interpreter, - * # if not, make sure that the return from parse_func is OK, if not print + /* "pyreadstat/_readstat_parser.pyx":523 + * # missing values + * if dc.usernan: + * n_ranges = readstat_variable_get_missing_ranges_count(variable) # <<<<<<<<<<<<<< + * if n_ranges>0: + * missing_ranges = list() */ - readstat_parser_free(__pyx_v_parser); + __pyx_v_n_ranges = readstat_variable_get_missing_ranges_count(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":871 - * # check if a python error ocurred, if yes, it will be printed by the interpreter, - * # if not, make sure that the return from parse_func is OK, if not print - * pyerr = PyErr_Occurred() # <<<<<<<<<<<<<< - * if pyerr == NULL: - * check_exit_status(error) + /* "pyreadstat/_readstat_parser.pyx":524 + * if dc.usernan: + * n_ranges = readstat_variable_get_missing_ranges_count(variable) + * if n_ranges>0: # <<<<<<<<<<<<<< + * missing_ranges = list() + * for i in range(0, n_ranges): */ - __pyx_v_pyerr = PyErr_Occurred(); + __pyx_t_2 = (__pyx_v_n_ranges > 0); + if (__pyx_t_2) { - /* "pyreadstat/_readstat_parser.pyx":872 - * # if not, make sure that the return from parse_func is OK, if not print - * pyerr = PyErr_Occurred() - * if pyerr == NULL: # <<<<<<<<<<<<<< - * check_exit_status(error) - * + /* "pyreadstat/_readstat_parser.pyx":525 + * n_ranges = readstat_variable_get_missing_ranges_count(variable) + * if n_ranges>0: + * missing_ranges = list() # <<<<<<<<<<<<<< + * for i in range(0, n_ranges): + * loval = readstat_variable_get_missing_range_lo(variable, i) */ - __pyx_t_1 = ((((void *)__pyx_v_pyerr) == NULL) != 0); - if (__pyx_t_1) { + __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 525, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_v_missing_ranges = ((PyObject*)__pyx_t_10); + __pyx_t_10 = 0; - /* "pyreadstat/_readstat_parser.pyx":873 - * pyerr = PyErr_Occurred() - * if pyerr == NULL: - * check_exit_status(error) # <<<<<<<<<<<<<< - * - * + /* "pyreadstat/_readstat_parser.pyx":526 + * if n_ranges>0: + * missing_ranges = list() + * for i in range(0, n_ranges): # <<<<<<<<<<<<<< + * loval = readstat_variable_get_missing_range_lo(variable, i) + * pyloval = convert_readstat_to_python_value(loval, index, dc) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(__pyx_v_error); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 873, __pyx_L1_error) + __pyx_t_6 = __pyx_v_n_ranges; + __pyx_t_11 = __pyx_t_6; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; - /* "pyreadstat/_readstat_parser.pyx":872 - * # if not, make sure that the return from parse_func is OK, if not print - * pyerr = PyErr_Occurred() - * if pyerr == NULL: # <<<<<<<<<<<<<< - * check_exit_status(error) - * + /* "pyreadstat/_readstat_parser.pyx":527 + * missing_ranges = list() + * for i in range(0, n_ranges): + * loval = readstat_variable_get_missing_range_lo(variable, i) # <<<<<<<<<<<<<< + * pyloval = convert_readstat_to_python_value(loval, index, dc) + * hival = readstat_variable_get_missing_range_hi(variable, i) */ - } + __pyx_v_loval = readstat_variable_get_missing_range_lo(__pyx_v_variable, __pyx_v_i); - /* "pyreadstat/_readstat_parser.pyx":806 - * - * - * cdef void run_readstat_parser(char * filename, data_container data, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), long row_limit, long row_offset) except *: # <<<<<<<<<<<<<< - * """ - * Runs the parsing of the file by readstat library + /* "pyreadstat/_readstat_parser.pyx":528 + * for i in range(0, n_ranges): + * loval = readstat_variable_get_missing_range_lo(variable, i) + * pyloval = convert_readstat_to_python_value(loval, index, dc) # <<<<<<<<<<<<<< + * hival = readstat_variable_get_missing_range_hi(variable, i) + * pyhival = convert_readstat_to_python_value(hival, index, dc) */ + __pyx_t_10 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_loval, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF_SET(__pyx_v_pyloval, __pyx_t_10); + __pyx_t_10 = 0; - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("pyreadstat._readstat_parser.run_readstat_parser", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_encoding_bytes); - __Pyx_RefNannyFinishContext(); -} + /* "pyreadstat/_readstat_parser.pyx":529 + * loval = readstat_variable_get_missing_range_lo(variable, i) + * pyloval = convert_readstat_to_python_value(loval, index, dc) + * hival = readstat_variable_get_missing_range_hi(variable, i) # <<<<<<<<<<<<<< + * pyhival = convert_readstat_to_python_value(hival, index, dc) + * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) + */ + __pyx_v_hival = readstat_variable_get_missing_range_hi(__pyx_v_variable, __pyx_v_i); + + /* "pyreadstat/_readstat_parser.pyx":530 + * pyloval = convert_readstat_to_python_value(loval, index, dc) + * hival = readstat_variable_get_missing_range_hi(variable, i) + * pyhival = convert_readstat_to_python_value(hival, index, dc) # <<<<<<<<<<<<<< + * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) + * dc.missing_ranges[col_name] = missing_ranges + */ + __pyx_t_10 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_hival, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 530, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF_SET(__pyx_v_pyhival, __pyx_t_10); + __pyx_t_10 = 0; -/* "pyreadstat/_readstat_parser.pyx":876 + /* "pyreadstat/_readstat_parser.pyx":531 + * hival = readstat_variable_get_missing_range_hi(variable, i) + * pyhival = convert_readstat_to_python_value(hival, index, dc) + * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) # <<<<<<<<<<<<<< + * dc.missing_ranges[col_name] = missing_ranges * + */ + __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_lo, __pyx_v_pyloval) < 0) __PYX_ERR(0, 531, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_hi, __pyx_v_pyhival) < 0) __PYX_ERR(0, 531, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_missing_ranges, __pyx_t_10); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 531, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + + /* "pyreadstat/_readstat_parser.pyx":532 + * pyhival = convert_readstat_to_python_value(hival, index, dc) + * missing_ranges.append({'lo':pyloval, 'hi':pyhival}) + * dc.missing_ranges[col_name] = missing_ranges # <<<<<<<<<<<<<< * - * cdef object data_container_to_dict(data_container data): # <<<<<<<<<<<<<< - * """ - * Transforms a data container object to a pandas data frame + * cdef size_t storage_width */ + if (unlikely(__pyx_v_dc->missing_ranges == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 532, __pyx_L1_error) + } + if (unlikely((PyDict_SetItem(__pyx_v_dc->missing_ranges, __pyx_v_col_name, __pyx_v_missing_ranges) < 0))) __PYX_ERR(0, 532, __pyx_L1_error) -static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_data_container_to_dict(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_data) { - PyObject *__pyx_v_final_container = 0; - PyObject *__pyx_v_col_data = 0; - PyObject *__pyx_v_col_names = 0; - PyObject *__pyx_v_cur_name_str = 0; - int __pyx_v_fc_cnt; - int __pyx_v_is_unkown_number_rows; - int __pyx_v_max_n_obs; - int __pyx_v_metaonly; - PyObject *__pyx_v_cur_data = 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; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("data_container_to_dict", 0); + /* "pyreadstat/_readstat_parser.pyx":524 + * if dc.usernan: + * n_ranges = readstat_variable_get_missing_ranges_count(variable) + * if n_ranges>0: # <<<<<<<<<<<<<< + * missing_ranges = list() + * for i in range(0, n_ranges): + */ + } - /* "pyreadstat/_readstat_parser.pyx":890 - * cdef bint metaonly + /* "pyreadstat/_readstat_parser.pyx":522 * - * final_container = OrderedDict() # <<<<<<<<<<<<<< - * col_data = data.col_data - * col_names = data.col_names + * # missing values + * if dc.usernan: # <<<<<<<<<<<<<< + * n_ranges = readstat_variable_get_missing_ranges_count(variable) + * if n_ranges>0: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __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_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, 890, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_final_container = __pyx_t_1; - __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":891 + /* "pyreadstat/_readstat_parser.pyx":535 + * + * cdef size_t storage_width + * storage_width = readstat_variable_get_storage_width(variable) # <<<<<<<<<<<<<< + * dc.variable_storage_width[col_name] = storage_width * - * final_container = OrderedDict() - * col_data = data.col_data # <<<<<<<<<<<<<< - * col_names = data.col_names - * is_unkown_number_rows = data.is_unkown_number_rows - */ - __pyx_t_1 = __pyx_v_data->col_data; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_col_data = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "pyreadstat/_readstat_parser.pyx":892 - * final_container = OrderedDict() - * col_data = data.col_data - * col_names = data.col_names # <<<<<<<<<<<<<< - * is_unkown_number_rows = data.is_unkown_number_rows - * max_n_obs = data.max_n_obs */ - __pyx_t_1 = __pyx_v_data->col_names; - __Pyx_INCREF(__pyx_t_1); - __pyx_v_col_names = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_storage_width = readstat_variable_get_storage_width(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":893 - * col_data = data.col_data - * col_names = data.col_names - * is_unkown_number_rows = data.is_unkown_number_rows # <<<<<<<<<<<<<< - * max_n_obs = data.max_n_obs - * metaonly = data.metaonly + /* "pyreadstat/_readstat_parser.pyx":536 + * cdef size_t storage_width + * storage_width = readstat_variable_get_storage_width(variable) + * dc.variable_storage_width[col_name] = storage_width # <<<<<<<<<<<<<< + * + * dc.variable_display_width[col_name] = readstat_variable_get_display_width(variable) */ - __pyx_t_4 = __pyx_v_data->is_unkown_number_rows; - __pyx_v_is_unkown_number_rows = __pyx_t_4; + __pyx_t_10 = __Pyx_PyInt_From_int(((int)__pyx_v_storage_width)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(__pyx_v_dc->variable_storage_width == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 536, __pyx_L1_error) + } + if (unlikely((PyDict_SetItem(__pyx_v_dc->variable_storage_width, __pyx_v_col_name, __pyx_t_10) < 0))) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/_readstat_parser.pyx":894 - * col_names = data.col_names - * is_unkown_number_rows = data.is_unkown_number_rows - * max_n_obs = data.max_n_obs # <<<<<<<<<<<<<< - * metaonly = data.metaonly + /* "pyreadstat/_readstat_parser.pyx":538 + * dc.variable_storage_width[col_name] = storage_width + * + * dc.variable_display_width[col_name] = readstat_variable_get_display_width(variable) # <<<<<<<<<<<<<< * + * cdef readstat_alignment_t align */ - __pyx_t_5 = __pyx_v_data->max_n_obs; - __pyx_v_max_n_obs = __pyx_t_5; + __pyx_t_10 = __Pyx_PyInt_From_int(readstat_variable_get_display_width(__pyx_v_variable)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely((PyObject_SetItem(__pyx_v_dc->variable_display_width, __pyx_v_col_name, __pyx_t_10) < 0))) __PYX_ERR(0, 538, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/_readstat_parser.pyx":895 - * is_unkown_number_rows = data.is_unkown_number_rows - * max_n_obs = data.max_n_obs - * metaonly = data.metaonly # <<<<<<<<<<<<<< - * - * for fc_cnt in range(0, len(col_names)): + /* "pyreadstat/_readstat_parser.pyx":542 + * cdef readstat_alignment_t align + * cdef str pyalign + * align = readstat_variable_get_alignment(variable) # <<<<<<<<<<<<<< + * if align == READSTAT_ALIGNMENT_UNKNOWN: + * pyalign = "unknown" */ - __pyx_t_4 = __pyx_v_data->metaonly; - __pyx_v_metaonly = __pyx_t_4; + __pyx_v_align = readstat_variable_get_alignment(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":897 - * metaonly = data.metaonly - * - * for fc_cnt in range(0, len(col_names)): # <<<<<<<<<<<<<< - * cur_name_str = col_names[fc_cnt] - * cur_data = col_data[fc_cnt] + /* "pyreadstat/_readstat_parser.pyx":543 + * cdef str pyalign + * align = readstat_variable_get_alignment(variable) + * if align == READSTAT_ALIGNMENT_UNKNOWN: # <<<<<<<<<<<<<< + * pyalign = "unknown" + * elif align == READSTAT_ALIGNMENT_LEFT: */ - if (unlikely(__pyx_v_col_names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 897, __pyx_L1_error) - } - __pyx_t_6 = PyList_GET_SIZE(__pyx_v_col_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 897, __pyx_L1_error) - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) { - __pyx_v_fc_cnt = __pyx_t_5; + switch (__pyx_v_align) { + case READSTAT_ALIGNMENT_UNKNOWN: - /* "pyreadstat/_readstat_parser.pyx":898 - * - * for fc_cnt in range(0, len(col_names)): - * cur_name_str = col_names[fc_cnt] # <<<<<<<<<<<<<< - * cur_data = col_data[fc_cnt] - * if is_unkown_number_rows and not metaonly: + /* "pyreadstat/_readstat_parser.pyx":544 + * align = readstat_variable_get_alignment(variable) + * if align == READSTAT_ALIGNMENT_UNKNOWN: + * pyalign = "unknown" # <<<<<<<<<<<<<< + * elif align == READSTAT_ALIGNMENT_LEFT: + * pyalign = "left" */ - if (unlikely(__pyx_v_col_names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 898, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_fc_cnt, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 898, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_cur_name_str, ((PyObject*)__pyx_t_1)); - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_n_s_unknown); + __pyx_v_pyalign = __pyx_n_s_unknown; - /* "pyreadstat/_readstat_parser.pyx":899 - * for fc_cnt in range(0, len(col_names)): - * cur_name_str = col_names[fc_cnt] - * cur_data = col_data[fc_cnt] # <<<<<<<<<<<<<< - * if is_unkown_number_rows and not metaonly: - * cur_data = cur_data[0:max_n_obs] + /* "pyreadstat/_readstat_parser.pyx":543 + * cdef str pyalign + * align = readstat_variable_get_alignment(variable) + * if align == READSTAT_ALIGNMENT_UNKNOWN: # <<<<<<<<<<<<<< + * pyalign = "unknown" + * elif align == READSTAT_ALIGNMENT_LEFT: */ - if (unlikely(__pyx_v_col_data == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 899, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_data, __pyx_v_fc_cnt, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_cur_data, __pyx_t_1); - __pyx_t_1 = 0; + break; + case READSTAT_ALIGNMENT_LEFT: - /* "pyreadstat/_readstat_parser.pyx":900 - * cur_name_str = col_names[fc_cnt] - * cur_data = col_data[fc_cnt] - * if is_unkown_number_rows and not metaonly: # <<<<<<<<<<<<<< - * cur_data = cur_data[0:max_n_obs] - * if not metaonly: + /* "pyreadstat/_readstat_parser.pyx":546 + * pyalign = "unknown" + * elif align == READSTAT_ALIGNMENT_LEFT: + * pyalign = "left" # <<<<<<<<<<<<<< + * elif align == READSTAT_ALIGNMENT_CENTER: + * pyalign = "center" */ - __pyx_t_8 = (__pyx_v_is_unkown_number_rows != 0); - if (__pyx_t_8) { - } else { - __pyx_t_4 = __pyx_t_8; - goto __pyx_L6_bool_binop_done; - } - __pyx_t_8 = ((!(__pyx_v_metaonly != 0)) != 0); - __pyx_t_4 = __pyx_t_8; - __pyx_L6_bool_binop_done:; - if (__pyx_t_4) { + __Pyx_INCREF(__pyx_n_s_left); + __pyx_v_pyalign = __pyx_n_s_left; - /* "pyreadstat/_readstat_parser.pyx":901 - * cur_data = col_data[fc_cnt] - * if is_unkown_number_rows and not metaonly: - * cur_data = cur_data[0:max_n_obs] # <<<<<<<<<<<<<< - * if not metaonly: - * final_container[cur_name_str] = cur_data + /* "pyreadstat/_readstat_parser.pyx":545 + * if align == READSTAT_ALIGNMENT_UNKNOWN: + * pyalign = "unknown" + * elif align == READSTAT_ALIGNMENT_LEFT: # <<<<<<<<<<<<<< + * pyalign = "left" + * elif align == READSTAT_ALIGNMENT_CENTER: */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_cur_data, 0, __pyx_v_max_n_obs, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_cur_data, __pyx_t_1); - __pyx_t_1 = 0; + break; + case READSTAT_ALIGNMENT_CENTER: - /* "pyreadstat/_readstat_parser.pyx":900 - * cur_name_str = col_names[fc_cnt] - * cur_data = col_data[fc_cnt] - * if is_unkown_number_rows and not metaonly: # <<<<<<<<<<<<<< - * cur_data = cur_data[0:max_n_obs] - * if not metaonly: + /* "pyreadstat/_readstat_parser.pyx":548 + * pyalign = "left" + * elif align == READSTAT_ALIGNMENT_CENTER: + * pyalign = "center" # <<<<<<<<<<<<<< + * elif align == READSTAT_ALIGNMENT_RIGHT: + * pyalign = "right" */ - } + __Pyx_INCREF(__pyx_n_s_center); + __pyx_v_pyalign = __pyx_n_s_center; - /* "pyreadstat/_readstat_parser.pyx":902 - * if is_unkown_number_rows and not metaonly: - * cur_data = cur_data[0:max_n_obs] - * if not metaonly: # <<<<<<<<<<<<<< - * final_container[cur_name_str] = cur_data - * else: + /* "pyreadstat/_readstat_parser.pyx":547 + * elif align == READSTAT_ALIGNMENT_LEFT: + * pyalign = "left" + * elif align == READSTAT_ALIGNMENT_CENTER: # <<<<<<<<<<<<<< + * pyalign = "center" + * elif align == READSTAT_ALIGNMENT_RIGHT: */ - __pyx_t_4 = ((!(__pyx_v_metaonly != 0)) != 0); - if (__pyx_t_4) { + break; + case READSTAT_ALIGNMENT_RIGHT: - /* "pyreadstat/_readstat_parser.pyx":903 - * cur_data = cur_data[0:max_n_obs] - * if not metaonly: - * final_container[cur_name_str] = cur_data # <<<<<<<<<<<<<< - * else: - * final_container[cur_name_str] = list() + /* "pyreadstat/_readstat_parser.pyx":550 + * pyalign = "center" + * elif align == READSTAT_ALIGNMENT_RIGHT: + * pyalign = "right" # <<<<<<<<<<<<<< + * else: + * pyalign = "undetermined" */ - if (unlikely(PyObject_SetItem(__pyx_v_final_container, __pyx_v_cur_name_str, __pyx_v_cur_data) < 0)) __PYX_ERR(0, 903, __pyx_L1_error) + __Pyx_INCREF(__pyx_n_s_right); + __pyx_v_pyalign = __pyx_n_s_right; - /* "pyreadstat/_readstat_parser.pyx":902 - * if is_unkown_number_rows and not metaonly: - * cur_data = cur_data[0:max_n_obs] - * if not metaonly: # <<<<<<<<<<<<<< - * final_container[cur_name_str] = cur_data - * else: + /* "pyreadstat/_readstat_parser.pyx":549 + * elif align == READSTAT_ALIGNMENT_CENTER: + * pyalign = "center" + * elif align == READSTAT_ALIGNMENT_RIGHT: # <<<<<<<<<<<<<< + * pyalign = "right" + * else: */ - goto __pyx_L8; - } + break; + default: - /* "pyreadstat/_readstat_parser.pyx":905 - * final_container[cur_name_str] = cur_data - * else: - * final_container[cur_name_str] = list() # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":552 + * pyalign = "right" + * else: + * pyalign = "undetermined" # <<<<<<<<<<<<<< * - * return final_container + * dc.variable_alignment[col_name] = pyalign */ - /*else*/ { - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_v_final_container, __pyx_v_cur_name_str, __pyx_t_1) < 0)) __PYX_ERR(0, 905, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L8:; + __Pyx_INCREF(__pyx_n_s_undetermined); + __pyx_v_pyalign = __pyx_n_s_undetermined; + break; } - /* "pyreadstat/_readstat_parser.pyx":907 - * final_container[cur_name_str] = list() - * - * return final_container # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":554 + * pyalign = "undetermined" * + * dc.variable_alignment[col_name] = pyalign # <<<<<<<<<<<<<< * + * cdef readstat_measure_t measure */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_final_container); - __pyx_r = __pyx_v_final_container; - goto __pyx_L0; + if (unlikely((PyObject_SetItem(__pyx_v_dc->variable_alignment, __pyx_v_col_name, __pyx_v_pyalign) < 0))) __PYX_ERR(0, 554, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":876 - * - * - * cdef object data_container_to_dict(data_container data): # <<<<<<<<<<<<<< - * """ - * Transforms a data container object to a pandas data frame + /* "pyreadstat/_readstat_parser.pyx":558 + * cdef readstat_measure_t measure + * cdef str pymeasure + * measure = readstat_variable_get_measure(variable) # <<<<<<<<<<<<<< + * if measure == READSTAT_MEASURE_UNKNOWN: + * pymeasure = "unknown" */ + __pyx_v_measure = readstat_variable_get_measure(__pyx_v_variable); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + /* "pyreadstat/_readstat_parser.pyx":559 + * cdef str pymeasure + * measure = readstat_variable_get_measure(variable) + * if measure == READSTAT_MEASURE_UNKNOWN: # <<<<<<<<<<<<<< + * pymeasure = "unknown" + * elif measure == READSTAT_MEASURE_NOMINAL: + */ + switch (__pyx_v_measure) { + case READSTAT_MEASURE_UNKNOWN: + + /* "pyreadstat/_readstat_parser.pyx":560 + * measure = readstat_variable_get_measure(variable) + * if measure == READSTAT_MEASURE_UNKNOWN: + * pymeasure = "unknown" # <<<<<<<<<<<<<< + * elif measure == READSTAT_MEASURE_NOMINAL: + * pymeasure = "nominal" + */ + __Pyx_INCREF(__pyx_n_s_unknown); + __pyx_v_pymeasure = __pyx_n_s_unknown; + + /* "pyreadstat/_readstat_parser.pyx":559 + * cdef str pymeasure + * measure = readstat_variable_get_measure(variable) + * if measure == READSTAT_MEASURE_UNKNOWN: # <<<<<<<<<<<<<< + * pymeasure = "unknown" + * elif measure == READSTAT_MEASURE_NOMINAL: + */ + break; + case READSTAT_MEASURE_NOMINAL: + + /* "pyreadstat/_readstat_parser.pyx":562 + * pymeasure = "unknown" + * elif measure == READSTAT_MEASURE_NOMINAL: + * pymeasure = "nominal" # <<<<<<<<<<<<<< + * elif measure == READSTAT_MEASURE_ORDINAL: + * pymeasure = "ordinal" + */ + __Pyx_INCREF(__pyx_n_s_nominal); + __pyx_v_pymeasure = __pyx_n_s_nominal; + + /* "pyreadstat/_readstat_parser.pyx":561 + * if measure == READSTAT_MEASURE_UNKNOWN: + * pymeasure = "unknown" + * elif measure == READSTAT_MEASURE_NOMINAL: # <<<<<<<<<<<<<< + * pymeasure = "nominal" + * elif measure == READSTAT_MEASURE_ORDINAL: + */ + break; + case READSTAT_MEASURE_ORDINAL: + + /* "pyreadstat/_readstat_parser.pyx":564 + * pymeasure = "nominal" + * elif measure == READSTAT_MEASURE_ORDINAL: + * pymeasure = "ordinal" # <<<<<<<<<<<<<< + * elif measure == READSTAT_MEASURE_SCALE: + * pymeasure = "scale" + */ + __Pyx_INCREF(__pyx_n_s_ordinal); + __pyx_v_pymeasure = __pyx_n_s_ordinal; + + /* "pyreadstat/_readstat_parser.pyx":563 + * elif measure == READSTAT_MEASURE_NOMINAL: + * pymeasure = "nominal" + * elif measure == READSTAT_MEASURE_ORDINAL: # <<<<<<<<<<<<<< + * pymeasure = "ordinal" + * elif measure == READSTAT_MEASURE_SCALE: + */ + break; + case READSTAT_MEASURE_SCALE: + + /* "pyreadstat/_readstat_parser.pyx":566 + * pymeasure = "ordinal" + * elif measure == READSTAT_MEASURE_SCALE: + * pymeasure = "scale" # <<<<<<<<<<<<<< + * else: + * pymeasure = "undetermined" + */ + __Pyx_INCREF(__pyx_n_s_scale); + __pyx_v_pymeasure = __pyx_n_s_scale; + + /* "pyreadstat/_readstat_parser.pyx":565 + * elif measure == READSTAT_MEASURE_ORDINAL: + * pymeasure = "ordinal" + * elif measure == READSTAT_MEASURE_SCALE: # <<<<<<<<<<<<<< + * pymeasure = "scale" + * else: + */ + break; + default: + + /* "pyreadstat/_readstat_parser.pyx":568 + * pymeasure = "scale" + * else: + * pymeasure = "undetermined" # <<<<<<<<<<<<<< + * + * dc.variable_measure[col_name] = pymeasure + */ + __Pyx_INCREF(__pyx_n_s_undetermined); + __pyx_v_pymeasure = __pyx_n_s_undetermined; + break; + } + + /* "pyreadstat/_readstat_parser.pyx":570 + * pymeasure = "undetermined" + * + * dc.variable_measure[col_name] = pymeasure # <<<<<<<<<<<<<< + * + * return READSTAT_HANDLER_OK + */ + if (unlikely((PyObject_SetItem(__pyx_v_dc->variable_measure, __pyx_v_col_name, __pyx_v_pymeasure) < 0))) __PYX_ERR(0, 570, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":572 + * dc.variable_measure[col_name] = pymeasure + * + * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = READSTAT_HANDLER_OK; + goto __pyx_L0; + + /* "pyreadstat/_readstat_parser.pyx":408 + * return READSTAT_HANDLER_OK + * + * cdef int handle_variable(int index, readstat_variable_t *variable, # <<<<<<<<<<<<<< + * char *val_labels, void *ctx) except READSTAT_HANDLER_ABORT: + * """ + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container_to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = READSTAT_HANDLER_ABORT; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_final_container); - __Pyx_XDECREF(__pyx_v_col_data); - __Pyx_XDECREF(__pyx_v_col_names); - __Pyx_XDECREF(__pyx_v_cur_name_str); - __Pyx_XDECREF(__pyx_v_cur_data); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_col_name); + __Pyx_XDECREF(__pyx_v_col_label); + __Pyx_XDECREF(__pyx_v_label_name); + __Pyx_XDECREF(__pyx_v_col_format_original); + __Pyx_XDECREF(__pyx_v_pyloval); + __Pyx_XDECREF(__pyx_v_pyhival); + __Pyx_XDECREF(__pyx_v_missing_ranges); + __Pyx_XDECREF(__pyx_v_curnptype); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XDECREF(__pyx_v_newcolname); + __Pyx_XDECREF((PyObject *)__pyx_v_dc); + __Pyx_XDECREF(__pyx_v_msg); + __Pyx_XDECREF(__pyx_v_pyalign); + __Pyx_XDECREF(__pyx_v_pymeasure); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_parser.pyx":910 +/* "pyreadstat/_readstat_parser.pyx":575 * * - * cdef object dict_to_pandas_dataframe(object dict_data, data_container dc): # <<<<<<<<<<<<<< + * cdef int handle_value(int obs_index, readstat_variable_t * variable, readstat_value_t value, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< * """ - * Transforms a dict of numpy arrays to a pandas data frame + * This function transforms every value to python types, and to datetime if */ -static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_dict_to_pandas_dataframe(PyObject *__pyx_v_dict_data, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc) { - int __pyx_v_dates_as_pandas; +static int __pyx_f_10pyreadstat_16_readstat_parser_handle_value(int __pyx_v_obs_index, readstat_variable_t *__pyx_v_variable, readstat_value_t __pyx_v_value, void *__pyx_v_ctx) { + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; int __pyx_v_index; - PyObject *__pyx_v_column = 0; - __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_var_format; - PyObject *__pyx_v_dtypes = 0; - PyObject *__pyx_v_data_frame = NULL; - PyObject *__pyx_r = NULL; + int __pyx_v_max_n_obs; + int __pyx_v_is_unkown_number_rows; + int __pyx_v_var_max_rows; + PyObject *__pyx_v_buf_list = 0; + int __pyx_v_iscurnptypeobject; + int __pyx_v_iscurnptypefloat; + int __pyx_v_missing_tag; + PyObject *__pyx_v_pyvalue = 0; + PyObject *__pyx_v_curset = 0; + PyObject *__pyx_v_curnptype = 0; + int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + 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 *); - __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dict_to_pandas_dataframe", 0); + __Pyx_RefNannySetupContext("handle_value", 0); - /* "pyreadstat/_readstat_parser.pyx":921 - * cdef list dtypes - * - * dates_as_pandas = dc.dates_as_pandas # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":597 * - * if dict_data: + * # extract variables we need from data container + * dc = ctx # <<<<<<<<<<<<<< + * index = readstat_variable_get_index_after_skipping(variable) + * max_n_obs = dc.max_n_obs */ - __pyx_t_1 = __pyx_v_dc->dates_as_pandas; - __pyx_v_dates_as_pandas = __pyx_t_1; + __pyx_t_1 = ((PyObject *)__pyx_v_ctx); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":923 - * dates_as_pandas = dc.dates_as_pandas - * - * if dict_data: # <<<<<<<<<<<<<< - * data_frame = pd.DataFrame.from_dict(dict_data) - * if dates_as_pandas: + /* "pyreadstat/_readstat_parser.pyx":598 + * # extract variables we need from data container + * dc = ctx + * index = readstat_variable_get_index_after_skipping(variable) # <<<<<<<<<<<<<< + * max_n_obs = dc.max_n_obs + * is_unkown_number_rows = dc.is_unkown_number_rows */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dict_data); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 923, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_v_index = readstat_variable_get_index_after_skipping(__pyx_v_variable); - /* "pyreadstat/_readstat_parser.pyx":924 - * - * if dict_data: - * data_frame = pd.DataFrame.from_dict(dict_data) # <<<<<<<<<<<<<< - * if dates_as_pandas: - * dtypes = data_frame.dtypes.tolist() + /* "pyreadstat/_readstat_parser.pyx":599 + * dc = ctx + * index = readstat_variable_get_index_after_skipping(variable) + * max_n_obs = dc.max_n_obs # <<<<<<<<<<<<<< + * is_unkown_number_rows = dc.is_unkown_number_rows + * #iscurnptypeobject = dc.col_dtypes_isobject[index] */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __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_from_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __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, __pyx_v_dict_data) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_dict_data); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_data_frame = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2 = __pyx_v_dc->max_n_obs; + __pyx_v_max_n_obs = __pyx_t_2; - /* "pyreadstat/_readstat_parser.pyx":925 - * if dict_data: - * data_frame = pd.DataFrame.from_dict(dict_data) - * if dates_as_pandas: # <<<<<<<<<<<<<< - * dtypes = data_frame.dtypes.tolist() - * # check that datetime columns are datetime type + /* "pyreadstat/_readstat_parser.pyx":600 + * index = readstat_variable_get_index_after_skipping(variable) + * max_n_obs = dc.max_n_obs + * is_unkown_number_rows = dc.is_unkown_number_rows # <<<<<<<<<<<<<< + * #iscurnptypeobject = dc.col_dtypes_isobject[index] + * #iscurnptypefloat = dc.col_dytpes_isfloat[index] */ - __pyx_t_1 = (__pyx_v_dates_as_pandas != 0); - if (__pyx_t_1) { + __pyx_t_3 = __pyx_v_dc->is_unkown_number_rows; + __pyx_v_is_unkown_number_rows = __pyx_t_3; - /* "pyreadstat/_readstat_parser.pyx":926 - * data_frame = pd.DataFrame.from_dict(dict_data) - * if dates_as_pandas: - * dtypes = data_frame.dtypes.tolist() # <<<<<<<<<<<<<< - * # check that datetime columns are datetime type - * # this is needed in case all date values are nan + /* "pyreadstat/_readstat_parser.pyx":606 + * # check that we still have enough room in our pre-allocated lists + * # if not, add more room + * iscurnptypeobject = dc.col_dtypes_isobject[index] # <<<<<<<<<<<<<< + * iscurnptypefloat = dc.col_dytpes_isfloat[index] + * if is_unkown_number_rows: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data_frame, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tolist); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 926, __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 && likely(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, 926, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 926, __pyx_L1_error) - __pyx_v_dtypes = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 606, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 606, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_iscurnptypeobject = __pyx_t_3; - /* "pyreadstat/_readstat_parser.pyx":929 - * # check that datetime columns are datetime type - * # this is needed in case all date values are nan - * for index, column in enumerate(data_frame.columns): # <<<<<<<<<<<<<< - * var_format = dc.col_formats[index] - * if dtypes[index] != 'tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 929, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 929, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 929, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_7(__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, 929, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 929, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_column, ((PyObject*)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_v_index = __pyx_t_5; - __pyx_t_5 = (__pyx_t_5 + 1); + if (unlikely(__pyx_v_dc->col_dytpes_isfloat == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 607, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dytpes_isfloat, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 607, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_iscurnptypefloat = __pyx_t_3; - /* "pyreadstat/_readstat_parser.pyx":930 - * # this is needed in case all date values are nan - * for index, column in enumerate(data_frame.columns): - * var_format = dc.col_formats[index] # <<<<<<<<<<<<<< - * if dtypes[index] != 'col_formats == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 930, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_dc->col_formats, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = ((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_var_format = __pyx_t_8; + if (__pyx_v_is_unkown_number_rows) { - /* "pyreadstat/_readstat_parser.pyx":931 - * for index, column in enumerate(data_frame.columns): - * var_format = dc.col_formats[index] - * if dtypes[index] != 'max_n_obs = (__pyx_v_obs_index + 1); - /* "pyreadstat/_readstat_parser.pyx":931 - * for index, column in enumerate(data_frame.columns): - * var_format = dc.col_formats[index] - * if dtypes[index] != 'col_data_len == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 611, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data_len, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __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, 611, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_var_max_rows = __pyx_t_2; - /* "pyreadstat/_readstat_parser.pyx":925 - * if dict_data: - * data_frame = pd.DataFrame.from_dict(dict_data) - * if dates_as_pandas: # <<<<<<<<<<<<<< - * dtypes = data_frame.dtypes.tolist() - * # check that datetime columns are datetime type + /* "pyreadstat/_readstat_parser.pyx":612 + * dc.max_n_obs = obs_index + 1 + * var_max_rows = dc.col_data_len[index] + * if var_max_rows <= obs_index: # <<<<<<<<<<<<<< + * curnptype = dc.col_numpy_dtypes[index] + * buf_list = np.empty(100000, dtype=curnptype) */ - } + __pyx_t_3 = (__pyx_v_var_max_rows <= __pyx_v_obs_index); + if (__pyx_t_3) { - /* "pyreadstat/_readstat_parser.pyx":923 - * dates_as_pandas = dc.dates_as_pandas - * - * if dict_data: # <<<<<<<<<<<<<< - * data_frame = pd.DataFrame.from_dict(dict_data) - * if dates_as_pandas: - */ - goto __pyx_L3; - } - - /* "pyreadstat/_readstat_parser.pyx":934 - * data_frame[column] = pd.to_datetime(data_frame[column]) - * else: - * data_frame = pd.DataFrame() # <<<<<<<<<<<<<< - * - * return data_frame + /* "pyreadstat/_readstat_parser.pyx":613 + * var_max_rows = dc.col_data_len[index] + * if var_max_rows <= obs_index: + * curnptype = dc.col_numpy_dtypes[index] # <<<<<<<<<<<<<< + * buf_list = np.empty(100000, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 934, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 934, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); + if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 613, __pyx_L1_error) } - } - __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_v_data_frame = __pyx_t_4; - __pyx_t_4 = 0; - } - __pyx_L3:; + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_curnptype = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":936 - * data_frame = pd.DataFrame() - * - * return data_frame # <<<<<<<<<<<<<< - * - * + /* "pyreadstat/_readstat_parser.pyx":614 + * if var_max_rows <= obs_index: + * curnptype = dc.col_numpy_dtypes[index] + * buf_list = np.empty(100000, dtype=curnptype) # <<<<<<<<<<<<<< + * if iscurnptypeobject or iscurnptypefloat: + * buf_list.fill(np.nan) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_data_frame); - __pyx_r = __pyx_v_data_frame; - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_v_curnptype) < 0) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_buf_list = __pyx_t_5; + __pyx_t_5 = 0; - /* "pyreadstat/_readstat_parser.pyx":910 - * - * - * cdef object dict_to_pandas_dataframe(object dict_data, data_container dc): # <<<<<<<<<<<<<< - * """ - * Transforms a dict of numpy arrays to a pandas data frame + /* "pyreadstat/_readstat_parser.pyx":615 + * curnptype = dc.col_numpy_dtypes[index] + * buf_list = np.empty(100000, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< + * buf_list.fill(np.nan) + * dc.col_data[index] = np.append(dc.col_data[index], buf_list) */ + if (!__pyx_v_iscurnptypeobject) { + } else { + __pyx_t_3 = __pyx_v_iscurnptypeobject; + goto __pyx_L7_bool_binop_done; + } + __pyx_t_3 = __pyx_v_iscurnptypefloat; + __pyx_L7_bool_binop_done:; + if (__pyx_t_3) { - /* 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_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("pyreadstat._readstat_parser.dict_to_pandas_dataframe", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_column); - __Pyx_XDECREF(__pyx_v_dtypes); - __Pyx_XDECREF(__pyx_v_data_frame); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":616 + * buf_list = np.empty(100000, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: + * buf_list.fill(np.nan) # <<<<<<<<<<<<<< + * dc.col_data[index] = np.append(dc.col_data[index], buf_list) + * var_max_rows += 100000 + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_buf_list, __pyx_n_s_fill); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nan); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_2 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_2 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_2, 1+__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 616, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; -/* "pyreadstat/_readstat_parser.pyx":939 - * - * - * cdef object data_container_extract_metadata(data_container data): # <<<<<<<<<<<<<< - * """ - * Extracts metadata from a data container and puts it into a metadata + /* "pyreadstat/_readstat_parser.pyx":615 + * curnptype = dc.col_numpy_dtypes[index] + * buf_list = np.empty(100000, dtype=curnptype) + * if iscurnptypeobject or iscurnptypefloat: # <<<<<<<<<<<<<< + * buf_list.fill(np.nan) + * dc.col_data[index] = np.append(dc.col_data[index], buf_list) */ + } -static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_data_container_extract_metadata(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_data) { - int __pyx_v_metaonly; - int __pyx_v_is_unkown_number_rows; - PyObject *__pyx_v_label_to_var_name = 0; - PyObject *__pyx_v_labels_raw = 0; - PyObject *__pyx_v_var_name = 0; - PyObject *__pyx_v_var_label = 0; - PyObject *__pyx_v_current_labels = 0; - PyObject *__pyx_v_original_types = 0; - readstat_type_t __pyx_v_var_type; - PyObject *__pyx_v_metadata = 0; - PyObject *__pyx_v_variable_value_labels = NULL; - PyObject *__pyx_v_readstat_types = NULL; - PyObject *__pyx_v_indx = NULL; - PyObject *__pyx_v_cur_col = NULL; - PyObject *__pyx_v_cur_type = NULL; - PyObject *__pyx_v_curset = NULL; - PyObject *__pyx_7genexpr__pyx_v_k = NULL; - PyObject *__pyx_7genexpr__pyx_v_v = 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 *); - readstat_type_t __pyx_t_10; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("data_container_extract_metadata", 0); + /* "pyreadstat/_readstat_parser.pyx":617 + * if iscurnptypeobject or iscurnptypefloat: + * buf_list.fill(np.nan) + * dc.col_data[index] = np.append(dc.col_data[index], buf_list) # <<<<<<<<<<<<<< + * var_max_rows += 100000 + * dc.col_data_len[index] = var_max_rows + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_append); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 617, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + __pyx_t_2 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_2 = 1; + } + } + { + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_buf_list}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_2, 2+__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 617, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_data, __pyx_v_index, __pyx_t_5, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_parser.pyx":956 - * cdef readstat_type_t var_type - * - * metaonly = data.metaonly # <<<<<<<<<<<<<< - * is_unkown_number_rows = data.is_unkown_number_rows + /* "pyreadstat/_readstat_parser.pyx":618 + * buf_list.fill(np.nan) + * dc.col_data[index] = np.append(dc.col_data[index], buf_list) + * var_max_rows += 100000 # <<<<<<<<<<<<<< + * dc.col_data_len[index] = var_max_rows * */ - __pyx_t_1 = __pyx_v_data->metaonly; - __pyx_v_metaonly = __pyx_t_1; + __pyx_v_var_max_rows = (__pyx_v_var_max_rows + 0x186A0); - /* "pyreadstat/_readstat_parser.pyx":957 - * - * metaonly = data.metaonly - * is_unkown_number_rows = data.is_unkown_number_rows # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":619 + * dc.col_data[index] = np.append(dc.col_data[index], buf_list) + * var_max_rows += 100000 + * dc.col_data_len[index] = var_max_rows # <<<<<<<<<<<<<< * - * cdef object metadata = metadata_container() + * # transform to python value types */ - __pyx_t_1 = __pyx_v_data->is_unkown_number_rows; - __pyx_v_is_unkown_number_rows = __pyx_t_1; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_var_max_rows); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__pyx_v_dc->col_data_len == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 619, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_data_len, __pyx_v_index, __pyx_t_5, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_parser.pyx":959 - * is_unkown_number_rows = data.is_unkown_number_rows - * - * cdef object metadata = metadata_container() # <<<<<<<<<<<<<< - * - * # number of rows + /* "pyreadstat/_readstat_parser.pyx":612 + * dc.max_n_obs = obs_index + 1 + * var_max_rows = dc.col_data_len[index] + * if var_max_rows <= obs_index: # <<<<<<<<<<<<<< + * curnptype = dc.col_numpy_dtypes[index] + * buf_list = np.empty(100000, dtype=curnptype) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_metadata_container); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __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); } + + /* "pyreadstat/_readstat_parser.pyx":608 + * iscurnptypeobject = dc.col_dtypes_isobject[index] + * iscurnptypefloat = dc.col_dytpes_isfloat[index] + * if is_unkown_number_rows: # <<<<<<<<<<<<<< + * if max_n_obs <= obs_index: + * dc.max_n_obs = obs_index + 1 + */ } - __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(0, 959, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_metadata = __pyx_t_2; - __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":962 + /* "pyreadstat/_readstat_parser.pyx":622 * - * # number of rows - * metadata.number_columns = data.n_vars # <<<<<<<<<<<<<< - * if is_unkown_number_rows: - * if not metaonly: + * # transform to python value types + * if readstat_value_is_missing(value, variable): # <<<<<<<<<<<<<< + * # The user does not want to retrieve missing values + * if not dc.usernan or readstat_value_is_system_missing(value): */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_data->n_vars); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_number_columns, __pyx_t_2) < 0) __PYX_ERR(0, 962, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = (readstat_value_is_missing(__pyx_v_value, __pyx_v_variable) != 0); + if (__pyx_t_3) { - /* "pyreadstat/_readstat_parser.pyx":963 - * # number of rows - * metadata.number_columns = data.n_vars - * if is_unkown_number_rows: # <<<<<<<<<<<<<< - * if not metaonly: - * metadata.number_rows = data.max_n_obs + /* "pyreadstat/_readstat_parser.pyx":624 + * if readstat_value_is_missing(value, variable): + * # The user does not want to retrieve missing values + * if not dc.usernan or readstat_value_is_system_missing(value): # <<<<<<<<<<<<<< + * if iscurnptypefloat == 1 or iscurnptypeobject == 1: + * # already allocated */ - __pyx_t_1 = (__pyx_v_is_unkown_number_rows != 0); - if (__pyx_t_1) { + __pyx_t_7 = (!__pyx_v_dc->usernan); + if (!__pyx_t_7) { + } else { + __pyx_t_3 = __pyx_t_7; + goto __pyx_L11_bool_binop_done; + } + __pyx_t_7 = (readstat_value_is_system_missing(__pyx_v_value) != 0); + __pyx_t_3 = __pyx_t_7; + __pyx_L11_bool_binop_done:; + if (__pyx_t_3) { - /* "pyreadstat/_readstat_parser.pyx":964 - * metadata.number_columns = data.n_vars - * if is_unkown_number_rows: - * if not metaonly: # <<<<<<<<<<<<<< - * metadata.number_rows = data.max_n_obs - * else: + /* "pyreadstat/_readstat_parser.pyx":625 + * # The user does not want to retrieve missing values + * if not dc.usernan or readstat_value_is_system_missing(value): + * if iscurnptypefloat == 1 or iscurnptypeobject == 1: # <<<<<<<<<<<<<< + * # already allocated + * pass */ - __pyx_t_1 = ((!(__pyx_v_metaonly != 0)) != 0); - if (__pyx_t_1) { + __pyx_t_7 = (__pyx_v_iscurnptypefloat == 1); + if (!__pyx_t_7) { + } else { + __pyx_t_3 = __pyx_t_7; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_iscurnptypeobject == 1); + __pyx_t_3 = __pyx_t_7; + __pyx_L14_bool_binop_done:; + if (__pyx_t_3) { + goto __pyx_L13; + } - /* "pyreadstat/_readstat_parser.pyx":965 - * if is_unkown_number_rows: - * if not metaonly: - * metadata.number_rows = data.max_n_obs # <<<<<<<<<<<<<< - * else: - * metadata.number_rows = data.n_obs + /* "pyreadstat/_readstat_parser.pyx":631 + * # for any type except float, the numpy type will be object as now we have nans + * else: + * dc.col_numpy_dtypes[index] = object # <<<<<<<<<<<<<< + * dc.col_dtypes_isobject[index] = 1 + * iscurnptypeobject = 1 */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_data->max_n_obs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_number_rows, __pyx_t_2) < 0) __PYX_ERR(0, 965, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /*else*/ { + if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 631, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, __pyx_builtin_object, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 631, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":964 - * metadata.number_columns = data.n_vars - * if is_unkown_number_rows: - * if not metaonly: # <<<<<<<<<<<<<< - * metadata.number_rows = data.max_n_obs - * else: + /* "pyreadstat/_readstat_parser.pyx":632 + * else: + * dc.col_numpy_dtypes[index] = object + * dc.col_dtypes_isobject[index] = 1 # <<<<<<<<<<<<<< + * iscurnptypeobject = 1 + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) */ - } + if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 632, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, __pyx_int_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 632, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":963 - * # number of rows - * metadata.number_columns = data.n_vars - * if is_unkown_number_rows: # <<<<<<<<<<<<<< - * if not metaonly: - * metadata.number_rows = data.max_n_obs + /* "pyreadstat/_readstat_parser.pyx":633 + * dc.col_numpy_dtypes[index] = object + * dc.col_dtypes_isobject[index] = 1 + * iscurnptypeobject = 1 # <<<<<<<<<<<<<< + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) + * dc.col_data[index][obs_index:] = np.nan */ - goto __pyx_L3; - } + __pyx_v_iscurnptypeobject = 1; - /* "pyreadstat/_readstat_parser.pyx":967 - * metadata.number_rows = data.max_n_obs - * else: - * metadata.number_rows = data.n_obs # <<<<<<<<<<<<<< - * - * # value labels + /* "pyreadstat/_readstat_parser.pyx":634 + * dc.col_dtypes_isobject[index] = 1 + * iscurnptypeobject = 1 + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) # <<<<<<<<<<<<<< + * dc.col_data[index][obs_index:] = np.nan + * #dc.col_data[index][obs_index] = NAN */ - /*else*/ { - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_data->n_obs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_number_rows, __pyx_t_2) < 0) __PYX_ERR(0, 967, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - __pyx_L3:; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 634, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(0, 634, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__5, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 634, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_data, __pyx_v_index, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":970 - * - * # value labels - * labels_raw = data.labels_raw # <<<<<<<<<<<<<< - * label_to_var_name = data.label_to_var_name - * variable_value_labels = dict() + /* "pyreadstat/_readstat_parser.pyx":635 + * iscurnptypeobject = 1 + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) + * dc.col_data[index][obs_index:] = np.nan # <<<<<<<<<<<<<< + * #dc.col_data[index][obs_index] = NAN + * elif readstat_value_is_defined_missing(value, variable): */ - __pyx_t_2 = __pyx_v_data->labels_raw; - __Pyx_INCREF(__pyx_t_2); - __pyx_v_labels_raw = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 635, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyObject_SetSlice(__pyx_t_1, __pyx_t_5, __pyx_v_obs_index, 0, NULL, NULL, NULL, 1, 0, 1) < 0) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_L13:; - /* "pyreadstat/_readstat_parser.pyx":971 - * # value labels - * labels_raw = data.labels_raw - * label_to_var_name = data.label_to_var_name # <<<<<<<<<<<<<< - * variable_value_labels = dict() - * + /* "pyreadstat/_readstat_parser.pyx":624 + * if readstat_value_is_missing(value, variable): + * # The user does not want to retrieve missing values + * if not dc.usernan or readstat_value_is_system_missing(value): # <<<<<<<<<<<<<< + * if iscurnptypefloat == 1 or iscurnptypeobject == 1: + * # already allocated */ - __pyx_t_2 = __pyx_v_data->label_to_var_name; - __Pyx_INCREF(__pyx_t_2); - __pyx_v_label_to_var_name = __pyx_t_2; - __pyx_t_2 = 0; + goto __pyx_L10; + } - /* "pyreadstat/_readstat_parser.pyx":972 - * labels_raw = data.labels_raw - * label_to_var_name = data.label_to_var_name - * variable_value_labels = dict() # <<<<<<<<<<<<<< - * - * if labels_raw: + /* "pyreadstat/_readstat_parser.pyx":637 + * dc.col_data[index][obs_index:] = np.nan + * #dc.col_data[index][obs_index] = NAN + * elif readstat_value_is_defined_missing(value, variable): # <<<<<<<<<<<<<< + * # SPSS missing values + * pyvalue = convert_readstat_to_python_value(value, index, dc) */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 972, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_variable_value_labels = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = (readstat_value_is_defined_missing(__pyx_v_value, __pyx_v_variable) != 0); + if (__pyx_t_3) { - /* "pyreadstat/_readstat_parser.pyx":974 - * variable_value_labels = dict() - * - * if labels_raw: # <<<<<<<<<<<<<< - * for var_name, var_label in label_to_var_name.items(): - * current_labels = labels_raw.get(var_label) + /* "pyreadstat/_readstat_parser.pyx":639 + * elif readstat_value_is_defined_missing(value, variable): + * # SPSS missing values + * pyvalue = convert_readstat_to_python_value(value, index, dc) # <<<<<<<<<<<<<< + * dc.col_data[index][obs_index] = pyvalue + * elif readstat_value_is_tagged_missing(value): */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_labels_raw); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 974, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_5 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_value, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_v_pyvalue = __pyx_t_5; + __pyx_t_5 = 0; - /* "pyreadstat/_readstat_parser.pyx":975 - * - * if labels_raw: - * for var_name, var_label in label_to_var_name.items(): # <<<<<<<<<<<<<< - * current_labels = labels_raw.get(var_label) - * if current_labels: + /* "pyreadstat/_readstat_parser.pyx":640 + * # SPSS missing values + * pyvalue = convert_readstat_to_python_value(value, index, dc) + * dc.col_data[index][obs_index] = pyvalue # <<<<<<<<<<<<<< + * elif readstat_value_is_tagged_missing(value): + * iscurnptypeobject = dc.col_dtypes_isobject[index] */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_label_to_var_name, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 975, __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(0, 975, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - 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_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 975, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_5 >= 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_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 975, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_5 >= 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_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 975, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_6(__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, 975, __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, 975, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_7 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 975, __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, 975, __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_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 975, __pyx_L1_error) - __pyx_t_9 = NULL; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L9_unpacking_done; - __pyx_L8_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, 975, __pyx_L1_error) - __pyx_L9_unpacking_done:; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 640, __pyx_L1_error) } - if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 975, __pyx_L1_error) - if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 975, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_var_name, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_var_label, ((PyObject*)__pyx_t_7)); - __pyx_t_7 = 0; + __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely((__Pyx_SetItemInt(__pyx_t_5, __pyx_v_obs_index, __pyx_v_pyvalue, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0))) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_parser.pyx":976 - * if labels_raw: - * for var_name, var_label in label_to_var_name.items(): - * current_labels = labels_raw.get(var_label) # <<<<<<<<<<<<<< - * if current_labels: - * variable_value_labels[var_name] = current_labels + /* "pyreadstat/_readstat_parser.pyx":637 + * dc.col_data[index][obs_index:] = np.nan + * #dc.col_data[index][obs_index] = NAN + * elif readstat_value_is_defined_missing(value, variable): # <<<<<<<<<<<<<< + * # SPSS missing values + * pyvalue = convert_readstat_to_python_value(value, index, dc) */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_labels_raw, __pyx_n_s_get); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 976, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } + goto __pyx_L10; + } + + /* "pyreadstat/_readstat_parser.pyx":641 + * pyvalue = convert_readstat_to_python_value(value, index, dc) + * dc.col_data[index][obs_index] = pyvalue + * elif readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< + * iscurnptypeobject = dc.col_dtypes_isobject[index] + * # SAS and Stata missing values + */ + __pyx_t_3 = (readstat_value_is_tagged_missing(__pyx_v_value) != 0); + if (__pyx_t_3) { + + /* "pyreadstat/_readstat_parser.pyx":642 + * dc.col_data[index][obs_index] = pyvalue + * elif readstat_value_is_tagged_missing(value): + * iscurnptypeobject = dc.col_dtypes_isobject[index] # <<<<<<<<<<<<<< + * # SAS and Stata missing values + * missing_tag = readstat_value_tag(value) + */ + if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 642, __pyx_L1_error) } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v_var_label) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_var_label); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_current_labels, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_iscurnptypeobject = __pyx_t_3; - /* "pyreadstat/_readstat_parser.pyx":977 - * for var_name, var_label in label_to_var_name.items(): - * current_labels = labels_raw.get(var_label) - * if current_labels: # <<<<<<<<<<<<<< - * variable_value_labels[var_name] = current_labels - * + /* "pyreadstat/_readstat_parser.pyx":644 + * iscurnptypeobject = dc.col_dtypes_isobject[index] + * # SAS and Stata missing values + * missing_tag = readstat_value_tag(value) # <<<<<<<<<<<<<< + * # In SAS missing values are A to Z or _ in stata a to z + * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_current_labels); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 977, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_v_missing_tag = ((int)readstat_value_tag(__pyx_v_value)); - /* "pyreadstat/_readstat_parser.pyx":978 - * current_labels = labels_raw.get(var_label) - * if current_labels: - * variable_value_labels[var_name] = current_labels # <<<<<<<<<<<<<< - * - * original_types = dict() + /* "pyreadstat/_readstat_parser.pyx":647 + * # In SAS missing values are A to Z or _ in stata a to z + * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): + * if iscurnptypeobject == 1: # <<<<<<<<<<<<<< + * dc.col_data[index][obs_index] = chr(missing_tag) + * else: */ - if (unlikely(PyDict_SetItem(__pyx_v_variable_value_labels, __pyx_v_var_name, __pyx_v_current_labels) < 0)) __PYX_ERR(0, 978, __pyx_L1_error) + __pyx_t_3 = (__pyx_v_iscurnptypeobject == 1); + if (__pyx_t_3) { - /* "pyreadstat/_readstat_parser.pyx":977 - * for var_name, var_label in label_to_var_name.items(): - * current_labels = labels_raw.get(var_label) - * if current_labels: # <<<<<<<<<<<<<< - * variable_value_labels[var_name] = current_labels - * + /* "pyreadstat/_readstat_parser.pyx":648 + * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): + * if iscurnptypeobject == 1: + * dc.col_data[index][obs_index] = chr(missing_tag) # <<<<<<<<<<<<<< + * else: + * dc.col_numpy_dtypes[index] = object + */ + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 648, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely((__Pyx_SetItemInt(__pyx_t_5, __pyx_v_obs_index, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0))) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "pyreadstat/_readstat_parser.pyx":647 + * # In SAS missing values are A to Z or _ in stata a to z + * # if (missing_tag >=65 and missing_tag <= 90) or missing_tag == 95 or (missing_tag >=61 and missing_tag <= 122): + * if iscurnptypeobject == 1: # <<<<<<<<<<<<<< + * dc.col_data[index][obs_index] = chr(missing_tag) + * else: */ + goto __pyx_L16; } - /* "pyreadstat/_readstat_parser.pyx":975 - * - * if labels_raw: - * for var_name, var_label in label_to_var_name.items(): # <<<<<<<<<<<<<< - * current_labels = labels_raw.get(var_label) - * if current_labels: + /* "pyreadstat/_readstat_parser.pyx":650 + * dc.col_data[index][obs_index] = chr(missing_tag) + * else: + * dc.col_numpy_dtypes[index] = object # <<<<<<<<<<<<<< + * dc.col_dtypes_isobject[index] = 1 + * dc.col_dytpes_isfloat[index] = 0 */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*else*/ { + if (unlikely(__pyx_v_dc->col_numpy_dtypes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 650, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_numpy_dtypes, __pyx_v_index, __pyx_builtin_object, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 650, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":974 - * variable_value_labels = dict() - * - * if labels_raw: # <<<<<<<<<<<<<< - * for var_name, var_label in label_to_var_name.items(): - * current_labels = labels_raw.get(var_label) + /* "pyreadstat/_readstat_parser.pyx":651 + * else: + * dc.col_numpy_dtypes[index] = object + * dc.col_dtypes_isobject[index] = 1 # <<<<<<<<<<<<<< + * dc.col_dytpes_isfloat[index] = 0 + * iscurnptypeobject = 1 */ - } + if (unlikely(__pyx_v_dc->col_dtypes_isobject == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 651, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_dtypes_isobject, __pyx_v_index, __pyx_int_1, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 651, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":980 - * variable_value_labels[var_name] = current_labels - * - * original_types = dict() # <<<<<<<<<<<<<< - * readstat_types = dict() - * for indx in range(metadata.number_columns): + /* "pyreadstat/_readstat_parser.pyx":652 + * dc.col_numpy_dtypes[index] = object + * dc.col_dtypes_isobject[index] = 1 + * dc.col_dytpes_isfloat[index] = 0 # <<<<<<<<<<<<<< + * iscurnptypeobject = 1 + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 980, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_original_types = __pyx_t_3; - __pyx_t_3 = 0; + if (unlikely(__pyx_v_dc->col_dytpes_isfloat == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 652, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_dytpes_isfloat, __pyx_v_index, __pyx_int_0, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 652, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":981 - * - * original_types = dict() - * readstat_types = dict() # <<<<<<<<<<<<<< - * for indx in range(metadata.number_columns): - * cur_col = data.col_names[indx] + /* "pyreadstat/_readstat_parser.pyx":653 + * dc.col_dtypes_isobject[index] = 1 + * dc.col_dytpes_isfloat[index] = 0 + * iscurnptypeobject = 1 # <<<<<<<<<<<<<< + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) + * dc.col_data[index][obs_index] = chr(missing_tag) */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 981, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_readstat_types = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_iscurnptypeobject = 1; - /* "pyreadstat/_readstat_parser.pyx":982 - * original_types = dict() - * readstat_types = dict() - * for indx in range(metadata.number_columns): # <<<<<<<<<<<<<< - * cur_col = data.col_names[indx] - * cur_type = data.col_formats_original[indx] + /* "pyreadstat/_readstat_parser.pyx":654 + * dc.col_dytpes_isfloat[index] = 0 + * iscurnptypeobject = 1 + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) # <<<<<<<<<<<<<< + * dc.col_data[index][obs_index] = chr(missing_tag) + * curset = dc.missing_user_values.get(index) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_number_columns); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 982, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 982, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - 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_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 982, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 982, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_5 >= 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_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 982, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 982, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_5 >= 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_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 982, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 982, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_6(__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, 982, __pyx_L1_error) + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 654, __pyx_L1_error) } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_indx, __pyx_t_2); - __pyx_t_2 = 0; - - /* "pyreadstat/_readstat_parser.pyx":983 - * readstat_types = dict() - * for indx in range(metadata.number_columns): - * cur_col = data.col_names[indx] # <<<<<<<<<<<<<< - * cur_type = data.col_formats_original[indx] - * original_types[cur_col] = cur_type - */ - if (unlikely(__pyx_v_data->col_names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 983, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data->col_names, __pyx_v_indx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_cur_col, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(0, 654, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__6, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 654, __pyx_L1_error) + } + if (unlikely((__Pyx_SetItemInt(__pyx_v_dc->col_data, __pyx_v_index, __pyx_t_6, int, 1, __Pyx_PyInt_From_int, 1, 1, 1) < 0))) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "pyreadstat/_readstat_parser.pyx":984 - * for indx in range(metadata.number_columns): - * cur_col = data.col_names[indx] - * cur_type = data.col_formats_original[indx] # <<<<<<<<<<<<<< - * original_types[cur_col] = cur_type - * var_type = data.col_dtypes[indx] + /* "pyreadstat/_readstat_parser.pyx":655 + * iscurnptypeobject = 1 + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) + * dc.col_data[index][obs_index] = chr(missing_tag) # <<<<<<<<<<<<<< + * curset = dc.missing_user_values.get(index) + * if curset is None: */ - if (unlikely(__pyx_v_data->col_formats_original == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 984, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data->col_formats_original, __pyx_v_indx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_cur_type, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 655, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely((__Pyx_SetItemInt(__pyx_t_6, __pyx_v_obs_index, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0))) __PYX_ERR(0, 655, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L16:; - /* "pyreadstat/_readstat_parser.pyx":985 - * cur_col = data.col_names[indx] - * cur_type = data.col_formats_original[indx] - * original_types[cur_col] = cur_type # <<<<<<<<<<<<<< - * var_type = data.col_dtypes[indx] - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: + /* "pyreadstat/_readstat_parser.pyx":656 + * dc.col_data[index] = dc.col_data[index].astype(object, copy=False) + * dc.col_data[index][obs_index] = chr(missing_tag) + * curset = dc.missing_user_values.get(index) # <<<<<<<<<<<<<< + * if curset is None: + * curset = set() */ - if (unlikely(PyObject_SetItem(__pyx_v_original_types, __pyx_v_cur_col, __pyx_v_cur_type) < 0)) __PYX_ERR(0, 985, __pyx_L1_error) + if (unlikely(__pyx_v_dc->missing_user_values == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); + __PYX_ERR(0, 656, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyDict_GetItemDefault(__pyx_v_dc->missing_user_values, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 656, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PySet_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_t_6))) __PYX_ERR(0, 656, __pyx_L1_error) + __pyx_v_curset = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; - /* "pyreadstat/_readstat_parser.pyx":986 - * cur_type = data.col_formats_original[indx] - * original_types[cur_col] = cur_type - * var_type = data.col_dtypes[indx] # <<<<<<<<<<<<<< - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: - * readstat_types[cur_col] = "string" + /* "pyreadstat/_readstat_parser.pyx":657 + * dc.col_data[index][obs_index] = chr(missing_tag) + * curset = dc.missing_user_values.get(index) + * if curset is None: # <<<<<<<<<<<<<< + * curset = set() + * curset.add(chr(missing_tag)) */ - if (unlikely(__pyx_v_data->col_dtypes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 986, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data->col_dtypes, __pyx_v_indx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 986, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 986, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_var_type = __pyx_t_10; + __pyx_t_3 = (__pyx_v_curset == ((PyObject*)Py_None)); + if (__pyx_t_3) { - /* "pyreadstat/_readstat_parser.pyx":987 - * original_types[cur_col] = cur_type - * var_type = data.col_dtypes[indx] - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< - * readstat_types[cur_col] = "string" - * elif var_type == READSTAT_TYPE_INT8: + /* "pyreadstat/_readstat_parser.pyx":658 + * curset = dc.missing_user_values.get(index) + * if curset is None: + * curset = set() # <<<<<<<<<<<<<< + * curset.add(chr(missing_tag)) + * dc.missing_user_values[index] = curset */ - switch (__pyx_v_var_type) { - case READSTAT_TYPE_STRING: - case READSTAT_TYPE_STRING_REF: + __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 658, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF_SET(__pyx_v_curset, ((PyObject*)__pyx_t_6)); + __pyx_t_6 = 0; - /* "pyreadstat/_readstat_parser.pyx":988 - * var_type = data.col_dtypes[indx] - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: - * readstat_types[cur_col] = "string" # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_INT8: - * readstat_types[cur_col] = "int8" + /* "pyreadstat/_readstat_parser.pyx":657 + * dc.col_data[index][obs_index] = chr(missing_tag) + * curset = dc.missing_user_values.get(index) + * if curset is None: # <<<<<<<<<<<<<< + * curset = set() + * curset.add(chr(missing_tag)) */ - if (unlikely(PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_string) < 0)) __PYX_ERR(0, 988, __pyx_L1_error) + } - /* "pyreadstat/_readstat_parser.pyx":987 - * original_types[cur_col] = cur_type - * var_type = data.col_dtypes[indx] - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< - * readstat_types[cur_col] = "string" - * elif var_type == READSTAT_TYPE_INT8: + /* "pyreadstat/_readstat_parser.pyx":659 + * if curset is None: + * curset = set() + * curset.add(chr(missing_tag)) # <<<<<<<<<<<<<< + * dc.missing_user_values[index] = curset + * else: */ - break; - case READSTAT_TYPE_INT8: + if (unlikely(__pyx_v_curset == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "add"); + __PYX_ERR(0, 659, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = PySet_Add(__pyx_v_curset, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 659, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":990 - * readstat_types[cur_col] = "string" - * elif var_type == READSTAT_TYPE_INT8: - * readstat_types[cur_col] = "int8" # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_INT16: - * readstat_types[cur_col] = "int16" + /* "pyreadstat/_readstat_parser.pyx":660 + * curset = set() + * curset.add(chr(missing_tag)) + * dc.missing_user_values[index] = curset # <<<<<<<<<<<<<< + * else: + * pyvalue = convert_readstat_to_python_value(value, index, dc) */ - if (unlikely(PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_int8) < 0)) __PYX_ERR(0, 990, __pyx_L1_error) + if (unlikely(__pyx_v_dc->missing_user_values == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 660, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyDict_SetItem(__pyx_v_dc->missing_user_values, __pyx_t_1, __pyx_v_curset) < 0))) __PYX_ERR(0, 660, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":989 - * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: - * readstat_types[cur_col] = "string" - * elif var_type == READSTAT_TYPE_INT8: # <<<<<<<<<<<<<< - * readstat_types[cur_col] = "int8" - * elif var_type == READSTAT_TYPE_INT16: + /* "pyreadstat/_readstat_parser.pyx":641 + * pyvalue = convert_readstat_to_python_value(value, index, dc) + * dc.col_data[index][obs_index] = pyvalue + * elif readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< + * iscurnptypeobject = dc.col_dtypes_isobject[index] + * # SAS and Stata missing values */ - break; - case READSTAT_TYPE_INT16: + } + __pyx_L10:; - /* "pyreadstat/_readstat_parser.pyx":992 - * readstat_types[cur_col] = "int8" - * elif var_type == READSTAT_TYPE_INT16: - * readstat_types[cur_col] = "int16" # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_INT32: - * readstat_types[cur_col] = "int32" + /* "pyreadstat/_readstat_parser.pyx":622 + * + * # transform to python value types + * if readstat_value_is_missing(value, variable): # <<<<<<<<<<<<<< + * # The user does not want to retrieve missing values + * if not dc.usernan or readstat_value_is_system_missing(value): */ - if (unlikely(PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_int16) < 0)) __PYX_ERR(0, 992, __pyx_L1_error) + goto __pyx_L9; + } - /* "pyreadstat/_readstat_parser.pyx":991 - * elif var_type == READSTAT_TYPE_INT8: - * readstat_types[cur_col] = "int8" - * elif var_type == READSTAT_TYPE_INT16: # <<<<<<<<<<<<<< - * readstat_types[cur_col] = "int16" - * elif var_type == READSTAT_TYPE_INT32: + /* "pyreadstat/_readstat_parser.pyx":662 + * dc.missing_user_values[index] = curset + * else: + * pyvalue = convert_readstat_to_python_value(value, index, dc) # <<<<<<<<<<<<<< + * dc.col_data[index][obs_index] = pyvalue + * */ - break; - case READSTAT_TYPE_INT32: + /*else*/ { + __pyx_t_1 = __pyx_f_10pyreadstat_16_readstat_parser_convert_readstat_to_python_value(__pyx_v_value, __pyx_v_index, __pyx_v_dc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_pyvalue = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":994 - * readstat_types[cur_col] = "int16" - * elif var_type == READSTAT_TYPE_INT32: - * readstat_types[cur_col] = "int32" # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_FLOAT: - * readstat_types[cur_col] = "float" + /* "pyreadstat/_readstat_parser.pyx":663 + * else: + * pyvalue = convert_readstat_to_python_value(value, index, dc) + * dc.col_data[index][obs_index] = pyvalue # <<<<<<<<<<<<<< + * + * return READSTAT_HANDLER_OK */ - if (unlikely(PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_int32) < 0)) __PYX_ERR(0, 994, __pyx_L1_error) + if (unlikely(__pyx_v_dc->col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 663, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dc->col_data, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((__Pyx_SetItemInt(__pyx_t_1, __pyx_v_obs_index, __pyx_v_pyvalue, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0))) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L9:; - /* "pyreadstat/_readstat_parser.pyx":993 - * elif var_type == READSTAT_TYPE_INT16: - * readstat_types[cur_col] = "int16" - * elif var_type == READSTAT_TYPE_INT32: # <<<<<<<<<<<<<< - * readstat_types[cur_col] = "int32" - * elif var_type == READSTAT_TYPE_FLOAT: + /* "pyreadstat/_readstat_parser.pyx":665 + * dc.col_data[index][obs_index] = pyvalue + * + * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + * + * */ - break; - case READSTAT_TYPE_FLOAT: + __pyx_r = READSTAT_HANDLER_OK; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":996 - * readstat_types[cur_col] = "int32" - * elif var_type == READSTAT_TYPE_FLOAT: - * readstat_types[cur_col] = "float" # <<<<<<<<<<<<<< - * elif var_type == READSTAT_TYPE_DOUBLE: - * readstat_types[cur_col] = "double" + /* "pyreadstat/_readstat_parser.pyx":575 + * + * + * cdef int handle_value(int obs_index, readstat_variable_t * variable, readstat_value_t value, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * This function transforms every value to python types, and to datetime if */ - if (unlikely(PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_float) < 0)) __PYX_ERR(0, 996, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":995 - * elif var_type == READSTAT_TYPE_INT32: - * readstat_types[cur_col] = "int32" - * elif var_type == READSTAT_TYPE_FLOAT: # <<<<<<<<<<<<<< - * readstat_types[cur_col] = "float" - * elif var_type == READSTAT_TYPE_DOUBLE: + /* 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_6); + __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = READSTAT_HANDLER_ABORT; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_dc); + __Pyx_XDECREF(__pyx_v_buf_list); + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XDECREF(__pyx_v_curset); + __Pyx_XDECREF(__pyx_v_curnptype); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyreadstat/_readstat_parser.pyx":668 + * + * + * cdef int handle_value_label(char *val_labels, readstat_value_t value, char *label, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * Reads the label for the value that belongs to the label set val_labels. In Handle variable we need to do a map */ - break; - case READSTAT_TYPE_DOUBLE: - /* "pyreadstat/_readstat_parser.pyx":998 - * readstat_types[cur_col] = "float" - * elif var_type == READSTAT_TYPE_DOUBLE: - * readstat_types[cur_col] = "double" # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("Unkown data type") +static int __pyx_f_10pyreadstat_16_readstat_parser_handle_value_label(char *__pyx_v_val_labels, readstat_value_t __pyx_v_value, char *__pyx_v_label, void *__pyx_v_ctx) { + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; + char *__pyx_v_c_str_value; + PyObject *__pyx_v_py_str_value = 0; + int8_t __pyx_v_c_int8_value; + int16_t __pyx_v_c_int16_value; + int32_t __pyx_v_c_int32_value; + float __pyx_v_c_float_value; + double __pyx_v_c_double_value; + long __pyx_v_py_long_value; + double __pyx_v_py_float_value; + __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format __pyx_v_pyformat; + PyObject *__pyx_v_labels_raw = 0; + PyObject *__pyx_v_var_label = 0; + PyObject *__pyx_v_value_label_name = 0; + readstat_type_t __pyx_v_value_type; + PyObject *__pyx_v_cur_dict = NULL; + int __pyx_v_missing_tag; + int __pyx_r; + __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; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_value_label", 0); + + /* "pyreadstat/_readstat_parser.pyx":674 + * """ + * + * cdef data_container dc = ctx # <<<<<<<<<<<<<< + * + * cdef char * c_str_value */ - if (unlikely(PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_double) < 0)) __PYX_ERR(0, 998, __pyx_L1_error) + __pyx_t_1 = ((PyObject *)__pyx_v_ctx); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":997 - * elif var_type == READSTAT_TYPE_FLOAT: - * readstat_types[cur_col] = "float" - * elif var_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< - * readstat_types[cur_col] = "double" - * else: + /* "pyreadstat/_readstat_parser.pyx":692 + * cdef str value_label_name + * + * var_label = val_labels # <<<<<<<<<<<<<< + * value_label_name = label + * */ - break; - default: + __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_val_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_var_label = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":1000 - * readstat_types[cur_col] = "double" - * else: - * raise PyreadstatError("Unkown data type") # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":693 * - * for indx, curset in data.missing_user_values.items(): + * var_label = val_labels + * value_label_name = label # <<<<<<<<<<<<<< + * + * cdef readstat_type_t value_type */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1000, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_kp_s_Unkown_data_type) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Unkown_data_type); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1000, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1000, __pyx_L1_error) - break; - } + __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_value_label_name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":982 - * original_types = dict() - * readstat_types = dict() - * for indx in range(metadata.number_columns): # <<<<<<<<<<<<<< - * cur_col = data.col_names[indx] - * cur_type = data.col_formats_original[indx] + /* "pyreadstat/_readstat_parser.pyx":696 + * + * cdef readstat_type_t value_type + * value_type = readstat_value_type(value) # <<<<<<<<<<<<<< + * + * labels_raw = dc.labels_raw */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_value_type = readstat_value_type(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":1002 - * raise PyreadstatError("Unkown data type") + /* "pyreadstat/_readstat_parser.pyx":698 + * value_type = readstat_value_type(value) * - * for indx, curset in data.missing_user_values.items(): # <<<<<<<<<<<<<< - * cur_col = data.col_names[indx] - * metadata.missing_user_values[cur_col] = sorted(list(curset)) + * labels_raw = dc.labels_raw # <<<<<<<<<<<<<< + * cur_dict = labels_raw.get(var_label) + * if not cur_dict: */ - if (unlikely(__pyx_v_data->missing_user_values == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 1002, __pyx_L1_error) + __pyx_t_1 = __pyx_v_dc->labels_raw; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_labels_raw = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pyreadstat/_readstat_parser.pyx":699 + * + * labels_raw = dc.labels_raw + * cur_dict = labels_raw.get(var_label) # <<<<<<<<<<<<<< + * if not cur_dict: + * cur_dict = dict() + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_labels_raw, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + 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_4 = 1; + } } - __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_data->missing_user_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1002, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1002, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1002, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_var_label}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1002, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1002, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1002, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1002, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_6(__pyx_t_2); - 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, 1002, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; - Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 1002, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_7 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1002, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1002, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1002, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_7); - index = 1; __pyx_t_4 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_4)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 1002, __pyx_L1_error) - __pyx_t_9 = NULL; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L16_unpacking_done; - __pyx_L15_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, 1002, __pyx_L1_error) - __pyx_L16_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_indx, __pyx_t_7); - __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_curset, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_cur_dict = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":1003 - * - * for indx, curset in data.missing_user_values.items(): - * cur_col = data.col_names[indx] # <<<<<<<<<<<<<< - * metadata.missing_user_values[cur_col] = sorted(list(curset)) + /* "pyreadstat/_readstat_parser.pyx":700 + * labels_raw = dc.labels_raw + * cur_dict = labels_raw.get(var_label) + * if not cur_dict: # <<<<<<<<<<<<<< + * cur_dict = dict() * */ - if (unlikely(__pyx_v_data->col_names == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 1003, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_data->col_names, __pyx_v_indx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_cur_col, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_cur_dict); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_t_6 = (!__pyx_t_5); + if (__pyx_t_6) { - /* "pyreadstat/_readstat_parser.pyx":1004 - * for indx, curset in data.missing_user_values.items(): - * cur_col = data.col_names[indx] - * metadata.missing_user_values[cur_col] = sorted(list(curset)) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":701 + * cur_dict = labels_raw.get(var_label) + * if not cur_dict: + * cur_dict = dict() # <<<<<<<<<<<<<< * - * metadata.notes = data.notes + * if readstat_value_is_tagged_missing(value): */ - __pyx_t_4 = PySequence_List(__pyx_v_curset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_11 = PyList_Sort(__pyx_t_3); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1004, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_missing_user_values); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (unlikely(PyObject_SetItem(__pyx_t_7, __pyx_v_cur_col, __pyx_t_3) < 0)) __PYX_ERR(0, 1004, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_cur_dict, __pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":1002 - * raise PyreadstatError("Unkown data type") + /* "pyreadstat/_readstat_parser.pyx":700 + * labels_raw = dc.labels_raw + * cur_dict = labels_raw.get(var_label) + * if not cur_dict: # <<<<<<<<<<<<<< + * cur_dict = dict() * - * for indx, curset in data.missing_user_values.items(): # <<<<<<<<<<<<<< - * cur_col = data.col_names[indx] - * metadata.missing_user_values[cur_col] = sorted(list(curset)) */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "pyreadstat/_readstat_parser.pyx":1006 - * metadata.missing_user_values[cur_col] = sorted(list(curset)) - * - * metadata.notes = data.notes # <<<<<<<<<<<<<< - * metadata.column_names = data.col_names - * metadata.column_labels = data.col_labels - */ - __pyx_t_2 = __pyx_v_data->notes; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_notes, __pyx_t_2) < 0) __PYX_ERR(0, 1006, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":1007 + /* "pyreadstat/_readstat_parser.pyx":703 + * cur_dict = dict() * - * metadata.notes = data.notes - * metadata.column_names = data.col_names # <<<<<<<<<<<<<< - * metadata.column_labels = data.col_labels - * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} + * if readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< + * # SAS and Stata missing values + * missing_tag = readstat_value_tag(value) */ - __pyx_t_2 = __pyx_v_data->col_names; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_column_names, __pyx_t_2) < 0) __PYX_ERR(0, 1007, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = (readstat_value_is_tagged_missing(__pyx_v_value) != 0); + if (__pyx_t_6) { - /* "pyreadstat/_readstat_parser.pyx":1008 - * metadata.notes = data.notes - * metadata.column_names = data.col_names - * metadata.column_labels = data.col_labels # <<<<<<<<<<<<<< - * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} - * metadata.file_encoding = data.file_encoding + /* "pyreadstat/_readstat_parser.pyx":705 + * if readstat_value_is_tagged_missing(value): + * # SAS and Stata missing values + * missing_tag = readstat_value_tag(value) # <<<<<<<<<<<<<< + * # In SAS missing values are A to Z or _ in stata a to z + * cur_dict[chr(missing_tag)] = value_label_name */ - __pyx_t_2 = __pyx_v_data->col_labels; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_column_labels, __pyx_t_2) < 0) __PYX_ERR(0, 1008, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_missing_tag = ((int)readstat_value_tag(__pyx_v_value)); - /* "pyreadstat/_readstat_parser.pyx":1009 - * metadata.column_names = data.col_names - * metadata.column_labels = data.col_labels - * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} # <<<<<<<<<<<<<< - * metadata.file_encoding = data.file_encoding - * metadata.file_label = data.file_label + /* "pyreadstat/_readstat_parser.pyx":707 + * missing_tag = readstat_value_tag(value) + * # In SAS missing values are A to Z or _ in stata a to z + * cur_dict[chr(missing_tag)] = value_label_name # <<<<<<<<<<<<<< + * else: + * */ - { /* enter inner scope */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1009, __pyx_L19_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_missing_tag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_data->col_names); - __Pyx_GIVEREF(__pyx_v_data->col_names); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data->col_names); - __Pyx_INCREF(__pyx_v_data->col_labels); - __Pyx_GIVEREF(__pyx_v_data->col_labels); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data->col_labels); - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { - __pyx_t_3 = __pyx_t_7; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1009, __pyx_L19_error) - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1009, __pyx_L19_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1009, __pyx_L19_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_6(__pyx_t_3); - 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, 1009, __pyx_L19_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, 1009, __pyx_L19_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_4 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_12 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1009, __pyx_L19_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_12)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_4)) goto __pyx_L22_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_12); if (unlikely(!__pyx_t_8)) goto __pyx_L22_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1009, __pyx_L19_error) - __pyx_t_9 = NULL; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - goto __pyx_L23_unpacking_done; - __pyx_L22_unpacking_failed:; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_9 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 1009, __pyx_L19_error) - __pyx_L23_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_4); - __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_8); - __pyx_t_8 = 0; - if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_7genexpr__pyx_v_v))) __PYX_ERR(0, 1009, __pyx_L19_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; - goto __pyx_L24_exit_scope; - __pyx_L19_error:; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; - goto __pyx_L1_error; - __pyx_L24_exit_scope:; - } /* exit inner scope */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_column_names_to_labels, __pyx_t_2) < 0) __PYX_ERR(0, 1009, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely((PyObject_SetItem(__pyx_v_cur_dict, __pyx_t_2, __pyx_v_value_label_name) < 0))) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":1010 - * metadata.column_labels = data.col_labels - * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} - * metadata.file_encoding = data.file_encoding # <<<<<<<<<<<<<< - * metadata.file_label = data.file_label - * metadata.variable_value_labels = variable_value_labels + /* "pyreadstat/_readstat_parser.pyx":703 + * cur_dict = dict() + * + * if readstat_value_is_tagged_missing(value): # <<<<<<<<<<<<<< + * # SAS and Stata missing values + * missing_tag = readstat_value_tag(value) */ - __pyx_t_2 = __pyx_v_data->file_encoding; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 1010, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L4; + } - /* "pyreadstat/_readstat_parser.pyx":1011 - * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} - * metadata.file_encoding = data.file_encoding - * metadata.file_label = data.file_label # <<<<<<<<<<<<<< - * metadata.variable_value_labels = variable_value_labels - * metadata.value_labels = labels_raw + /* "pyreadstat/_readstat_parser.pyx":710 + * else: + * + * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< + * c_str_value = readstat_string_value(value) + * py_str_value = c_str_value */ - __pyx_t_2 = __pyx_v_data->file_label; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_label, __pyx_t_2) < 0) __PYX_ERR(0, 1011, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /*else*/ { - /* "pyreadstat/_readstat_parser.pyx":1012 - * metadata.file_encoding = data.file_encoding - * metadata.file_label = data.file_label - * metadata.variable_value_labels = variable_value_labels # <<<<<<<<<<<<<< - * metadata.value_labels = labels_raw - * metadata.variable_to_label = label_to_var_name - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_value_labels, __pyx_v_variable_value_labels) < 0) __PYX_ERR(0, 1012, __pyx_L1_error) + /* "pyreadstat/_readstat_parser.pyx":730 + * py_float_value = c_float_value + * pyformat = VAR_FORMAT_FLOAT + * elif value_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< + * c_double_value = readstat_double_value(value); + * py_float_value = c_double_value + */ + switch (__pyx_v_value_type) { + case READSTAT_TYPE_STRING: - /* "pyreadstat/_readstat_parser.pyx":1013 - * metadata.file_label = data.file_label - * metadata.variable_value_labels = variable_value_labels - * metadata.value_labels = labels_raw # <<<<<<<<<<<<<< - * metadata.variable_to_label = label_to_var_name - * metadata.original_variable_types = original_types + /* "pyreadstat/_readstat_parser.pyx":710 + * else: + * + * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< + * c_str_value = readstat_string_value(value) + * py_str_value = c_str_value */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels, __pyx_v_labels_raw) < 0) __PYX_ERR(0, 1013, __pyx_L1_error) + case READSTAT_TYPE_STRING_REF: - /* "pyreadstat/_readstat_parser.pyx":1014 - * metadata.variable_value_labels = variable_value_labels - * metadata.value_labels = labels_raw - * metadata.variable_to_label = label_to_var_name # <<<<<<<<<<<<<< - * metadata.original_variable_types = original_types - * metadata.readstat_variable_types = readstat_types + /* "pyreadstat/_readstat_parser.pyx":711 + * + * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: + * c_str_value = readstat_string_value(value) # <<<<<<<<<<<<<< + * py_str_value = c_str_value + * pyformat = VAR_FORMAT_STRING */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label, __pyx_v_label_to_var_name) < 0) __PYX_ERR(0, 1014, __pyx_L1_error) + __pyx_v_c_str_value = readstat_string_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":1015 - * metadata.value_labels = labels_raw - * metadata.variable_to_label = label_to_var_name - * metadata.original_variable_types = original_types # <<<<<<<<<<<<<< - * metadata.readstat_variable_types = readstat_types - * metadata.table_name = data.table_name + /* "pyreadstat/_readstat_parser.pyx":712 + * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: + * c_str_value = readstat_string_value(value) + * py_str_value = c_str_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_STRING + * elif value_type == READSTAT_TYPE_INT8: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_original_variable_types, __pyx_v_original_types) < 0) __PYX_ERR(0, 1015, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_c_str_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_py_str_value = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":1016 - * metadata.variable_to_label = label_to_var_name - * metadata.original_variable_types = original_types - * metadata.readstat_variable_types = readstat_types # <<<<<<<<<<<<<< - * metadata.table_name = data.table_name - * metadata.missing_ranges = data.missing_ranges + /* "pyreadstat/_readstat_parser.pyx":713 + * c_str_value = readstat_string_value(value) + * py_str_value = c_str_value + * pyformat = VAR_FORMAT_STRING # <<<<<<<<<<<<<< + * elif value_type == READSTAT_TYPE_INT8: + * c_int8_value = readstat_int8_value(value) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_readstat_variable_types, __pyx_v_readstat_types) < 0) __PYX_ERR(0, 1016, __pyx_L1_error) + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING; - /* "pyreadstat/_readstat_parser.pyx":1017 - * metadata.original_variable_types = original_types - * metadata.readstat_variable_types = readstat_types - * metadata.table_name = data.table_name # <<<<<<<<<<<<<< - * metadata.missing_ranges = data.missing_ranges - * metadata.variable_storage_width = data.variable_storage_width + /* "pyreadstat/_readstat_parser.pyx":710 + * else: + * + * if value_type == READSTAT_TYPE_STRING or value_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< + * c_str_value = readstat_string_value(value) + * py_str_value = c_str_value */ - __pyx_t_2 = __pyx_v_data->table_name; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_table_name, __pyx_t_2) < 0) __PYX_ERR(0, 1017, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + break; + case READSTAT_TYPE_INT8: - /* "pyreadstat/_readstat_parser.pyx":1018 - * metadata.readstat_variable_types = readstat_types - * metadata.table_name = data.table_name - * metadata.missing_ranges = data.missing_ranges # <<<<<<<<<<<<<< - * metadata.variable_storage_width = data.variable_storage_width - * metadata.variable_display_width = data.variable_display_width + /* "pyreadstat/_readstat_parser.pyx":715 + * pyformat = VAR_FORMAT_STRING + * elif value_type == READSTAT_TYPE_INT8: + * c_int8_value = readstat_int8_value(value) # <<<<<<<<<<<<<< + * py_long_value = c_int8_value + * pyformat = VAR_FORMAT_LONG */ - __pyx_t_2 = __pyx_v_data->missing_ranges; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_missing_ranges, __pyx_t_2) < 0) __PYX_ERR(0, 1018, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_c_int8_value = readstat_int8_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":1019 - * metadata.table_name = data.table_name - * metadata.missing_ranges = data.missing_ranges - * metadata.variable_storage_width = data.variable_storage_width # <<<<<<<<<<<<<< - * metadata.variable_display_width = data.variable_display_width - * metadata.variable_alignment = data.variable_alignment + /* "pyreadstat/_readstat_parser.pyx":716 + * elif value_type == READSTAT_TYPE_INT8: + * c_int8_value = readstat_int8_value(value) + * py_long_value = c_int8_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_INT16: */ - __pyx_t_2 = __pyx_v_data->variable_storage_width; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_storage_width, __pyx_t_2) < 0) __PYX_ERR(0, 1019, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_py_long_value = ((long)__pyx_v_c_int8_value); - /* "pyreadstat/_readstat_parser.pyx":1020 - * metadata.missing_ranges = data.missing_ranges - * metadata.variable_storage_width = data.variable_storage_width - * metadata.variable_display_width = data.variable_display_width # <<<<<<<<<<<<<< - * metadata.variable_alignment = data.variable_alignment - * metadata.variable_measure = data.variable_measure + /* "pyreadstat/_readstat_parser.pyx":717 + * c_int8_value = readstat_int8_value(value) + * py_long_value = c_int8_value + * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< + * elif value_type == READSTAT_TYPE_INT16: + * c_int16_value = readstat_int16_value(value) */ - __pyx_t_2 = __pyx_v_data->variable_display_width; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_display_width, __pyx_t_2) < 0) __PYX_ERR(0, 1020, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* "pyreadstat/_readstat_parser.pyx":1021 - * metadata.variable_storage_width = data.variable_storage_width - * metadata.variable_display_width = data.variable_display_width - * metadata.variable_alignment = data.variable_alignment # <<<<<<<<<<<<<< - * metadata.variable_measure = data.variable_measure - * + /* "pyreadstat/_readstat_parser.pyx":714 + * py_str_value = c_str_value + * pyformat = VAR_FORMAT_STRING + * elif value_type == READSTAT_TYPE_INT8: # <<<<<<<<<<<<<< + * c_int8_value = readstat_int8_value(value) + * py_long_value = c_int8_value */ - __pyx_t_2 = __pyx_v_data->variable_alignment; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_alignment, __pyx_t_2) < 0) __PYX_ERR(0, 1021, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + break; + case READSTAT_TYPE_INT16: - /* "pyreadstat/_readstat_parser.pyx":1022 - * metadata.variable_display_width = data.variable_display_width - * metadata.variable_alignment = data.variable_alignment - * metadata.variable_measure = data.variable_measure # <<<<<<<<<<<<<< - * - * return metadata + /* "pyreadstat/_readstat_parser.pyx":719 + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_INT16: + * c_int16_value = readstat_int16_value(value) # <<<<<<<<<<<<<< + * py_long_value = c_int16_value + * pyformat = VAR_FORMAT_LONG */ - __pyx_t_2 = __pyx_v_data->variable_measure; - __Pyx_INCREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_measure, __pyx_t_2) < 0) __PYX_ERR(0, 1022, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_c_int16_value = readstat_int16_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":1024 - * metadata.variable_measure = data.variable_measure - * - * return metadata # <<<<<<<<<<<<<< - * - * + /* "pyreadstat/_readstat_parser.pyx":720 + * elif value_type == READSTAT_TYPE_INT16: + * c_int16_value = readstat_int16_value(value) + * py_long_value = c_int16_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_INT32: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_metadata); - __pyx_r = __pyx_v_metadata; - goto __pyx_L0; + __pyx_v_py_long_value = ((long)__pyx_v_c_int16_value); - /* "pyreadstat/_readstat_parser.pyx":939 - * - * - * cdef object data_container_extract_metadata(data_container data): # <<<<<<<<<<<<<< - * """ - * Extracts metadata from a data container and puts it into a metadata + /* "pyreadstat/_readstat_parser.pyx":721 + * c_int16_value = readstat_int16_value(value) + * py_long_value = c_int16_value + * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< + * elif value_type == READSTAT_TYPE_INT32: + * c_int32_value = readstat_int32_value(value) */ + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* 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_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container_extract_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_label_to_var_name); - __Pyx_XDECREF(__pyx_v_labels_raw); - __Pyx_XDECREF(__pyx_v_var_name); - __Pyx_XDECREF(__pyx_v_var_label); - __Pyx_XDECREF(__pyx_v_current_labels); - __Pyx_XDECREF(__pyx_v_original_types); - __Pyx_XDECREF(__pyx_v_metadata); - __Pyx_XDECREF(__pyx_v_variable_value_labels); - __Pyx_XDECREF(__pyx_v_readstat_types); - __Pyx_XDECREF(__pyx_v_indx); - __Pyx_XDECREF(__pyx_v_cur_col); - __Pyx_XDECREF(__pyx_v_cur_type); - __Pyx_XDECREF(__pyx_v_curset); - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); - __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":718 + * py_long_value = c_int8_value + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_INT16: # <<<<<<<<<<<<<< + * c_int16_value = readstat_int16_value(value) + * py_long_value = c_int16_value + */ + break; + case READSTAT_TYPE_INT32: -/* "pyreadstat/_readstat_parser.pyx":1027 - * - * - * cdef object run_conversion(object filename_path, py_file_format file_format, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), # <<<<<<<<<<<<<< - * str encoding, bint metaonly, bint dates_as_pandas, list usecols, bint usernan, - * bint no_datetime_conversion, long row_limit, long row_offset, str output_format, + /* "pyreadstat/_readstat_parser.pyx":723 + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_INT32: + * c_int32_value = readstat_int32_value(value) # <<<<<<<<<<<<<< + * py_long_value = c_int32_value + * pyformat = VAR_FORMAT_LONG */ + __pyx_v_c_int32_value = readstat_int32_value(__pyx_v_value); -static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_run_conversion(PyObject *__pyx_v_filename_path, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format, readstat_error_t __pyx_v_parse_func(readstat_parser_t *, char const *, void *), PyObject *__pyx_v_encoding, int __pyx_v_metaonly, int __pyx_v_dates_as_pandas, PyObject *__pyx_v_usecols, int __pyx_v_usernan, int __pyx_v_no_datetime_conversion, long __pyx_v_row_limit, long __pyx_v_row_offset, PyObject *__pyx_v_output_format, PyObject *__pyx_v_extra_datetime_formats, PyObject *__pyx_v_extra_date_formats) { - PyObject *__pyx_v_filename_bytes = 0; - char *__pyx_v_filename; - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_data = 0; - PyObject *__pyx_v_origin = 0; - PyObject *__pyx_v_allowed_formats = 0; - PyObject *__pyx_v_data_dict = 0; - PyObject *__pyx_v_data_frame = 0; - CYTHON_UNUSED void *__pyx_v_ctx; - PyObject *__pyx_v_metadata = 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; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __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; - int __pyx_t_15; - char *__pyx_t_16; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("run_conversion", 0); - __Pyx_INCREF(__pyx_v_output_format); + /* "pyreadstat/_readstat_parser.pyx":724 + * elif value_type == READSTAT_TYPE_INT32: + * c_int32_value = readstat_int32_value(value) + * py_long_value = c_int32_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_FLOAT: + */ + __pyx_v_py_long_value = ((long)__pyx_v_c_int32_value); - /* "pyreadstat/_readstat_parser.pyx":1044 - * cdef object data_frame - * - * if hasattr(os, 'fsencode'): # <<<<<<<<<<<<<< - * try: - * filename_bytes = os.fsencode(filename_path) + /* "pyreadstat/_readstat_parser.pyx":725 + * c_int32_value = readstat_int32_value(value) + * py_long_value = c_int32_value + * pyformat = VAR_FORMAT_LONG # <<<<<<<<<<<<<< + * elif value_type == READSTAT_TYPE_FLOAT: + * c_float_value = readstat_float_value(value) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1044, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_HasAttr(__pyx_t_1, __pyx_n_s_fsencode); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1044, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG; - /* "pyreadstat/_readstat_parser.pyx":1045 - * - * if hasattr(os, 'fsencode'): - * try: # <<<<<<<<<<<<<< - * filename_bytes = os.fsencode(filename_path) - * except UnicodeError: + /* "pyreadstat/_readstat_parser.pyx":722 + * py_long_value = c_int16_value + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_INT32: # <<<<<<<<<<<<<< + * c_int32_value = readstat_int32_value(value) + * py_long_value = c_int32_value */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_6); - /*try:*/ { + break; + case READSTAT_TYPE_FLOAT: - /* "pyreadstat/_readstat_parser.pyx":1046 - * if hasattr(os, 'fsencode'): - * try: - * filename_bytes = os.fsencode(filename_path) # <<<<<<<<<<<<<< - * except UnicodeError: - * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) + /* "pyreadstat/_readstat_parser.pyx":727 + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_FLOAT: + * c_float_value = readstat_float_value(value) # <<<<<<<<<<<<<< + * py_float_value = c_float_value + * pyformat = VAR_FORMAT_FLOAT */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1046, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1046, __pyx_L4_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_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_filename_path); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1046, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 1046, __pyx_L4_error) - __pyx_v_filename_bytes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_c_float_value = readstat_float_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":1045 - * - * if hasattr(os, 'fsencode'): - * try: # <<<<<<<<<<<<<< - * filename_bytes = os.fsencode(filename_path) - * except UnicodeError: + /* "pyreadstat/_readstat_parser.pyx":728 + * elif value_type == READSTAT_TYPE_FLOAT: + * c_float_value = readstat_float_value(value) + * py_float_value = c_float_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_FLOAT + * elif value_type == READSTAT_TYPE_DOUBLE: */ - } - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_py_float_value = ((double)__pyx_v_c_float_value); - /* "pyreadstat/_readstat_parser.pyx":1047 - * try: - * filename_bytes = os.fsencode(filename_path) - * except UnicodeError: # <<<<<<<<<<<<<< - * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) - * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") + /* "pyreadstat/_readstat_parser.pyx":729 + * c_float_value = readstat_float_value(value) + * py_float_value = c_float_value + * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< + * elif value_type == READSTAT_TYPE_DOUBLE: + * c_double_value = readstat_double_value(value); */ - __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeError); - if (__pyx_t_9) { - __Pyx_AddTraceback("pyreadstat._readstat_parser.run_conversion", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_7) < 0) __PYX_ERR(0, 1047, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; - /* "pyreadstat/_readstat_parser.pyx":1048 - * filename_bytes = os.fsencode(filename_path) - * except UnicodeError: - * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) # <<<<<<<<<<<<<< - * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") - * else: + /* "pyreadstat/_readstat_parser.pyx":726 + * py_long_value = c_int32_value + * pyformat = VAR_FORMAT_LONG + * elif value_type == READSTAT_TYPE_FLOAT: # <<<<<<<<<<<<<< + * c_float_value = readstat_float_value(value) + * py_float_value = c_float_value */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_warnings); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1048, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_warn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1048, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_sys); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1048, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1048, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_13)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_13); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - __pyx_t_11 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1048, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyString_FormatSafe(__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1048, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_12, function); - } - } - __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_14); - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1048, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + break; + case READSTAT_TYPE_DOUBLE: - /* "pyreadstat/_readstat_parser.pyx":1049 - * except UnicodeError: - * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) - * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") # <<<<<<<<<<<<<< - * else: - * IF PY_MAJOR_VERSION >2: + /* "pyreadstat/_readstat_parser.pyx":731 + * pyformat = VAR_FORMAT_FLOAT + * elif value_type == READSTAT_TYPE_DOUBLE: + * c_double_value = readstat_double_value(value); # <<<<<<<<<<<<<< + * py_float_value = c_double_value + * pyformat = VAR_FORMAT_FLOAT */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_os); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1049, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_fsdecode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1049, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); - } - } - __pyx_t_10 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_12, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_filename_path); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1049, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_10)->tp_name), 0))) __PYX_ERR(0, 1049, __pyx_L6_except_error) - __Pyx_XDECREF_SET(__pyx_v_filename_bytes, ((PyObject*)__pyx_t_10)); - __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L5_exception_handled; - } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + __pyx_v_c_double_value = readstat_double_value(__pyx_v_value); - /* "pyreadstat/_readstat_parser.pyx":1045 - * - * if hasattr(os, 'fsencode'): - * try: # <<<<<<<<<<<<<< - * filename_bytes = os.fsencode(filename_path) - * except UnicodeError: + /* "pyreadstat/_readstat_parser.pyx":732 + * elif value_type == READSTAT_TYPE_DOUBLE: + * c_double_value = readstat_double_value(value); + * py_float_value = c_double_value # <<<<<<<<<<<<<< + * pyformat = VAR_FORMAT_FLOAT + * else: */ - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - goto __pyx_L1_error; - __pyx_L5_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6); - __pyx_L9_try_end:; - } + __pyx_v_py_float_value = ((double)__pyx_v_c_double_value); - /* "pyreadstat/_readstat_parser.pyx":1044 - * cdef object data_frame - * - * if hasattr(os, 'fsencode'): # <<<<<<<<<<<<<< - * try: - * filename_bytes = os.fsencode(filename_path) + /* "pyreadstat/_readstat_parser.pyx":733 + * c_double_value = readstat_double_value(value); + * py_float_value = c_double_value + * pyformat = VAR_FORMAT_FLOAT # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("Unkown data type") */ - goto __pyx_L3; - } + __pyx_v_pyformat = __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT; - /* "pyreadstat/_readstat_parser.pyx":1052 - * else: - * IF PY_MAJOR_VERSION >2: - * if type(filename_path) == str: # <<<<<<<<<<<<<< - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: + /* "pyreadstat/_readstat_parser.pyx":730 + * py_float_value = c_float_value + * pyformat = VAR_FORMAT_FLOAT + * elif value_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< + * c_double_value = readstat_double_value(value); + * py_float_value = c_double_value */ - /*else*/ { - __pyx_t_7 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1052, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1052, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_3) { + break; + default: - /* "pyreadstat/_readstat_parser.pyx":1053 - * IF PY_MAJOR_VERSION >2: - * if type(filename_path) == str: - * filename_bytes = filename_path.encode('utf-8') # <<<<<<<<<<<<<< - * elif type(filename_path) == bytes: - * filename_bytes = filename_path + /* "pyreadstat/_readstat_parser.pyx":735 + * pyformat = VAR_FORMAT_FLOAT + * else: + * raise PyreadstatError("Unkown data type") # <<<<<<<<<<<<<< + * + * */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + 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_8, function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } } - __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1053, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 1053, __pyx_L1_error) - __pyx_v_filename_bytes = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_s_Unkown_data_type}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 735, __pyx_L1_error) + break; + } - /* "pyreadstat/_readstat_parser.pyx":1052 - * else: - * IF PY_MAJOR_VERSION >2: - * if type(filename_path) == str: # <<<<<<<<<<<<<< - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: + /* "pyreadstat/_readstat_parser.pyx":738 + * + * + * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< + * cur_dict[py_str_value] = value_label_name + * elif pyformat == VAR_FORMAT_LONG: */ - goto __pyx_L12; - } + switch (__pyx_v_pyformat) { + case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_STRING: - /* "pyreadstat/_readstat_parser.pyx":1054 - * if type(filename_path) == str: - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< - * filename_bytes = filename_path - * else: + /* "pyreadstat/_readstat_parser.pyx":739 + * + * if pyformat == VAR_FORMAT_STRING: + * cur_dict[py_str_value] = value_label_name # <<<<<<<<<<<<<< + * elif pyformat == VAR_FORMAT_LONG: + * cur_dict[py_long_value] = value_label_name */ - __pyx_t_7 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyBytes_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1054, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1054, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (likely(__pyx_t_3)) { + if (unlikely(!__pyx_v_py_str_value)) { __Pyx_RaiseUnboundLocalError("py_str_value"); __PYX_ERR(0, 739, __pyx_L1_error) } + if (unlikely((PyObject_SetItem(__pyx_v_cur_dict, __pyx_v_py_str_value, __pyx_v_value_label_name) < 0))) __PYX_ERR(0, 739, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1055 - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: - * filename_bytes = filename_path # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("path must be either str or bytes") + /* "pyreadstat/_readstat_parser.pyx":738 + * + * + * if pyformat == VAR_FORMAT_STRING: # <<<<<<<<<<<<<< + * cur_dict[py_str_value] = value_label_name + * elif pyformat == VAR_FORMAT_LONG: */ - if (!(likely(PyBytes_CheckExact(__pyx_v_filename_path))||((__pyx_v_filename_path) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_filename_path)->tp_name), 0))) __PYX_ERR(0, 1055, __pyx_L1_error) - __pyx_t_7 = __pyx_v_filename_path; - __Pyx_INCREF(__pyx_t_7); - __pyx_v_filename_bytes = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; + break; + case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_LONG: - /* "pyreadstat/_readstat_parser.pyx":1054 - * if type(filename_path) == str: - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< - * filename_bytes = filename_path - * else: + /* "pyreadstat/_readstat_parser.pyx":741 + * cur_dict[py_str_value] = value_label_name + * elif pyformat == VAR_FORMAT_LONG: + * cur_dict[py_long_value] = value_label_name # <<<<<<<<<<<<<< + * elif pyformat == VAR_FORMAT_FLOAT: + * cur_dict[py_float_value] = value_label_name */ - goto __pyx_L12; - } + if (unlikely((__Pyx_SetItemInt(__pyx_v_cur_dict, __pyx_v_py_long_value, __pyx_v_value_label_name, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0))) __PYX_ERR(0, 741, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1057 - * filename_bytes = filename_path - * else: - * raise PyreadstatError("path must be either str or bytes") # <<<<<<<<<<<<<< - * ELSE: - * if type(filename_path) not in (str, bytes, unicode): + /* "pyreadstat/_readstat_parser.pyx":740 + * if pyformat == VAR_FORMAT_STRING: + * cur_dict[py_str_value] = value_label_name + * elif pyformat == VAR_FORMAT_LONG: # <<<<<<<<<<<<<< + * cur_dict[py_long_value] = value_label_name + * elif pyformat == VAR_FORMAT_FLOAT: */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1057, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_kp_s_path_must_be_either_str_or_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_path_must_be_either_str_or_bytes); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1057, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 1057, __pyx_L1_error) - } - __pyx_L12:; - } - __pyx_L3:; + break; + case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_FLOAT: - /* "pyreadstat/_readstat_parser.pyx":1064 - * - * - * filename_bytes = os.path.expanduser(filename_bytes) # <<<<<<<<<<<<<< - * if not os.path.isfile(filename_bytes): - * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + /* "pyreadstat/_readstat_parser.pyx":743 + * cur_dict[py_long_value] = value_label_name + * elif pyformat == VAR_FORMAT_FLOAT: + * cur_dict[py_float_value] = value_label_name # <<<<<<<<<<<<<< + * elif pyformat == VAR_FORMAT_MISSING: + * pass */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_v_filename_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_filename_bytes); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_7)->tp_name), 0))) __PYX_ERR(0, 1064, __pyx_L1_error) - __Pyx_DECREF_SET(__pyx_v_filename_bytes, ((PyObject*)__pyx_t_7)); - __pyx_t_7 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_py_float_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_v_cur_dict, __pyx_t_1, __pyx_v_value_label_name) < 0))) __PYX_ERR(0, 743, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":1065 - * - * filename_bytes = os.path.expanduser(filename_bytes) - * if not os.path.isfile(filename_bytes): # <<<<<<<<<<<<<< - * raise PyreadstatError("File {0} does not exist!".format(filename_path)) - * + /* "pyreadstat/_readstat_parser.pyx":742 + * elif pyformat == VAR_FORMAT_LONG: + * cur_dict[py_long_value] = value_label_name + * elif pyformat == VAR_FORMAT_FLOAT: # <<<<<<<<<<<<<< + * cur_dict[py_float_value] = value_label_name + * elif pyformat == VAR_FORMAT_MISSING: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isfile); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_1, __pyx_v_filename_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_filename_bytes); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1065, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_2 = ((!__pyx_t_3) != 0); - if (unlikely(__pyx_t_2)) { + break; + case __pyx_e_10pyreadstat_16_readstat_parser_VAR_FORMAT_MISSING: - /* "pyreadstat/_readstat_parser.pyx":1066 - * filename_bytes = os.path.expanduser(filename_bytes) - * if not os.path.isfile(filename_bytes): - * raise PyreadstatError("File {0} does not exist!".format(filename_path)) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":744 + * elif pyformat == VAR_FORMAT_FLOAT: + * cur_dict[py_float_value] = value_label_name + * elif pyformat == VAR_FORMAT_MISSING: # <<<<<<<<<<<<<< + * pass + * else: + */ + break; + default: + + /* "pyreadstat/_readstat_parser.pyx":747 + * pass + * else: + * raise PyreadstatError("Failed convert C to python value") # <<<<<<<<<<<<<< * - * if output_format is None: + * dc.labels_raw[var_label] = cur_dict */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_File_0_does_not_exist, __pyx_n_s_format); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + 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_4 = 1; + } } - } - __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_14, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_filename_path); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_s_Failed_convert_C_to_python_value}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 747, __pyx_L1_error) + break; } - __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1066, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 1066, __pyx_L1_error) + } + __pyx_L4:; - /* "pyreadstat/_readstat_parser.pyx":1065 + /* "pyreadstat/_readstat_parser.pyx":749 + * raise PyreadstatError("Failed convert C to python value") * - * filename_bytes = os.path.expanduser(filename_bytes) - * if not os.path.isfile(filename_bytes): # <<<<<<<<<<<<<< - * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + * dc.labels_raw[var_label] = cur_dict # <<<<<<<<<<<<<< * + * return READSTAT_HANDLER_OK */ - } + if (unlikely((PyObject_SetItem(__pyx_v_dc->labels_raw, __pyx_v_var_label, __pyx_v_cur_dict) < 0))) __PYX_ERR(0, 749, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1068 - * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + /* "pyreadstat/_readstat_parser.pyx":751 + * dc.labels_raw[var_label] = cur_dict * - * if output_format is None: # <<<<<<<<<<<<<< - * output_format = 'pandas' - * allowed_formats = {'pandas', 'dict'} + * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + * + * cdef int handle_note (int note_index, char *note, void *ctx) except READSTAT_HANDLER_ABORT: */ - __pyx_t_2 = (__pyx_v_output_format == ((PyObject*)Py_None)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_r = READSTAT_HANDLER_OK; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":1069 + /* "pyreadstat/_readstat_parser.pyx":668 * - * if output_format is None: - * output_format = 'pandas' # <<<<<<<<<<<<<< - * allowed_formats = {'pandas', 'dict'} - * if output_format not in allowed_formats: + * + * cdef int handle_value_label(char *val_labels, readstat_value_t value, char *label, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * Reads the label for the value that belongs to the label set val_labels. In Handle variable we need to do a map */ - __Pyx_INCREF(__pyx_n_s_pandas); - __Pyx_DECREF_SET(__pyx_v_output_format, __pyx_n_s_pandas); - /* "pyreadstat/_readstat_parser.pyx":1068 - * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_value_label", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = READSTAT_HANDLER_ABORT; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_dc); + __Pyx_XDECREF(__pyx_v_py_str_value); + __Pyx_XDECREF(__pyx_v_labels_raw); + __Pyx_XDECREF(__pyx_v_var_label); + __Pyx_XDECREF(__pyx_v_value_label_name); + __Pyx_XDECREF(__pyx_v_cur_dict); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyreadstat/_readstat_parser.pyx":753 + * return READSTAT_HANDLER_OK * - * if output_format is None: # <<<<<<<<<<<<<< - * output_format = 'pandas' - * allowed_formats = {'pandas', 'dict'} + * cdef int handle_note (int note_index, char *note, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * Collects notes (text annotations) attached to the documents. It happens for spss and stata */ - } - /* "pyreadstat/_readstat_parser.pyx":1070 - * if output_format is None: - * output_format = 'pandas' - * allowed_formats = {'pandas', 'dict'} # <<<<<<<<<<<<<< - * if output_format not in allowed_formats: - * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) - */ - __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1070, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PySet_Add(__pyx_t_7, __pyx_n_s_pandas) < 0) __PYX_ERR(0, 1070, __pyx_L1_error) - if (PySet_Add(__pyx_t_7, __pyx_n_s_dict) < 0) __PYX_ERR(0, 1070, __pyx_L1_error) - __pyx_v_allowed_formats = ((PyObject*)__pyx_t_7); - __pyx_t_7 = 0; +static int __pyx_f_10pyreadstat_16_readstat_parser_handle_note(CYTHON_UNUSED int __pyx_v_note_index, char *__pyx_v_note, void *__pyx_v_ctx) { + PyObject *__pyx_v_pynote = 0; + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_note", 0); - /* "pyreadstat/_readstat_parser.pyx":1071 - * output_format = 'pandas' - * allowed_formats = {'pandas', 'dict'} - * if output_format not in allowed_formats: # <<<<<<<<<<<<<< - * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + /* "pyreadstat/_readstat_parser.pyx":759 + * + * cdef str pynote + * cdef data_container dc = ctx # <<<<<<<<<<<<<< * + * pynote = note */ - __pyx_t_3 = (__Pyx_PySet_ContainsTF(__pyx_v_output_format, __pyx_v_allowed_formats, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1071, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_3 != 0); - if (unlikely(__pyx_t_2)) { + __pyx_t_1 = ((PyObject *)__pyx_v_ctx); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_dc = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_1); + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_parser.pyx":1072 - * allowed_formats = {'pandas', 'dict'} - * if output_format not in allowed_formats: - * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":761 + * cdef data_container dc = ctx + * + * pynote = note # <<<<<<<<<<<<<< + * dc.notes.append(pynote) * - * if extra_date_formats is not None: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1072, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_output_format_must_be_one_of_all, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1072, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1072, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_allowed_formats, __pyx_v_allowed_formats) < 0) __PYX_ERR(0, 1072, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_output_format, __pyx_v_output_format) < 0) __PYX_ERR(0, 1072, __pyx_L1_error) - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1072, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_14); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1072, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 1072, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyStr_FromString(__pyx_v_note); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_pynote = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_parser.pyx":1071 - * output_format = 'pandas' - * allowed_formats = {'pandas', 'dict'} - * if output_format not in allowed_formats: # <<<<<<<<<<<<<< - * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + /* "pyreadstat/_readstat_parser.pyx":762 + * + * pynote = note + * dc.notes.append(pynote) # <<<<<<<<<<<<<< * + * return READSTAT_HANDLER_OK */ - } + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_dc->notes, __pyx_v_pynote); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 762, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1074 - * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + /* "pyreadstat/_readstat_parser.pyx":764 + * dc.notes.append(pynote) * - * if extra_date_formats is not None: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_SAS: - * sas_date_formats.extend(extra_date_formats) + * return READSTAT_HANDLER_OK # <<<<<<<<<<<<<< + * + * cdef int handle_open(const char *u8_path, void *io_ctx) except READSTAT_HANDLER_ABORT: */ - __pyx_t_2 = (__pyx_v_extra_date_formats != ((PyObject*)Py_None)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_r = READSTAT_HANDLER_OK; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":1075 + /* "pyreadstat/_readstat_parser.pyx":753 + * return READSTAT_HANDLER_OK * - * if extra_date_formats is not None: - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * sas_date_formats.extend(extra_date_formats) - * elif file_format == FILE_FORMAT_SPSS: + * cdef int handle_note (int note_index, char *note, void *ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * Collects notes (text annotations) attached to the documents. It happens for spss and stata */ - switch (__pyx_v_file_format) { - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: - /* "pyreadstat/_readstat_parser.pyx":1076 - * if extra_date_formats is not None: - * if file_format == FILE_FORMAT_SAS: - * sas_date_formats.extend(extra_date_formats) # <<<<<<<<<<<<<< - * elif file_format == FILE_FORMAT_SPSS: - * spss_date_formats.extend(extra_date_formats) - */ - if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); - __PYX_ERR(0, 1076, __pyx_L1_error) - } - __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, __pyx_v_extra_date_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1076, __pyx_L1_error) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyreadstat._readstat_parser.handle_note", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = READSTAT_HANDLER_ABORT; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pynote); + __Pyx_XDECREF((PyObject *)__pyx_v_dc); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":1075 +/* "pyreadstat/_readstat_parser.pyx":766 + * return READSTAT_HANDLER_OK * - * if extra_date_formats is not None: - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * sas_date_formats.extend(extra_date_formats) - * elif file_format == FILE_FORMAT_SPSS: + * cdef int handle_open(const char *u8_path, void *io_ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * Special open handler for windows in order to be able to handle paths with international characters */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: - /* "pyreadstat/_readstat_parser.pyx":1078 - * sas_date_formats.extend(extra_date_formats) - * elif file_format == FILE_FORMAT_SPSS: - * spss_date_formats.extend(extra_date_formats) # <<<<<<<<<<<<<< - * elif file_format == FILE_FORMAT_STATA: - * stata_date_formats.extend(extra_date_formats) - */ - if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); - __PYX_ERR(0, 1078, __pyx_L1_error) - } - __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, __pyx_v_extra_date_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1078, __pyx_L1_error) +static int __pyx_f_10pyreadstat_16_readstat_parser_handle_open(char const *__pyx_v_u8_path, void *__pyx_v_io_ctx) { + int __pyx_v_fd; + Py_ssize_t __pyx_v_length; + wchar_t *__pyx_v_u16_path; + int __pyx_r; + __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; + int __pyx_t_6; + int __pyx_t_7; + wchar_t *__pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("handle_open", 0); - /* "pyreadstat/_readstat_parser.pyx":1077 - * if file_format == FILE_FORMAT_SAS: - * sas_date_formats.extend(extra_date_formats) - * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< - * spss_date_formats.extend(extra_date_formats) - * elif file_format == FILE_FORMAT_STATA: + /* "pyreadstat/_readstat_parser.pyx":774 + * cdef Py_ssize_t length + * + * if not os.path.isfile(u8_path): # <<<<<<<<<<<<<< + * return -1 + * */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyUnicode_FromString(__pyx_v_u8_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 774, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = (!__pyx_t_6); + if (__pyx_t_7) { - /* "pyreadstat/_readstat_parser.pyx":1080 - * spss_date_formats.extend(extra_date_formats) - * elif file_format == FILE_FORMAT_STATA: - * stata_date_formats.extend(extra_date_formats) # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("Unknown file format") + /* "pyreadstat/_readstat_parser.pyx":775 + * + * if not os.path.isfile(u8_path): + * return -1 # <<<<<<<<<<<<<< + * + * if os.name == "nt": */ - if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); - __PYX_ERR(0, 1080, __pyx_L1_error) - } - __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, __pyx_v_extra_date_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1080, __pyx_L1_error) + __pyx_r = -1; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":1079 - * elif file_format == FILE_FORMAT_SPSS: - * spss_date_formats.extend(extra_date_formats) - * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * stata_date_formats.extend(extra_date_formats) - * else: + /* "pyreadstat/_readstat_parser.pyx":774 + * cdef Py_ssize_t length + * + * if not os.path.isfile(u8_path): # <<<<<<<<<<<<<< + * return -1 + * */ - break; - default: + } - /* "pyreadstat/_readstat_parser.pyx":1082 - * stata_date_formats.extend(extra_date_formats) - * else: - * raise PyreadstatError("Unknown file format") # <<<<<<<<<<<<<< - * if extra_datetime_formats is not None: - * if file_format == FILE_FORMAT_SAS: + /* "pyreadstat/_readstat_parser.pyx":777 + * return -1 + * + * if os.name == "nt": # <<<<<<<<<<<<<< + * u16_path = PyUnicode_AsWideCharString(u8_path, &length) + * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1082, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_7 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_14, __pyx_kp_s_Unknown_file_format) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_Unknown_file_format); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1082, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 1082, __pyx_L1_error) - break; - } + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_nt, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 777, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_7) { - /* "pyreadstat/_readstat_parser.pyx":1074 - * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + /* "pyreadstat/_readstat_parser.pyx":778 * - * if extra_date_formats is not None: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_SAS: - * sas_date_formats.extend(extra_date_formats) + * if os.name == "nt": + * u16_path = PyUnicode_AsWideCharString(u8_path, &length) # <<<<<<<<<<<<<< + * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) + * assign_fd(io_ctx, fd) */ - } + __pyx_t_2 = __Pyx_PyUnicode_FromString(__pyx_v_u8_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyUnicode_AsWideCharString(__pyx_t_2, (&__pyx_v_length)); if (unlikely(__pyx_t_8 == ((wchar_t *)NULL))) __PYX_ERR(0, 778, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_u16_path = __pyx_t_8; - /* "pyreadstat/_readstat_parser.pyx":1083 - * else: - * raise PyreadstatError("Unknown file format") - * if extra_datetime_formats is not None: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_SAS: - * sas_datetime_formats.extend(extra_datetime_formats) + /* "pyreadstat/_readstat_parser.pyx":779 + * if os.name == "nt": + * u16_path = PyUnicode_AsWideCharString(u8_path, &length) + * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) # <<<<<<<<<<<<<< + * assign_fd(io_ctx, fd) + * return fd */ - __pyx_t_3 = (__pyx_v_extra_datetime_formats != ((PyObject*)Py_None)); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __pyx_v_fd = _wsopen(__pyx_v_u16_path, (_O_RDONLY | _O_BINARY), _SH_DENYWR, 0); - /* "pyreadstat/_readstat_parser.pyx":1084 - * raise PyreadstatError("Unknown file format") - * if extra_datetime_formats is not None: - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * sas_datetime_formats.extend(extra_datetime_formats) - * elif file_format == FILE_FORMAT_SPSS: + /* "pyreadstat/_readstat_parser.pyx":780 + * u16_path = PyUnicode_AsWideCharString(u8_path, &length) + * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) + * assign_fd(io_ctx, fd) # <<<<<<<<<<<<<< + * return fd + * else: */ - switch (__pyx_v_file_format) { - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: - - /* "pyreadstat/_readstat_parser.pyx":1085 - * if extra_datetime_formats is not None: - * if file_format == FILE_FORMAT_SAS: - * sas_datetime_formats.extend(extra_datetime_formats) # <<<<<<<<<<<<<< - * elif file_format == FILE_FORMAT_SPSS: - * spss_datetime_formats.extend(extra_datetime_formats) - */ - if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); - __PYX_ERR(0, 1085, __pyx_L1_error) - } - __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats, __pyx_v_extra_datetime_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1085, __pyx_L1_error) + assign_fd(__pyx_v_io_ctx, __pyx_v_fd); - /* "pyreadstat/_readstat_parser.pyx":1084 - * raise PyreadstatError("Unknown file format") - * if extra_datetime_formats is not None: - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * sas_datetime_formats.extend(extra_datetime_formats) - * elif file_format == FILE_FORMAT_SPSS: + /* "pyreadstat/_readstat_parser.pyx":781 + * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) + * assign_fd(io_ctx, fd) + * return fd # <<<<<<<<<<<<<< + * else: + * return -1 */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: + __pyx_r = __pyx_v_fd; + goto __pyx_L0; - /* "pyreadstat/_readstat_parser.pyx":1087 - * sas_datetime_formats.extend(extra_datetime_formats) - * elif file_format == FILE_FORMAT_SPSS: - * spss_datetime_formats.extend(extra_datetime_formats) # <<<<<<<<<<<<<< - * elif file_format == FILE_FORMAT_STATA: - * stata_datetime_formats.extend(extra_datetime_formats) + /* "pyreadstat/_readstat_parser.pyx":777 + * return -1 + * + * if os.name == "nt": # <<<<<<<<<<<<<< + * u16_path = PyUnicode_AsWideCharString(u8_path, &length) + * fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) */ - if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); - __PYX_ERR(0, 1087, __pyx_L1_error) - } - __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats, __pyx_v_extra_datetime_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1087, __pyx_L1_error) + } - /* "pyreadstat/_readstat_parser.pyx":1086 - * if file_format == FILE_FORMAT_SAS: - * sas_datetime_formats.extend(extra_datetime_formats) - * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< - * spss_datetime_formats.extend(extra_datetime_formats) - * elif file_format == FILE_FORMAT_STATA: + /* "pyreadstat/_readstat_parser.pyx":783 + * return fd + * else: + * return -1 # <<<<<<<<<<<<<< + * + * */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: + /*else*/ { + __pyx_r = -1; + goto __pyx_L0; + } - /* "pyreadstat/_readstat_parser.pyx":1089 - * spss_datetime_formats.extend(extra_datetime_formats) - * elif file_format == FILE_FORMAT_STATA: - * stata_datetime_formats.extend(extra_datetime_formats) # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("Unknown file format") + /* "pyreadstat/_readstat_parser.pyx":766 + * return READSTAT_HANDLER_OK + * + * cdef int handle_open(const char *u8_path, void *io_ctx) except READSTAT_HANDLER_ABORT: # <<<<<<<<<<<<<< + * """ + * Special open handler for windows in order to be able to handle paths with international characters */ - if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); - __PYX_ERR(0, 1089, __pyx_L1_error) - } - __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats, __pyx_v_extra_datetime_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1089, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1088 - * elif file_format == FILE_FORMAT_SPSS: - * spss_datetime_formats.extend(extra_datetime_formats) - * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * stata_datetime_formats.extend(extra_datetime_formats) - * else: - */ - break; - default: + /* 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_AddTraceback("pyreadstat._readstat_parser.handle_open", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = READSTAT_HANDLER_ABORT; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "pyreadstat/_readstat_parser.pyx":1091 - * stata_datetime_formats.extend(extra_datetime_formats) - * else: - * raise PyreadstatError("Unknown file format") # <<<<<<<<<<<<<< - * global sas_all_formats, spss_all_formats, stata_all_formats - * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats +/* "pyreadstat/_readstat_parser.pyx":786 + * + * + * cdef void check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< + * """ + * transforms a readstat exit status to a python error if status is not READSTAT OK */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1091, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - __pyx_t_7 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_14, __pyx_kp_s_Unknown_file_format) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_Unknown_file_format); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1091, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 1091, __pyx_L1_error) - break; - } - /* "pyreadstat/_readstat_parser.pyx":1083 - * else: - * raise PyreadstatError("Unknown file format") - * if extra_datetime_formats is not None: # <<<<<<<<<<<<<< - * if file_format == FILE_FORMAT_SAS: - * sas_datetime_formats.extend(extra_datetime_formats) - */ - } +static void __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_error_t __pyx_v_retcode) { + char *__pyx_v_err_readstat; + PyObject *__pyx_v_err_message = 0; + __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("check_exit_status", 0); - /* "pyreadstat/_readstat_parser.pyx":1093 - * raise PyreadstatError("Unknown file format") - * global sas_all_formats, spss_all_formats, stata_all_formats - * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats # <<<<<<<<<<<<<< - * stata_all_formats = stata_date_formats + stata_datetime_formats + stata_time_formats - * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats + /* "pyreadstat/_readstat_parser.pyx":793 + * cdef char * err_readstat + * cdef str err_message + * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< + * err_readstat = readstat_error_message(retcode) + * err_message = err_readstat */ - __pyx_t_7 = PyNumber_Add(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, __pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1093, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_v_10pyreadstat_16_readstat_parser_sas_time_formats); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1093, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_all_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_all_formats, ((PyObject*)__pyx_t_8)); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_1 = (__pyx_v_retcode != READSTAT_OK); + if (unlikely(__pyx_t_1)) { - /* "pyreadstat/_readstat_parser.pyx":1094 - * global sas_all_formats, spss_all_formats, stata_all_formats - * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats - * stata_all_formats = stata_date_formats + stata_datetime_formats + stata_time_formats # <<<<<<<<<<<<<< - * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats - * + /* "pyreadstat/_readstat_parser.pyx":794 + * cdef str err_message + * if retcode != READSTAT_OK: + * err_readstat = readstat_error_message(retcode) # <<<<<<<<<<<<<< + * err_message = err_readstat + * raise ReadstatError(err_message) */ - __pyx_t_8 = PyNumber_Add(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, __pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1094, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_v_10pyreadstat_16_readstat_parser_stata_time_formats); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1094, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_all_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_all_formats, ((PyObject*)__pyx_t_7)); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; + __pyx_v_err_readstat = readstat_error_message(__pyx_v_retcode); - /* "pyreadstat/_readstat_parser.pyx":1095 - * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats - * stata_all_formats = stata_date_formats + stata_datetime_formats + stata_time_formats - * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":795 + * if retcode != READSTAT_OK: + * err_readstat = readstat_error_message(retcode) + * err_message = err_readstat # <<<<<<<<<<<<<< + * raise ReadstatError(err_message) * - * filename = filename_bytes */ - __pyx_t_7 = PyNumber_Add(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, __pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1095, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Add(__pyx_t_7, __pyx_v_10pyreadstat_16_readstat_parser_spss_time_formats); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1095, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_all_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_all_formats, ((PyObject*)__pyx_t_8)); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; + __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_err_readstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_err_message = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":1097 - * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats + /* "pyreadstat/_readstat_parser.pyx":796 + * err_readstat = readstat_error_message(retcode) + * err_message = err_readstat + * raise ReadstatError(err_message) # <<<<<<<<<<<<<< * - * filename = filename_bytes # <<<<<<<<<<<<<< * - * data = data_container() */ - if (unlikely(__pyx_v_filename_bytes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 1097, __pyx_L1_error) - } - __pyx_t_16 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename_bytes); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) __PYX_ERR(0, 1097, __pyx_L1_error) - __pyx_v_filename = ((char *)__pyx_t_16); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ReadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_err_message}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 796, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1099 - * filename = filename_bytes - * - * data = data_container() # <<<<<<<<<<<<<< - * ctx = data - * + /* "pyreadstat/_readstat_parser.pyx":793 + * cdef char * err_readstat + * cdef str err_message + * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< + * err_readstat = readstat_error_message(retcode) + * err_message = err_readstat */ - __pyx_t_8 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pyreadstat_16_readstat_parser_data_container)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1099, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_v_data = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_8); - __pyx_t_8 = 0; + } - /* "pyreadstat/_readstat_parser.pyx":1100 + /* "pyreadstat/_readstat_parser.pyx":786 * - * data = data_container() - * ctx = data # <<<<<<<<<<<<<< * - * data.file_format = file_format + * cdef void check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< + * """ + * transforms a readstat exit status to a python error if status is not READSTAT OK */ - __pyx_v_ctx = ((void *)__pyx_v_data); - /* "pyreadstat/_readstat_parser.pyx":1102 - * ctx = data - * - * data.file_format = file_format # <<<<<<<<<<<<<< - * data.metaonly = metaonly - * data.dates_as_pandas = dates_as_pandas - */ - __pyx_v_data->file_format = __pyx_v_file_format; + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("pyreadstat._readstat_parser.check_exit_status", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_err_message); + __Pyx_RefNannyFinishContext(); +} - /* "pyreadstat/_readstat_parser.pyx":1103 +/* "pyreadstat/_readstat_parser.pyx":799 * - * data.file_format = file_format - * data.metaonly = metaonly # <<<<<<<<<<<<<< - * data.dates_as_pandas = dates_as_pandas * + * cdef void run_readstat_parser(char * filename, data_container data, py_file_extension file_extension, long row_limit, long row_offset) except *: # <<<<<<<<<<<<<< + * """ + * Runs the parsing of the file by readstat library */ - __pyx_v_data->metaonly = __pyx_v_metaonly; - /* "pyreadstat/_readstat_parser.pyx":1104 - * data.file_format = file_format - * data.metaonly = metaonly - * data.dates_as_pandas = dates_as_pandas # <<<<<<<<<<<<<< - * - * if encoding: - */ - __pyx_v_data->dates_as_pandas = __pyx_v_dates_as_pandas; +static void __pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser(char *__pyx_v_filename, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_data, __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension, long __pyx_v_row_limit, long __pyx_v_row_offset) { + readstat_parser_t *__pyx_v_parser; + readstat_error_t __pyx_v_error; + readstat_metadata_handler __pyx_v_metadata_handler; + readstat_variable_handler __pyx_v_variable_handler; + readstat_value_handler __pyx_v_value_handler; + readstat_value_label_handler __pyx_v_value_label_handler; + readstat_note_handler __pyx_v_note_handler; + void *__pyx_v_ctx; + PyObject *__pyx_v_pyerr; + int __pyx_v_metaonly; + readstat_open_handler __pyx_v_open_handler; + PyObject *__pyx_v_encoding_bytes = 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; + char *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run_readstat_parser", 0); - /* "pyreadstat/_readstat_parser.pyx":1106 - * data.dates_as_pandas = dates_as_pandas + /* "pyreadstat/_readstat_parser.pyx":819 + * cdef bytes encoding_byte * - * if encoding: # <<<<<<<<<<<<<< - * data.user_encoding = encoding + * metaonly = data.metaonly # <<<<<<<<<<<<<< + * ctx = data * */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1106, __pyx_L1_error) - if (__pyx_t_2) { + __pyx_t_1 = __pyx_v_data->metaonly; + __pyx_v_metaonly = __pyx_t_1; - /* "pyreadstat/_readstat_parser.pyx":1107 + /* "pyreadstat/_readstat_parser.pyx":820 * - * if encoding: - * data.user_encoding = encoding # <<<<<<<<<<<<<< + * metaonly = data.metaonly + * ctx = data # <<<<<<<<<<<<<< * - * if file_format == FILE_FORMAT_SAS: + * #readstat_error_t error = READSTAT_OK; */ - __Pyx_INCREF(__pyx_v_encoding); - __Pyx_GIVEREF(__pyx_v_encoding); - __Pyx_GOTREF(__pyx_v_data->user_encoding); - __Pyx_DECREF(__pyx_v_data->user_encoding); - __pyx_v_data->user_encoding = __pyx_v_encoding; + __pyx_v_ctx = ((void *)__pyx_v_data); - /* "pyreadstat/_readstat_parser.pyx":1106 - * data.dates_as_pandas = dates_as_pandas - * - * if encoding: # <<<<<<<<<<<<<< - * data.user_encoding = encoding + /* "pyreadstat/_readstat_parser.pyx":823 * + * #readstat_error_t error = READSTAT_OK; + * parser = readstat_parser_init() # <<<<<<<<<<<<<< + * metadata_handler = handle_metadata + * variable_handler = handle_variable */ - } + __pyx_v_parser = readstat_parser_init(); - /* "pyreadstat/_readstat_parser.pyx":1109 - * data.user_encoding = encoding - * - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * origin = sas_origin - * elif file_format == FILE_FORMAT_SPSS: + /* "pyreadstat/_readstat_parser.pyx":824 + * #readstat_error_t error = READSTAT_OK; + * parser = readstat_parser_init() + * metadata_handler = handle_metadata # <<<<<<<<<<<<<< + * variable_handler = handle_variable + * value_handler = handle_value */ - switch (__pyx_v_file_format) { - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: + __pyx_v_metadata_handler = ((readstat_metadata_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_metadata); - /* "pyreadstat/_readstat_parser.pyx":1110 - * - * if file_format == FILE_FORMAT_SAS: - * origin = sas_origin # <<<<<<<<<<<<<< - * elif file_format == FILE_FORMAT_SPSS: - * origin = spss_origin + /* "pyreadstat/_readstat_parser.pyx":825 + * parser = readstat_parser_init() + * metadata_handler = handle_metadata + * variable_handler = handle_variable # <<<<<<<<<<<<<< + * value_handler = handle_value + * value_label_handler = handle_value_label */ - __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_origin); - __pyx_v_origin = __pyx_v_10pyreadstat_16_readstat_parser_sas_origin; + __pyx_v_variable_handler = ((readstat_variable_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_variable); - /* "pyreadstat/_readstat_parser.pyx":1109 - * data.user_encoding = encoding - * - * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< - * origin = sas_origin - * elif file_format == FILE_FORMAT_SPSS: + /* "pyreadstat/_readstat_parser.pyx":826 + * metadata_handler = handle_metadata + * variable_handler = handle_variable + * value_handler = handle_value # <<<<<<<<<<<<<< + * value_label_handler = handle_value_label + * note_handler = handle_note */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: + __pyx_v_value_handler = ((readstat_value_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_value); - /* "pyreadstat/_readstat_parser.pyx":1112 - * origin = sas_origin - * elif file_format == FILE_FORMAT_SPSS: - * origin = spss_origin # <<<<<<<<<<<<<< - * elif file_format == FILE_FORMAT_STATA: - * origin = stata_origin + /* "pyreadstat/_readstat_parser.pyx":827 + * variable_handler = handle_variable + * value_handler = handle_value + * value_label_handler = handle_value_label # <<<<<<<<<<<<<< + * note_handler = handle_note + * */ - __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_origin); - __pyx_v_origin = __pyx_v_10pyreadstat_16_readstat_parser_spss_origin; + __pyx_v_value_label_handler = ((readstat_value_label_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_value_label); - /* "pyreadstat/_readstat_parser.pyx":1111 - * if file_format == FILE_FORMAT_SAS: - * origin = sas_origin - * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< - * origin = spss_origin - * elif file_format == FILE_FORMAT_STATA: + /* "pyreadstat/_readstat_parser.pyx":828 + * value_handler = handle_value + * value_label_handler = handle_value_label + * note_handler = handle_note # <<<<<<<<<<<<<< + * + * */ - break; - case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: + __pyx_v_note_handler = ((readstat_note_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_note); - /* "pyreadstat/_readstat_parser.pyx":1114 - * origin = spss_origin - * elif file_format == FILE_FORMAT_STATA: - * origin = stata_origin # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("Unknown file format") + /* "pyreadstat/_readstat_parser.pyx":831 + * + * + * check_exit_status(readstat_set_metadata_handler(parser, metadata_handler)) # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) + * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) */ - __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_origin); - __pyx_v_origin = __pyx_v_10pyreadstat_16_readstat_parser_stata_origin; + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_metadata_handler(__pyx_v_parser, __pyx_v_metadata_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 831, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1113 - * elif file_format == FILE_FORMAT_SPSS: - * origin = spss_origin - * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< - * origin = stata_origin - * else: + /* "pyreadstat/_readstat_parser.pyx":832 + * + * check_exit_status(readstat_set_metadata_handler(parser, metadata_handler)) + * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) + * check_exit_status(readstat_set_note_handler(parser, note_handler)) */ - break; - default: + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_variable_handler(__pyx_v_parser, __pyx_v_variable_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 832, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1116 - * origin = stata_origin - * else: - * raise PyreadstatError("Unknown file format") # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":833 + * check_exit_status(readstat_set_metadata_handler(parser, metadata_handler)) + * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) + * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_note_handler(parser, note_handler)) * - * data.origin = origin */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_14 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - __pyx_t_8 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_14, __pyx_kp_s_Unknown_file_format) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_Unknown_file_format); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 1116, __pyx_L1_error) - break; - } + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_value_label_handler(__pyx_v_parser, __pyx_v_value_label_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 833, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1118 - * raise PyreadstatError("Unknown file format") - * - * data.origin = origin # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":834 + * check_exit_status(readstat_set_variable_handler(parser, variable_handler)) + * check_exit_status(readstat_set_value_label_handler(parser, value_label_handler)) + * check_exit_status(readstat_set_note_handler(parser, note_handler)) # <<<<<<<<<<<<<< * - * if usecols is not None: + * # on windows we need a custom open handler in order to deal with internation characters in the path. */ - __Pyx_INCREF(__pyx_v_origin); - __Pyx_GIVEREF(__pyx_v_origin); - __Pyx_GOTREF(__pyx_v_data->origin); - __Pyx_DECREF(__pyx_v_data->origin); - __pyx_v_data->origin = __pyx_v_origin; + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_note_handler(__pyx_v_parser, __pyx_v_note_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 834, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1120 - * data.origin = origin + /* "pyreadstat/_readstat_parser.pyx":837 * - * if usecols is not None: # <<<<<<<<<<<<<< - * data.filter_cols = 1 - * data.use_cols = usecols + * # on windows we need a custom open handler in order to deal with internation characters in the path. + * if os.name == "nt": # <<<<<<<<<<<<<< + * open_handler = handle_open + * readstat_set_open_handler(parser, open_handler) */ - __pyx_t_2 = (__pyx_v_usecols != ((PyObject*)Py_None)); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_nt, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 837, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":1121 - * - * if usecols is not None: - * data.filter_cols = 1 # <<<<<<<<<<<<<< - * data.use_cols = usecols + /* "pyreadstat/_readstat_parser.pyx":838 + * # on windows we need a custom open handler in order to deal with internation characters in the path. + * if os.name == "nt": + * open_handler = handle_open # <<<<<<<<<<<<<< + * readstat_set_open_handler(parser, open_handler) * */ - __pyx_v_data->filter_cols = 1; + __pyx_v_open_handler = ((readstat_open_handler)__pyx_f_10pyreadstat_16_readstat_parser_handle_open); - /* "pyreadstat/_readstat_parser.pyx":1122 - * if usecols is not None: - * data.filter_cols = 1 - * data.use_cols = usecols # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":839 + * if os.name == "nt": + * open_handler = handle_open + * readstat_set_open_handler(parser, open_handler) # <<<<<<<<<<<<<< * - * data.usernan = usernan + * if not metaonly: */ - __Pyx_INCREF(__pyx_v_usecols); - __Pyx_GIVEREF(__pyx_v_usecols); - __Pyx_GOTREF(__pyx_v_data->use_cols); - __Pyx_DECREF(__pyx_v_data->use_cols); - __pyx_v_data->use_cols = __pyx_v_usecols; + (void)(readstat_set_open_handler(__pyx_v_parser, __pyx_v_open_handler)); - /* "pyreadstat/_readstat_parser.pyx":1120 - * data.origin = origin + /* "pyreadstat/_readstat_parser.pyx":837 * - * if usecols is not None: # <<<<<<<<<<<<<< - * data.filter_cols = 1 - * data.use_cols = usecols + * # on windows we need a custom open handler in order to deal with internation characters in the path. + * if os.name == "nt": # <<<<<<<<<<<<<< + * open_handler = handle_open + * readstat_set_open_handler(parser, open_handler) */ } - /* "pyreadstat/_readstat_parser.pyx":1124 - * data.use_cols = usecols + /* "pyreadstat/_readstat_parser.pyx":841 + * readstat_set_open_handler(parser, open_handler) * - * data.usernan = usernan # <<<<<<<<<<<<<< - * data.no_datetime_conversion = no_datetime_conversion + * if not metaonly: # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_value_handler(parser, value_handler)) * */ - __pyx_v_data->usernan = __pyx_v_usernan; + __pyx_t_1 = (!__pyx_v_metaonly); + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":1125 + /* "pyreadstat/_readstat_parser.pyx":842 * - * data.usernan = usernan - * data.no_datetime_conversion = no_datetime_conversion # <<<<<<<<<<<<<< + * if not metaonly: + * check_exit_status(readstat_set_value_handler(parser, value_handler)) # <<<<<<<<<<<<<< * - * # go! + * # if the user set the encoding manually */ - __pyx_v_data->no_datetime_conversion = __pyx_v_no_datetime_conversion; + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_value_handler(__pyx_v_parser, __pyx_v_value_handler)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1128 + /* "pyreadstat/_readstat_parser.pyx":841 + * readstat_set_open_handler(parser, open_handler) + * + * if not metaonly: # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_value_handler(parser, value_handler)) * - * # go! - * run_readstat_parser(filename, data, parse_func, row_limit, row_offset) # <<<<<<<<<<<<<< - * data_dict = data_container_to_dict(data) - * if output_format == 'dict': */ - __pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser(__pyx_v_filename, __pyx_v_data, __pyx_v_parse_func, __pyx_v_row_limit, __pyx_v_row_offset); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1128, __pyx_L1_error) + } - /* "pyreadstat/_readstat_parser.pyx":1129 - * # go! - * run_readstat_parser(filename, data, parse_func, row_limit, row_offset) - * data_dict = data_container_to_dict(data) # <<<<<<<<<<<<<< - * if output_format == 'dict': - * data_frame = data_dict + /* "pyreadstat/_readstat_parser.pyx":845 + * + * # if the user set the encoding manually + * if data.user_encoding: # <<<<<<<<<<<<<< + * encoding_bytes = data.user_encoding.encode("utf-8") + * readstat_set_file_character_encoding(parser, encoding_bytes) */ - __pyx_t_8 = __pyx_f_10pyreadstat_16_readstat_parser_data_container_to_dict(__pyx_v_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_v_data_dict = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_data->user_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 845, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":1130 - * run_readstat_parser(filename, data, parse_func, row_limit, row_offset) - * data_dict = data_container_to_dict(data) - * if output_format == 'dict': # <<<<<<<<<<<<<< - * data_frame = data_dict - * elif output_format == 'pandas': + /* "pyreadstat/_readstat_parser.pyx":846 + * # if the user set the encoding manually + * if data.user_encoding: + * encoding_bytes = data.user_encoding.encode("utf-8") # <<<<<<<<<<<<<< + * readstat_set_file_character_encoding(parser, encoding_bytes) + * */ - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_output_format, __pyx_n_s_dict, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1130, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_data->user_encoding, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 846, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_s_utf_8}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_v_encoding_bytes = __pyx_t_3; + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_parser.pyx":1131 - * data_dict = data_container_to_dict(data) - * if output_format == 'dict': - * data_frame = data_dict # <<<<<<<<<<<<<< - * elif output_format == 'pandas': - * data_frame = dict_to_pandas_dataframe(data_dict, data) + /* "pyreadstat/_readstat_parser.pyx":847 + * if data.user_encoding: + * encoding_bytes = data.user_encoding.encode("utf-8") + * readstat_set_file_character_encoding(parser, encoding_bytes) # <<<<<<<<<<<<<< + * + * if row_limit: */ - __Pyx_INCREF(__pyx_v_data_dict); - __pyx_v_data_frame = __pyx_v_data_dict; + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_encoding_bytes); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 847, __pyx_L1_error) + (void)(readstat_set_file_character_encoding(__pyx_v_parser, ((char *)__pyx_t_6))); - /* "pyreadstat/_readstat_parser.pyx":1130 - * run_readstat_parser(filename, data, parse_func, row_limit, row_offset) - * data_dict = data_container_to_dict(data) - * if output_format == 'dict': # <<<<<<<<<<<<<< - * data_frame = data_dict - * elif output_format == 'pandas': + /* "pyreadstat/_readstat_parser.pyx":845 + * + * # if the user set the encoding manually + * if data.user_encoding: # <<<<<<<<<<<<<< + * encoding_bytes = data.user_encoding.encode("utf-8") + * readstat_set_file_character_encoding(parser, encoding_bytes) */ - goto __pyx_L20; } - /* "pyreadstat/_readstat_parser.pyx":1132 - * if output_format == 'dict': - * data_frame = data_dict - * elif output_format == 'pandas': # <<<<<<<<<<<<<< - * data_frame = dict_to_pandas_dataframe(data_dict, data) - * metadata = data_container_extract_metadata(data) + /* "pyreadstat/_readstat_parser.pyx":849 + * readstat_set_file_character_encoding(parser, encoding_bytes) + * + * if row_limit: # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_row_limit(parser, row_limit)) + * */ - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_output_format, __pyx_n_s_pandas, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1132, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_1 = (__pyx_v_row_limit != 0); + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":1133 - * data_frame = data_dict - * elif output_format == 'pandas': - * data_frame = dict_to_pandas_dataframe(data_dict, data) # <<<<<<<<<<<<<< - * metadata = data_container_extract_metadata(data) + /* "pyreadstat/_readstat_parser.pyx":850 + * + * if row_limit: + * check_exit_status(readstat_set_row_limit(parser, row_limit)) # <<<<<<<<<<<<<< * + * if row_offset: */ - __pyx_t_8 = __pyx_f_10pyreadstat_16_readstat_parser_dict_to_pandas_dataframe(__pyx_v_data_dict, __pyx_v_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_v_data_frame = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_row_limit(__pyx_v_parser, __pyx_v_row_limit)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1132 - * if output_format == 'dict': - * data_frame = data_dict - * elif output_format == 'pandas': # <<<<<<<<<<<<<< - * data_frame = dict_to_pandas_dataframe(data_dict, data) - * metadata = data_container_extract_metadata(data) + /* "pyreadstat/_readstat_parser.pyx":849 + * readstat_set_file_character_encoding(parser, encoding_bytes) + * + * if row_limit: # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_row_limit(parser, row_limit)) + * */ } - __pyx_L20:; - /* "pyreadstat/_readstat_parser.pyx":1134 - * elif output_format == 'pandas': - * data_frame = dict_to_pandas_dataframe(data_dict, data) - * metadata = data_container_extract_metadata(data) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":852 + * check_exit_status(readstat_set_row_limit(parser, row_limit)) + * + * if row_offset: # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_row_offset(parser, row_offset)) * - * return data_frame, metadata */ - __pyx_t_8 = __pyx_f_10pyreadstat_16_readstat_parser_data_container_extract_metadata(__pyx_v_data); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_v_metadata = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_1 = (__pyx_v_row_offset != 0); + if (__pyx_t_1) { - /* "pyreadstat/_readstat_parser.pyx":1136 - * metadata = data_container_extract_metadata(data) + /* "pyreadstat/_readstat_parser.pyx":853 * - * return data_frame, metadata # <<<<<<<<<<<<<< + * if row_offset: + * check_exit_status(readstat_set_row_offset(parser, row_offset)) # <<<<<<<<<<<<<< * + * # parse! */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_data_frame)) { __Pyx_RaiseUnboundLocalError("data_frame"); __PYX_ERR(0, 1136, __pyx_L1_error) } - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_data_frame); - __Pyx_GIVEREF(__pyx_v_data_frame); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_data_frame); - __Pyx_INCREF(__pyx_v_metadata); - __Pyx_GIVEREF(__pyx_v_metadata); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_metadata); - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; - goto __pyx_L0; + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_row_offset(__pyx_v_parser, __pyx_v_row_offset)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 853, __pyx_L1_error) - /* "pyreadstat/_readstat_parser.pyx":1027 + /* "pyreadstat/_readstat_parser.pyx":852 + * check_exit_status(readstat_set_row_limit(parser, row_limit)) * + * if row_offset: # <<<<<<<<<<<<<< + * check_exit_status(readstat_set_row_offset(parser, row_offset)) * - * cdef object run_conversion(object filename_path, py_file_format file_format, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), # <<<<<<<<<<<<<< - * str encoding, bint metaonly, bint dates_as_pandas, list usecols, bint usernan, - * bint no_datetime_conversion, long row_limit, long row_offset, str output_format, */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("pyreadstat._readstat_parser.run_conversion", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_filename_bytes); - __Pyx_XDECREF((PyObject *)__pyx_v_data); - __Pyx_XDECREF(__pyx_v_origin); - __Pyx_XDECREF(__pyx_v_allowed_formats); - __Pyx_XDECREF(__pyx_v_data_dict); - __Pyx_XDECREF(__pyx_v_data_frame); - __Pyx_XDECREF(__pyx_v_metadata); - __Pyx_XDECREF(__pyx_v_output_format); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":104 - * # Datetime C API initialization function. - * # You have to call it before any usage of DateTime CAPI functions. - * cdef inline void import_datetime(): # <<<<<<<<<<<<<< - * PyDateTime_IMPORT + /* "pyreadstat/_readstat_parser.pyx":856 * + * # parse! + * if file_extension == FILE_EXT_SAV: # <<<<<<<<<<<<<< + * error = readstat_parse_sav(parser, filename, ctx); + * elif file_extension == FILE_EXT_SAS7BDAT: */ + switch (__pyx_v_file_extension) { + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAV: -static CYTHON_INLINE void __pyx_f_7cpython_8datetime_import_datetime(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("import_datetime", 0); - - /* "cpython/datetime.pxd":105 - * # You have to call it before any usage of DateTime CAPI functions. - * cdef inline void import_datetime(): - * PyDateTime_IMPORT # <<<<<<<<<<<<<< - * - * # Create date object using DateTime CAPI factory function. + /* "pyreadstat/_readstat_parser.pyx":857 + * # parse! + * if file_extension == FILE_EXT_SAV: + * error = readstat_parse_sav(parser, filename, ctx); # <<<<<<<<<<<<<< + * elif file_extension == FILE_EXT_SAS7BDAT: + * error = readstat_parse_sas7bdat(parser, filename, ctx); */ - (void)(PyDateTime_IMPORT); + __pyx_v_error = readstat_parse_sav(__pyx_v_parser, __pyx_v_filename, __pyx_v_ctx); - /* "cpython/datetime.pxd":104 - * # Datetime C API initialization function. - * # You have to call it before any usage of DateTime CAPI functions. - * cdef inline void import_datetime(): # <<<<<<<<<<<<<< - * PyDateTime_IMPORT + /* "pyreadstat/_readstat_parser.pyx":856 * + * # parse! + * if file_extension == FILE_EXT_SAV: # <<<<<<<<<<<<<< + * error = readstat_parse_sav(parser, filename, ctx); + * elif file_extension == FILE_EXT_SAS7BDAT: */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BDAT: - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* "cpython/datetime.pxd":109 - * # Create date object using DateTime CAPI factory function. - * # Note, there are no range checks for any of the arguments. - * cdef inline object date_new(int year, int month, int day): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType) - * + /* "pyreadstat/_readstat_parser.pyx":859 + * error = readstat_parse_sav(parser, filename, ctx); + * elif file_extension == FILE_EXT_SAS7BDAT: + * error = readstat_parse_sas7bdat(parser, filename, ctx); # <<<<<<<<<<<<<< + * elif file_extension == FILE_EXT_DTA: + * error = readstat_parse_dta(parser, filename, ctx); */ + __pyx_v_error = readstat_parse_sas7bdat(__pyx_v_parser, __pyx_v_filename, __pyx_v_ctx); -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_date_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day) { - 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("date_new", 0); + /* "pyreadstat/_readstat_parser.pyx":858 + * if file_extension == FILE_EXT_SAV: + * error = readstat_parse_sav(parser, filename, ctx); + * elif file_extension == FILE_EXT_SAS7BDAT: # <<<<<<<<<<<<<< + * error = readstat_parse_sas7bdat(parser, filename, ctx); + * elif file_extension == FILE_EXT_DTA: + */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_DTA: - /* "cpython/datetime.pxd":110 - * # Note, there are no range checks for any of the arguments. - * cdef inline object date_new(int year, int month, int day): - * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType) # <<<<<<<<<<<<<< - * - * # Create time object using DateTime CAPI factory function + /* "pyreadstat/_readstat_parser.pyx":861 + * error = readstat_parse_sas7bdat(parser, filename, ctx); + * elif file_extension == FILE_EXT_DTA: + * error = readstat_parse_dta(parser, filename, ctx); # <<<<<<<<<<<<<< + * elif file_extension == FILE_EXT_XPORT: + * error = readstat_parse_xport(parser, filename, ctx); */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDateTimeAPI->Date_FromDate(__pyx_v_year, __pyx_v_month, __pyx_v_day, PyDateTimeAPI->DateType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_v_error = readstat_parse_dta(__pyx_v_parser, __pyx_v_filename, __pyx_v_ctx); - /* "cpython/datetime.pxd":109 - * # Create date object using DateTime CAPI factory function. - * # Note, there are no range checks for any of the arguments. - * cdef inline object date_new(int year, int month, int day): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.Date_FromDate(year, month, day, PyDateTimeAPI.DateType) - * + /* "pyreadstat/_readstat_parser.pyx":860 + * elif file_extension == FILE_EXT_SAS7BDAT: + * error = readstat_parse_sas7bdat(parser, filename, ctx); + * elif file_extension == FILE_EXT_DTA: # <<<<<<<<<<<<<< + * error = readstat_parse_dta(parser, filename, ctx); + * elif file_extension == FILE_EXT_XPORT: */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_XPORT: - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cpython.datetime.date_new", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":863 + * error = readstat_parse_dta(parser, filename, ctx); + * elif file_extension == FILE_EXT_XPORT: + * error = readstat_parse_xport(parser, filename, ctx); # <<<<<<<<<<<<<< + * elif file_extension == FILE_EXT_POR: + * error = readstat_parse_por(parser, filename, ctx); + */ + __pyx_v_error = readstat_parse_xport(__pyx_v_parser, __pyx_v_filename, __pyx_v_ctx); -/* "cpython/datetime.pxd":114 - * # Create time object using DateTime CAPI factory function - * # Note, there are no range checks for any of the arguments. - * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType) - * + /* "pyreadstat/_readstat_parser.pyx":862 + * elif file_extension == FILE_EXT_DTA: + * error = readstat_parse_dta(parser, filename, ctx); + * elif file_extension == FILE_EXT_XPORT: # <<<<<<<<<<<<<< + * error = readstat_parse_xport(parser, filename, ctx); + * elif file_extension == FILE_EXT_POR: */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_POR: -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_time_new(int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz) { - 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("time_new", 0); + /* "pyreadstat/_readstat_parser.pyx":865 + * error = readstat_parse_xport(parser, filename, ctx); + * elif file_extension == FILE_EXT_POR: + * error = readstat_parse_por(parser, filename, ctx); # <<<<<<<<<<<<<< + * elif file_extension == FILE_EXT_SAS7BCAT: + * error = readstat_parse_sas7bcat(parser, filename, ctx); + */ + __pyx_v_error = readstat_parse_por(__pyx_v_parser, __pyx_v_filename, __pyx_v_ctx); - /* "cpython/datetime.pxd":115 - * # Note, there are no range checks for any of the arguments. - * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz): - * return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType) # <<<<<<<<<<<<<< - * - * # Create datetime object using DateTime CAPI factory function. + /* "pyreadstat/_readstat_parser.pyx":864 + * elif file_extension == FILE_EXT_XPORT: + * error = readstat_parse_xport(parser, filename, ctx); + * elif file_extension == FILE_EXT_POR: # <<<<<<<<<<<<<< + * error = readstat_parse_por(parser, filename, ctx); + * elif file_extension == FILE_EXT_SAS7BCAT: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDateTimeAPI->Time_FromTime(__pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, PyDateTimeAPI->TimeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BCAT: - /* "cpython/datetime.pxd":114 - * # Create time object using DateTime CAPI factory function - * # Note, there are no range checks for any of the arguments. - * cdef inline object time_new(int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.Time_FromTime(hour, minute, second, microsecond, tz, PyDateTimeAPI.TimeType) - * + /* "pyreadstat/_readstat_parser.pyx":867 + * error = readstat_parse_por(parser, filename, ctx); + * elif file_extension == FILE_EXT_SAS7BCAT: + * error = readstat_parse_sas7bcat(parser, filename, ctx); # <<<<<<<<<<<<<< + * #error = parse_func(parser, filename, ctx); + * readstat_parser_free(parser) */ + __pyx_v_error = readstat_parse_sas7bcat(__pyx_v_parser, __pyx_v_filename, __pyx_v_ctx); - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cpython.datetime.time_new", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":866 + * elif file_extension == FILE_EXT_POR: + * error = readstat_parse_por(parser, filename, ctx); + * elif file_extension == FILE_EXT_SAS7BCAT: # <<<<<<<<<<<<<< + * error = readstat_parse_sas7bcat(parser, filename, ctx); + * #error = parse_func(parser, filename, ctx); + */ + break; + default: break; + } -/* "cpython/datetime.pxd":119 - * # Create datetime object using DateTime CAPI factory function. - * # Note, there are no range checks for any of the arguments. - * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType) + /* "pyreadstat/_readstat_parser.pyx":869 + * error = readstat_parse_sas7bcat(parser, filename, ctx); + * #error = parse_func(parser, filename, ctx); + * readstat_parser_free(parser) # <<<<<<<<<<<<<< + * # check if a python error ocurred, if yes, it will be printed by the interpreter, + * # if not, make sure that the return from parse_func is OK, if not print + */ + readstat_parser_free(__pyx_v_parser); + + /* "pyreadstat/_readstat_parser.pyx":872 + * # check if a python error ocurred, if yes, it will be printed by the interpreter, + * # if not, make sure that the return from parse_func is OK, if not print + * pyerr = PyErr_Occurred() # <<<<<<<<<<<<<< + * if pyerr == NULL: + * check_exit_status(error) + */ + __pyx_v_pyerr = PyErr_Occurred(); + + /* "pyreadstat/_readstat_parser.pyx":873 + * # if not, make sure that the return from parse_func is OK, if not print + * pyerr = PyErr_Occurred() + * if pyerr == NULL: # <<<<<<<<<<<<<< + * check_exit_status(error) * */ + __pyx_t_1 = (((void *)__pyx_v_pyerr) == NULL); + if (__pyx_t_1) { -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_new(int __pyx_v_year, int __pyx_v_month, int __pyx_v_day, int __pyx_v_hour, int __pyx_v_minute, int __pyx_v_second, int __pyx_v_microsecond, PyObject *__pyx_v_tz) { - 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("datetime_new", 0); + /* "pyreadstat/_readstat_parser.pyx":874 + * pyerr = PyErr_Occurred() + * if pyerr == NULL: + * check_exit_status(error) # <<<<<<<<<<<<<< + * + * + */ + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(__pyx_v_error); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 874, __pyx_L1_error) - /* "cpython/datetime.pxd":120 - * # Note, there are no range checks for any of the arguments. - * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz): - * return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":873 + * # if not, make sure that the return from parse_func is OK, if not print + * pyerr = PyErr_Occurred() + * if pyerr == NULL: # <<<<<<<<<<<<<< + * check_exit_status(error) * - * # Create timedelta object using DateTime CAPI factory function. */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDateTimeAPI->DateTime_FromDateAndTime(__pyx_v_year, __pyx_v_month, __pyx_v_day, __pyx_v_hour, __pyx_v_minute, __pyx_v_second, __pyx_v_microsecond, __pyx_v_tz, PyDateTimeAPI->DateTimeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + } - /* "cpython/datetime.pxd":119 - * # Create datetime object using DateTime CAPI factory function. - * # Note, there are no range checks for any of the arguments. - * cdef inline object datetime_new(int year, int month, int day, int hour, int minute, int second, int microsecond, object tz): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.DateTime_FromDateAndTime(year, month, day, hour, minute, second, microsecond, tz, PyDateTimeAPI.DateTimeType) + /* "pyreadstat/_readstat_parser.pyx":799 * + * + * cdef void run_readstat_parser(char * filename, data_container data, py_file_extension file_extension, long row_limit, long row_offset) except *: # <<<<<<<<<<<<<< + * """ + * Runs the parsing of the file by readstat library */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cpython.datetime.datetime_new", __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("pyreadstat._readstat_parser.run_readstat_parser", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_encoding_bytes); __Pyx_RefNannyFinishContext(); - return __pyx_r; } -/* "cpython/datetime.pxd":124 - * # Create timedelta object using DateTime CAPI factory function. - * # Note, there are no range checks for any of the arguments. - * cdef inline object timedelta_new(int days, int seconds, int useconds): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType) +/* "pyreadstat/_readstat_parser.pyx":877 + * * + * cdef object data_container_to_dict(data_container data): # <<<<<<<<<<<<<< + * """ + * Transforms a data container object to a pandas data frame */ -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_timedelta_new(int __pyx_v_days, int __pyx_v_seconds, int __pyx_v_useconds) { +static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_data_container_to_dict(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_data) { + PyObject *__pyx_v_final_container = 0; + PyObject *__pyx_v_col_data = 0; + PyObject *__pyx_v_col_names = 0; + PyObject *__pyx_v_cur_name_str = 0; + int __pyx_v_fc_cnt; + int __pyx_v_is_unkown_number_rows; + int __pyx_v_max_n_obs; + int __pyx_v_metaonly; + PyObject *__pyx_v_cur_data = 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; + Py_ssize_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("timedelta_new", 0); + __Pyx_RefNannySetupContext("data_container_to_dict", 0); - /* "cpython/datetime.pxd":125 - * # Note, there are no range checks for any of the arguments. - * cdef inline object timedelta_new(int days, int seconds, int useconds): - * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":891 + * cdef bint metaonly * - * # More recognizable getters for date/time/datetime/timedelta. + * final_container = OrderedDict() # <<<<<<<<<<<<<< + * col_data = data.col_data + * col_names = data.col_names */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDateTimeAPI->Delta_FromDelta(__pyx_v_days, __pyx_v_seconds, __pyx_v_useconds, 1, PyDateTimeAPI->DeltaType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + 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_4 = 1; + } + } + { + PyObject *__pyx_callargs[1] = {__pyx_t_3, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 891, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_v_final_container = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L0; - /* "cpython/datetime.pxd":124 - * # Create timedelta object using DateTime CAPI factory function. - * # Note, there are no range checks for any of the arguments. - * cdef inline object timedelta_new(int days, int seconds, int useconds): # <<<<<<<<<<<<<< - * return PyDateTimeAPI.Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI.DeltaType) + /* "pyreadstat/_readstat_parser.pyx":892 * + * final_container = OrderedDict() + * col_data = data.col_data # <<<<<<<<<<<<<< + * col_names = data.col_names + * is_unkown_number_rows = data.is_unkown_number_rows */ + __pyx_t_1 = __pyx_v_data->col_data; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_col_data = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("cpython.datetime.timedelta_new", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":133 - * - * # Get tzinfo of time - * cdef inline object time_tzinfo(object o): # <<<<<<<<<<<<<< - * if (o).hastzinfo: - * return (o).tzinfo + /* "pyreadstat/_readstat_parser.pyx":893 + * final_container = OrderedDict() + * col_data = data.col_data + * col_names = data.col_names # <<<<<<<<<<<<<< + * is_unkown_number_rows = data.is_unkown_number_rows + * max_n_obs = data.max_n_obs */ + __pyx_t_1 = __pyx_v_data->col_names; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_col_names = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_time_tzinfo(PyObject *__pyx_v_o) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("time_tzinfo", 0); - - /* "cpython/datetime.pxd":134 - * # Get tzinfo of time - * cdef inline object time_tzinfo(object o): - * if (o).hastzinfo: # <<<<<<<<<<<<<< - * return (o).tzinfo - * else: + /* "pyreadstat/_readstat_parser.pyx":894 + * col_data = data.col_data + * col_names = data.col_names + * is_unkown_number_rows = data.is_unkown_number_rows # <<<<<<<<<<<<<< + * max_n_obs = data.max_n_obs + * metaonly = data.metaonly */ - __pyx_t_1 = (((PyDateTime_Time *)__pyx_v_o)->hastzinfo != 0); - if (__pyx_t_1) { + __pyx_t_5 = __pyx_v_data->is_unkown_number_rows; + __pyx_v_is_unkown_number_rows = __pyx_t_5; - /* "cpython/datetime.pxd":135 - * cdef inline object time_tzinfo(object o): - * if (o).hastzinfo: - * return (o).tzinfo # <<<<<<<<<<<<<< - * else: - * return None + /* "pyreadstat/_readstat_parser.pyx":895 + * col_names = data.col_names + * is_unkown_number_rows = data.is_unkown_number_rows + * max_n_obs = data.max_n_obs # <<<<<<<<<<<<<< + * metaonly = data.metaonly + * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo)); - __pyx_r = ((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo); - goto __pyx_L0; + __pyx_t_4 = __pyx_v_data->max_n_obs; + __pyx_v_max_n_obs = __pyx_t_4; - /* "cpython/datetime.pxd":134 - * # Get tzinfo of time - * cdef inline object time_tzinfo(object o): - * if (o).hastzinfo: # <<<<<<<<<<<<<< - * return (o).tzinfo - * else: + /* "pyreadstat/_readstat_parser.pyx":896 + * is_unkown_number_rows = data.is_unkown_number_rows + * max_n_obs = data.max_n_obs + * metaonly = data.metaonly # <<<<<<<<<<<<<< + * + * for fc_cnt in range(0, len(col_names)): */ - } + __pyx_t_5 = __pyx_v_data->metaonly; + __pyx_v_metaonly = __pyx_t_5; - /* "cpython/datetime.pxd":137 - * return (o).tzinfo - * else: - * return None # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":898 + * metaonly = data.metaonly * - * # Get tzinfo of datetime + * for fc_cnt in range(0, len(col_names)): # <<<<<<<<<<<<<< + * cur_name_str = col_names[fc_cnt] + * cur_data = col_data[fc_cnt] */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + if (unlikely(__pyx_v_col_names == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 898, __pyx_L1_error) } + __pyx_t_6 = PyList_GET_SIZE(__pyx_v_col_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 898, __pyx_L1_error) + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_7; __pyx_t_4+=1) { + __pyx_v_fc_cnt = __pyx_t_4; - /* "cpython/datetime.pxd":133 + /* "pyreadstat/_readstat_parser.pyx":899 * - * # Get tzinfo of time - * cdef inline object time_tzinfo(object o): # <<<<<<<<<<<<<< - * if (o).hastzinfo: - * return (o).tzinfo + * for fc_cnt in range(0, len(col_names)): + * cur_name_str = col_names[fc_cnt] # <<<<<<<<<<<<<< + * cur_data = col_data[fc_cnt] + * if is_unkown_number_rows and not metaonly: */ + if (unlikely(__pyx_v_col_names == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 899, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_fc_cnt, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 899, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_cur_name_str, ((PyObject*)__pyx_t_1)); + __pyx_t_1 = 0; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":140 - * - * # Get tzinfo of datetime - * cdef inline object datetime_tzinfo(object o): # <<<<<<<<<<<<<< - * if (o).hastzinfo: - * return (o).tzinfo + /* "pyreadstat/_readstat_parser.pyx":900 + * for fc_cnt in range(0, len(col_names)): + * cur_name_str = col_names[fc_cnt] + * cur_data = col_data[fc_cnt] # <<<<<<<<<<<<<< + * if is_unkown_number_rows and not metaonly: + * cur_data = cur_data[0:max_n_obs] */ + if (unlikely(__pyx_v_col_data == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 900, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_data, __pyx_v_fc_cnt, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 900, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_cur_data, __pyx_t_1); + __pyx_t_1 = 0; -static CYTHON_INLINE PyObject *__pyx_f_7cpython_8datetime_datetime_tzinfo(PyObject *__pyx_v_o) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("datetime_tzinfo", 0); - - /* "cpython/datetime.pxd":141 - * # Get tzinfo of datetime - * cdef inline object datetime_tzinfo(object o): - * if (o).hastzinfo: # <<<<<<<<<<<<<< - * return (o).tzinfo - * else: - */ - __pyx_t_1 = (((PyDateTime_DateTime *)__pyx_v_o)->hastzinfo != 0); - if (__pyx_t_1) { - - /* "cpython/datetime.pxd":142 - * cdef inline object datetime_tzinfo(object o): - * if (o).hastzinfo: - * return (o).tzinfo # <<<<<<<<<<<<<< - * else: - * return None + /* "pyreadstat/_readstat_parser.pyx":901 + * cur_name_str = col_names[fc_cnt] + * cur_data = col_data[fc_cnt] + * if is_unkown_number_rows and not metaonly: # <<<<<<<<<<<<<< + * cur_data = cur_data[0:max_n_obs] + * if not metaonly: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo)); - __pyx_r = ((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo); - goto __pyx_L0; + if (__pyx_v_is_unkown_number_rows) { + } else { + __pyx_t_5 = __pyx_v_is_unkown_number_rows; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_8 = (!__pyx_v_metaonly); + __pyx_t_5 = __pyx_t_8; + __pyx_L6_bool_binop_done:; + if (__pyx_t_5) { - /* "cpython/datetime.pxd":141 - * # Get tzinfo of datetime - * cdef inline object datetime_tzinfo(object o): - * if (o).hastzinfo: # <<<<<<<<<<<<<< - * return (o).tzinfo - * else: + /* "pyreadstat/_readstat_parser.pyx":902 + * cur_data = col_data[fc_cnt] + * if is_unkown_number_rows and not metaonly: + * cur_data = cur_data[0:max_n_obs] # <<<<<<<<<<<<<< + * if not metaonly: + * final_container[cur_name_str] = cur_data */ - } + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_cur_data, 0, __pyx_v_max_n_obs, NULL, NULL, NULL, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 902, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_cur_data, __pyx_t_1); + __pyx_t_1 = 0; - /* "cpython/datetime.pxd":144 - * return (o).tzinfo - * else: - * return None # <<<<<<<<<<<<<< - * - * # Get year of date + /* "pyreadstat/_readstat_parser.pyx":901 + * cur_name_str = col_names[fc_cnt] + * cur_data = col_data[fc_cnt] + * if is_unkown_number_rows and not metaonly: # <<<<<<<<<<<<<< + * cur_data = cur_data[0:max_n_obs] + * if not metaonly: */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - } + } - /* "cpython/datetime.pxd":140 - * - * # Get tzinfo of datetime - * cdef inline object datetime_tzinfo(object o): # <<<<<<<<<<<<<< - * if (o).hastzinfo: - * return (o).tzinfo + /* "pyreadstat/_readstat_parser.pyx":903 + * if is_unkown_number_rows and not metaonly: + * cur_data = cur_data[0:max_n_obs] + * if not metaonly: # <<<<<<<<<<<<<< + * final_container[cur_name_str] = cur_data + * else: */ + __pyx_t_5 = (!__pyx_v_metaonly); + if (__pyx_t_5) { - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":147 - * - * # Get year of date - * cdef inline int date_year(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_YEAR(o) - * + /* "pyreadstat/_readstat_parser.pyx":904 + * cur_data = cur_data[0:max_n_obs] + * if not metaonly: + * final_container[cur_name_str] = cur_data # <<<<<<<<<<<<<< + * else: + * final_container[cur_name_str] = list() */ + if (unlikely((PyObject_SetItem(__pyx_v_final_container, __pyx_v_cur_name_str, __pyx_v_cur_data) < 0))) __PYX_ERR(0, 904, __pyx_L1_error) -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_year(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("date_year", 0); - - /* "cpython/datetime.pxd":148 - * # Get year of date - * cdef inline int date_year(object o): - * return PyDateTime_GET_YEAR(o) # <<<<<<<<<<<<<< - * - * # Get month of date + /* "pyreadstat/_readstat_parser.pyx":903 + * if is_unkown_number_rows and not metaonly: + * cur_data = cur_data[0:max_n_obs] + * if not metaonly: # <<<<<<<<<<<<<< + * final_container[cur_name_str] = cur_data + * else: */ - __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o); - goto __pyx_L0; + goto __pyx_L8; + } - /* "cpython/datetime.pxd":147 - * - * # Get year of date - * cdef inline int date_year(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_YEAR(o) + /* "pyreadstat/_readstat_parser.pyx":906 + * final_container[cur_name_str] = cur_data + * else: + * final_container[cur_name_str] = list() # <<<<<<<<<<<<<< * + * return final_container */ + /*else*/ { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely((PyObject_SetItem(__pyx_v_final_container, __pyx_v_cur_name_str, __pyx_t_1) < 0))) __PYX_ERR(0, 906, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L8:; + } - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":151 + /* "pyreadstat/_readstat_parser.pyx":908 + * final_container[cur_name_str] = list() * - * # Get month of date - * cdef inline int date_month(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_MONTH(o) + * return final_container # <<<<<<<<<<<<<< * - */ - -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_month(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("date_month", 0); - - /* "cpython/datetime.pxd":152 - * # Get month of date - * cdef inline int date_month(object o): - * return PyDateTime_GET_MONTH(o) # <<<<<<<<<<<<<< * - * # Get day of date */ - __pyx_r = PyDateTime_GET_MONTH(__pyx_v_o); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_final_container); + __pyx_r = __pyx_v_final_container; goto __pyx_L0; - /* "cpython/datetime.pxd":151 + /* "pyreadstat/_readstat_parser.pyx":877 * - * # Get month of date - * cdef inline int date_month(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_MONTH(o) * + * cdef object data_container_to_dict(data_container data): # <<<<<<<<<<<<<< + * """ + * Transforms a data container object to a pandas data frame */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container_to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_final_container); + __Pyx_XDECREF(__pyx_v_col_data); + __Pyx_XDECREF(__pyx_v_col_names); + __Pyx_XDECREF(__pyx_v_cur_name_str); + __Pyx_XDECREF(__pyx_v_cur_data); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "cpython/datetime.pxd":155 +/* "pyreadstat/_readstat_parser.pyx":911 * - * # Get day of date - * cdef inline int date_day(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_DAY(o) * + * cdef object dict_to_pandas_dataframe(object dict_data, data_container dc): # <<<<<<<<<<<<<< + * """ + * Transforms a dict of numpy arrays to a pandas data frame */ -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_date_day(PyObject *__pyx_v_o) { - int __pyx_r; +static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_dict_to_pandas_dataframe(PyObject *__pyx_v_dict_data, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_dc) { + int __pyx_v_dates_as_pandas; + int __pyx_v_index; + PyObject *__pyx_v_column = 0; + __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_v_var_format; + PyObject *__pyx_v_dtypes = 0; + PyObject *__pyx_v_data_frame = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("date_day", 0); - - /* "cpython/datetime.pxd":156 - * # Get day of date - * cdef inline int date_day(object o): - * return PyDateTime_GET_DAY(o) # <<<<<<<<<<<<<< - * - * # Get year of datetime - */ - __pyx_r = PyDateTime_GET_DAY(__pyx_v_o); - goto __pyx_L0; + 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_6; + PyObject *(*__pyx_t_7)(PyObject *); + __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dict_to_pandas_dataframe", 0); - /* "cpython/datetime.pxd":155 + /* "pyreadstat/_readstat_parser.pyx":922 + * cdef list dtypes * - * # Get day of date - * cdef inline int date_day(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_DAY(o) + * dates_as_pandas = dc.dates_as_pandas # <<<<<<<<<<<<<< * + * if dict_data: */ + __pyx_t_1 = __pyx_v_dc->dates_as_pandas; + __pyx_v_dates_as_pandas = __pyx_t_1; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":159 - * - * # Get year of datetime - * cdef inline int datetime_year(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_YEAR(o) + /* "pyreadstat/_readstat_parser.pyx":924 + * dates_as_pandas = dc.dates_as_pandas * + * if dict_data: # <<<<<<<<<<<<<< + * data_frame = pd.DataFrame.from_dict(dict_data) + * if dates_as_pandas: */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dict_data); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 924, __pyx_L1_error) + if (__pyx_t_1) { -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_year(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("datetime_year", 0); - - /* "cpython/datetime.pxd":160 - * # Get year of datetime - * cdef inline int datetime_year(object o): - * return PyDateTime_GET_YEAR(o) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":925 * - * # Get month of datetime + * if dict_data: + * data_frame = pd.DataFrame.from_dict(dict_data) # <<<<<<<<<<<<<< + * if dates_as_pandas: + * dtypes = data_frame.dtypes.tolist() */ - __pyx_r = PyDateTime_GET_YEAR(__pyx_v_o); - goto __pyx_L0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 925, __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_from_dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + 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_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_dict_data}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v_data_frame = __pyx_t_2; + __pyx_t_2 = 0; - /* "cpython/datetime.pxd":159 - * - * # Get year of datetime - * cdef inline int datetime_year(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_YEAR(o) - * + /* "pyreadstat/_readstat_parser.pyx":926 + * if dict_data: + * data_frame = pd.DataFrame.from_dict(dict_data) + * if dates_as_pandas: # <<<<<<<<<<<<<< + * dtypes = data_frame.dtypes.tolist() + * # check that datetime columns are datetime type */ + if (__pyx_v_dates_as_pandas) { - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":927 + * data_frame = pd.DataFrame.from_dict(dict_data) + * if dates_as_pandas: + * dtypes = data_frame.dtypes.tolist() # <<<<<<<<<<<<<< + * # check that datetime columns are datetime type + * # this is needed in case all date values are nan + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_data_frame, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 927, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tolist); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 927, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_5 = 1; + } + } + { + PyObject *__pyx_callargs[1] = {__pyx_t_3, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_2))) __PYX_ERR(0, 927, __pyx_L1_error) + __pyx_v_dtypes = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; -/* "cpython/datetime.pxd":163 - * - * # Get month of datetime - * cdef inline int datetime_month(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_MONTH(o) + /* "pyreadstat/_readstat_parser.pyx":930 + * # check that datetime columns are datetime type + * # this is needed in case all date values are nan + * for index, column in enumerate(data_frame.columns): # <<<<<<<<<<<<<< + * var_format = dc.col_formats[index] + * if dtypes[index] != '= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 930, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 930, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_7(__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, 930, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_2))) __PYX_ERR(0, 930, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_column, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_v_index = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); + + /* "pyreadstat/_readstat_parser.pyx":931 + * # this is needed in case all date values are nan + * for index, column in enumerate(data_frame.columns): + * var_format = dc.col_formats[index] # <<<<<<<<<<<<<< + * if dtypes[index] != 'col_formats == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 931, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_dc->col_formats, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = ((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 931, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_var_format = __pyx_t_8; + + /* "pyreadstat/_readstat_parser.pyx":932 + * for index, column in enumerate(data_frame.columns): + * var_format = dc.col_formats[index] + * if dtypes[index] != 'metaonly; + __pyx_v_metaonly = __pyx_t_1; - /* "cpython/datetime.pxd":167 + /* "pyreadstat/_readstat_parser.pyx":958 * - * # Get day of datetime - * cdef inline int datetime_day(object o): # <<<<<<<<<<<<<< - * return PyDateTime_GET_DAY(o) + * metaonly = data.metaonly + * is_unkown_number_rows = data.is_unkown_number_rows # <<<<<<<<<<<<<< * + * cdef object metadata = metadata_container() */ + __pyx_t_1 = __pyx_v_data->is_unkown_number_rows; + __pyx_v_is_unkown_number_rows = __pyx_t_1; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":171 + /* "pyreadstat/_readstat_parser.pyx":960 + * is_unkown_number_rows = data.is_unkown_number_rows * - * # Get hour of time - * cdef inline int time_hour(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_HOUR(o) + * cdef object metadata = metadata_container() # <<<<<<<<<<<<<< * + * # number of rows */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_metadata_container); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 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_5 = 1; + } + } + { + PyObject *__pyx_callargs[1] = {__pyx_t_4, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_v_metadata = __pyx_t_2; + __pyx_t_2 = 0; -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_hour(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("time_hour", 0); - - /* "cpython/datetime.pxd":172 - * # Get hour of time - * cdef inline int time_hour(object o): - * return PyDateTime_TIME_GET_HOUR(o) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":963 * - * # Get minute of time + * # number of rows + * metadata.number_columns = data.n_vars # <<<<<<<<<<<<<< + * if is_unkown_number_rows: + * if not metaonly: */ - __pyx_r = PyDateTime_TIME_GET_HOUR(__pyx_v_o); - goto __pyx_L0; + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_data->n_vars); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_number_columns, __pyx_t_2) < 0) __PYX_ERR(0, 963, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "cpython/datetime.pxd":171 - * - * # Get hour of time - * cdef inline int time_hour(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_HOUR(o) - * + /* "pyreadstat/_readstat_parser.pyx":964 + * # number of rows + * metadata.number_columns = data.n_vars + * if is_unkown_number_rows: # <<<<<<<<<<<<<< + * if not metaonly: + * metadata.number_rows = data.max_n_obs */ + if (__pyx_v_is_unkown_number_rows) { - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":965 + * metadata.number_columns = data.n_vars + * if is_unkown_number_rows: + * if not metaonly: # <<<<<<<<<<<<<< + * metadata.number_rows = data.max_n_obs + * else: + */ + __pyx_t_1 = (!__pyx_v_metaonly); + if (__pyx_t_1) { -/* "cpython/datetime.pxd":175 - * - * # Get minute of time - * cdef inline int time_minute(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_MINUTE(o) - * + /* "pyreadstat/_readstat_parser.pyx":966 + * if is_unkown_number_rows: + * if not metaonly: + * metadata.number_rows = data.max_n_obs # <<<<<<<<<<<<<< + * else: + * metadata.number_rows = data.n_obs */ + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_data->max_n_obs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_number_rows, __pyx_t_2) < 0) __PYX_ERR(0, 966, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_minute(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("time_minute", 0); + /* "pyreadstat/_readstat_parser.pyx":965 + * metadata.number_columns = data.n_vars + * if is_unkown_number_rows: + * if not metaonly: # <<<<<<<<<<<<<< + * metadata.number_rows = data.max_n_obs + * else: + */ + } - /* "cpython/datetime.pxd":176 - * # Get minute of time - * cdef inline int time_minute(object o): - * return PyDateTime_TIME_GET_MINUTE(o) # <<<<<<<<<<<<<< - * - * # Get second of time + /* "pyreadstat/_readstat_parser.pyx":964 + * # number of rows + * metadata.number_columns = data.n_vars + * if is_unkown_number_rows: # <<<<<<<<<<<<<< + * if not metaonly: + * metadata.number_rows = data.max_n_obs */ - __pyx_r = PyDateTime_TIME_GET_MINUTE(__pyx_v_o); - goto __pyx_L0; + goto __pyx_L3; + } - /* "cpython/datetime.pxd":175 - * - * # Get minute of time - * cdef inline int time_minute(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_MINUTE(o) + /* "pyreadstat/_readstat_parser.pyx":968 + * metadata.number_rows = data.max_n_obs + * else: + * metadata.number_rows = data.n_obs # <<<<<<<<<<<<<< * + * # value labels */ + /*else*/ { + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_data->n_obs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_number_rows, __pyx_t_2) < 0) __PYX_ERR(0, 968, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_L3:; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":179 - * - * # Get second of time - * cdef inline int time_second(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_SECOND(o) + /* "pyreadstat/_readstat_parser.pyx":971 * + * # value labels + * labels_raw = data.labels_raw # <<<<<<<<<<<<<< + * label_to_var_name = data.label_to_var_name + * variable_value_labels = dict() */ + __pyx_t_2 = __pyx_v_data->labels_raw; + __Pyx_INCREF(__pyx_t_2); + __pyx_v_labels_raw = __pyx_t_2; + __pyx_t_2 = 0; -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_second(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("time_second", 0); - - /* "cpython/datetime.pxd":180 - * # Get second of time - * cdef inline int time_second(object o): - * return PyDateTime_TIME_GET_SECOND(o) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":972 + * # value labels + * labels_raw = data.labels_raw + * label_to_var_name = data.label_to_var_name # <<<<<<<<<<<<<< + * variable_value_labels = dict() * - * # Get microsecond of time */ - __pyx_r = PyDateTime_TIME_GET_SECOND(__pyx_v_o); - goto __pyx_L0; + __pyx_t_2 = __pyx_v_data->label_to_var_name; + __Pyx_INCREF(__pyx_t_2); + __pyx_v_label_to_var_name = __pyx_t_2; + __pyx_t_2 = 0; - /* "cpython/datetime.pxd":179 - * - * # Get second of time - * cdef inline int time_second(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_SECOND(o) + /* "pyreadstat/_readstat_parser.pyx":973 + * labels_raw = data.labels_raw + * label_to_var_name = data.label_to_var_name + * variable_value_labels = dict() # <<<<<<<<<<<<<< * + * if labels_raw: */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 973, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_variable_value_labels = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":183 - * - * # Get microsecond of time - * cdef inline int time_microsecond(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_MICROSECOND(o) + /* "pyreadstat/_readstat_parser.pyx":975 + * variable_value_labels = dict() * + * if labels_raw: # <<<<<<<<<<<<<< + * for var_name, var_label in label_to_var_name.items(): + * current_labels = labels_raw.get(var_label) */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_labels_raw); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 975, __pyx_L1_error) + if (__pyx_t_1) { -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_time_microsecond(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("time_microsecond", 0); - - /* "cpython/datetime.pxd":184 - * # Get microsecond of time - * cdef inline int time_microsecond(object o): - * return PyDateTime_TIME_GET_MICROSECOND(o) # <<<<<<<<<<<<<< - * - * # Get hour of datetime - */ - __pyx_r = PyDateTime_TIME_GET_MICROSECOND(__pyx_v_o); - goto __pyx_L0; - - /* "cpython/datetime.pxd":183 - * - * # Get microsecond of time - * cdef inline int time_microsecond(object o): # <<<<<<<<<<<<<< - * return PyDateTime_TIME_GET_MICROSECOND(o) + /* "pyreadstat/_readstat_parser.pyx":976 * + * if labels_raw: + * for var_name, var_label in label_to_var_name.items(): # <<<<<<<<<<<<<< + * current_labels = labels_raw.get(var_label) + * if current_labels: */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_label_to_var_name, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + 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_5 = 1; + } + } + { + PyObject *__pyx_callargs[1] = {__pyx_t_4, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + 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_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 976, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 976, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 976, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_7(__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, 976, __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, 976, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 976, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L9_unpacking_done; + __pyx_L8_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 976, __pyx_L1_error) + __pyx_L9_unpacking_done:; + } + if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_4))) __PYX_ERR(0, 976, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_8))) __PYX_ERR(0, 976, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_var_name, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_var_label, ((PyObject*)__pyx_t_8)); + __pyx_t_8 = 0; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":187 - * - * # Get hour of datetime - * cdef inline int datetime_hour(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_HOUR(o) - * + /* "pyreadstat/_readstat_parser.pyx":977 + * if labels_raw: + * for var_name, var_label in label_to_var_name.items(): + * current_labels = labels_raw.get(var_label) # <<<<<<<<<<<<<< + * if current_labels: + * variable_value_labels[var_name] = current_labels */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_labels_raw, __pyx_n_s_get); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_var_label}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_XDECREF_SET(__pyx_v_current_labels, __pyx_t_2); + __pyx_t_2 = 0; -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_hour(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("datetime_hour", 0); - - /* "cpython/datetime.pxd":188 - * # Get hour of datetime - * cdef inline int datetime_hour(object o): - * return PyDateTime_DATE_GET_HOUR(o) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":978 + * for var_name, var_label in label_to_var_name.items(): + * current_labels = labels_raw.get(var_label) + * if current_labels: # <<<<<<<<<<<<<< + * variable_value_labels[var_name] = current_labels * - * # Get minute of datetime */ - __pyx_r = PyDateTime_DATE_GET_HOUR(__pyx_v_o); - goto __pyx_L0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_current_labels); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 978, __pyx_L1_error) + if (__pyx_t_1) { - /* "cpython/datetime.pxd":187 - * - * # Get hour of datetime - * cdef inline int datetime_hour(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_HOUR(o) + /* "pyreadstat/_readstat_parser.pyx":979 + * current_labels = labels_raw.get(var_label) + * if current_labels: + * variable_value_labels[var_name] = current_labels # <<<<<<<<<<<<<< * + * original_types = dict() */ + if (unlikely((PyDict_SetItem(__pyx_v_variable_value_labels, __pyx_v_var_name, __pyx_v_current_labels) < 0))) __PYX_ERR(0, 979, __pyx_L1_error) - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":191 - * - * # Get minute of datetime - * cdef inline int datetime_minute(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_MINUTE(o) + /* "pyreadstat/_readstat_parser.pyx":978 + * for var_name, var_label in label_to_var_name.items(): + * current_labels = labels_raw.get(var_label) + * if current_labels: # <<<<<<<<<<<<<< + * variable_value_labels[var_name] = current_labels * */ + } -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_minute(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("datetime_minute", 0); - - /* "cpython/datetime.pxd":192 - * # Get minute of datetime - * cdef inline int datetime_minute(object o): - * return PyDateTime_DATE_GET_MINUTE(o) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":976 * - * # Get second of datetime + * if labels_raw: + * for var_name, var_label in label_to_var_name.items(): # <<<<<<<<<<<<<< + * current_labels = labels_raw.get(var_label) + * if current_labels: */ - __pyx_r = PyDateTime_DATE_GET_MINUTE(__pyx_v_o); - goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "cpython/datetime.pxd":191 - * - * # Get minute of datetime - * cdef inline int datetime_minute(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_MINUTE(o) + /* "pyreadstat/_readstat_parser.pyx":975 + * variable_value_labels = dict() * + * if labels_raw: # <<<<<<<<<<<<<< + * for var_name, var_label in label_to_var_name.items(): + * current_labels = labels_raw.get(var_label) */ + } - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":195 - * - * # Get second of datetime - * cdef inline int datetime_second(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_SECOND(o) + /* "pyreadstat/_readstat_parser.pyx":981 + * variable_value_labels[var_name] = current_labels * + * original_types = dict() # <<<<<<<<<<<<<< + * readstat_types = dict() + * for indx in range(metadata.number_columns): */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 981, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_original_types = __pyx_t_3; + __pyx_t_3 = 0; -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_second(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("datetime_second", 0); - - /* "cpython/datetime.pxd":196 - * # Get second of datetime - * cdef inline int datetime_second(object o): - * return PyDateTime_DATE_GET_SECOND(o) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":982 * - * # Get microsecond of datetime + * original_types = dict() + * readstat_types = dict() # <<<<<<<<<<<<<< + * for indx in range(metadata.number_columns): + * cur_col = data.col_names[indx] */ - __pyx_r = PyDateTime_DATE_GET_SECOND(__pyx_v_o); - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 982, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_readstat_types = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "cpython/datetime.pxd":195 - * - * # Get second of datetime - * cdef inline int datetime_second(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_SECOND(o) - * + /* "pyreadstat/_readstat_parser.pyx":983 + * original_types = dict() + * readstat_types = dict() + * for indx in range(metadata.number_columns): # <<<<<<<<<<<<<< + * cur_col = data.col_names[indx] + * cur_type = data.col_formats_original[indx] */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_number_columns); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + 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_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 983, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 983, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 983, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 983, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_7(__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, 983, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_indx, __pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":199 - * - * # Get microsecond of datetime - * cdef inline int datetime_microsecond(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_MICROSECOND(o) - * - */ - -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_datetime_microsecond(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("datetime_microsecond", 0); - - /* "cpython/datetime.pxd":200 - * # Get microsecond of datetime - * cdef inline int datetime_microsecond(object o): - * return PyDateTime_DATE_GET_MICROSECOND(o) # <<<<<<<<<<<<<< - * - * # Get days of timedelta + /* "pyreadstat/_readstat_parser.pyx":984 + * readstat_types = dict() + * for indx in range(metadata.number_columns): + * cur_col = data.col_names[indx] # <<<<<<<<<<<<<< + * cur_type = data.col_formats_original[indx] + * original_types[cur_col] = cur_type */ - __pyx_r = PyDateTime_DATE_GET_MICROSECOND(__pyx_v_o); - goto __pyx_L0; + if (unlikely(__pyx_v_data->col_names == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 984, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data->col_names, __pyx_v_indx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_cur_col, __pyx_t_2); + __pyx_t_2 = 0; - /* "cpython/datetime.pxd":199 - * - * # Get microsecond of datetime - * cdef inline int datetime_microsecond(object o): # <<<<<<<<<<<<<< - * return PyDateTime_DATE_GET_MICROSECOND(o) - * + /* "pyreadstat/_readstat_parser.pyx":985 + * for indx in range(metadata.number_columns): + * cur_col = data.col_names[indx] + * cur_type = data.col_formats_original[indx] # <<<<<<<<<<<<<< + * original_types[cur_col] = cur_type + * var_type = data.col_dtypes[indx] */ + if (unlikely(__pyx_v_data->col_formats_original == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 985, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data->col_formats_original, __pyx_v_indx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 985, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_cur_type, __pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "cpython/datetime.pxd":203 - * - * # Get days of timedelta - * cdef inline int timedelta_days(object o): # <<<<<<<<<<<<<< - * return (o).days - * + /* "pyreadstat/_readstat_parser.pyx":986 + * cur_col = data.col_names[indx] + * cur_type = data.col_formats_original[indx] + * original_types[cur_col] = cur_type # <<<<<<<<<<<<<< + * var_type = data.col_dtypes[indx] + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: */ + if (unlikely((PyObject_SetItem(__pyx_v_original_types, __pyx_v_cur_col, __pyx_v_cur_type) < 0))) __PYX_ERR(0, 986, __pyx_L1_error) -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_days(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("timedelta_days", 0); - - /* "cpython/datetime.pxd":204 - * # Get days of timedelta - * cdef inline int timedelta_days(object o): - * return (o).days # <<<<<<<<<<<<<< - * - * # Get seconds of timedelta + /* "pyreadstat/_readstat_parser.pyx":987 + * cur_type = data.col_formats_original[indx] + * original_types[cur_col] = cur_type + * var_type = data.col_dtypes[indx] # <<<<<<<<<<<<<< + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: + * readstat_types[cur_col] = "string" */ - __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->days; - goto __pyx_L0; + if (unlikely(__pyx_v_data->col_dtypes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 987, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_data->col_dtypes, __pyx_v_indx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 987, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 987, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_var_type = __pyx_t_11; - /* "cpython/datetime.pxd":203 - * - * # Get days of timedelta - * cdef inline int timedelta_days(object o): # <<<<<<<<<<<<<< - * return (o).days - * + /* "pyreadstat/_readstat_parser.pyx":988 + * original_types[cur_col] = cur_type + * var_type = data.col_dtypes[indx] + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< + * readstat_types[cur_col] = "string" + * elif var_type == READSTAT_TYPE_INT8: */ + switch (__pyx_v_var_type) { + case READSTAT_TYPE_STRING: + case READSTAT_TYPE_STRING_REF: - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":989 + * var_type = data.col_dtypes[indx] + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: + * readstat_types[cur_col] = "string" # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_INT8: + * readstat_types[cur_col] = "int8" + */ + if (unlikely((PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_string) < 0))) __PYX_ERR(0, 989, __pyx_L1_error) -/* "cpython/datetime.pxd":207 - * - * # Get seconds of timedelta - * cdef inline int timedelta_seconds(object o): # <<<<<<<<<<<<<< - * return (o).seconds - * + /* "pyreadstat/_readstat_parser.pyx":988 + * original_types[cur_col] = cur_type + * var_type = data.col_dtypes[indx] + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: # <<<<<<<<<<<<<< + * readstat_types[cur_col] = "string" + * elif var_type == READSTAT_TYPE_INT8: */ + break; + case READSTAT_TYPE_INT8: -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_seconds(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("timedelta_seconds", 0); + /* "pyreadstat/_readstat_parser.pyx":991 + * readstat_types[cur_col] = "string" + * elif var_type == READSTAT_TYPE_INT8: + * readstat_types[cur_col] = "int8" # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_INT16: + * readstat_types[cur_col] = "int16" + */ + if (unlikely((PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_int8) < 0))) __PYX_ERR(0, 991, __pyx_L1_error) - /* "cpython/datetime.pxd":208 - * # Get seconds of timedelta - * cdef inline int timedelta_seconds(object o): - * return (o).seconds # <<<<<<<<<<<<<< - * - * # Get microseconds of timedelta + /* "pyreadstat/_readstat_parser.pyx":990 + * if var_type == READSTAT_TYPE_STRING or var_type == READSTAT_TYPE_STRING_REF: + * readstat_types[cur_col] = "string" + * elif var_type == READSTAT_TYPE_INT8: # <<<<<<<<<<<<<< + * readstat_types[cur_col] = "int8" + * elif var_type == READSTAT_TYPE_INT16: */ - __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->seconds; - goto __pyx_L0; + break; + case READSTAT_TYPE_INT16: - /* "cpython/datetime.pxd":207 - * - * # Get seconds of timedelta - * cdef inline int timedelta_seconds(object o): # <<<<<<<<<<<<<< - * return (o).seconds - * + /* "pyreadstat/_readstat_parser.pyx":993 + * readstat_types[cur_col] = "int8" + * elif var_type == READSTAT_TYPE_INT16: + * readstat_types[cur_col] = "int16" # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_INT32: + * readstat_types[cur_col] = "int32" */ + if (unlikely((PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_int16) < 0))) __PYX_ERR(0, 993, __pyx_L1_error) - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":992 + * elif var_type == READSTAT_TYPE_INT8: + * readstat_types[cur_col] = "int8" + * elif var_type == READSTAT_TYPE_INT16: # <<<<<<<<<<<<<< + * readstat_types[cur_col] = "int16" + * elif var_type == READSTAT_TYPE_INT32: + */ + break; + case READSTAT_TYPE_INT32: -/* "cpython/datetime.pxd":211 - * - * # Get microseconds of timedelta - * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<< - * return (o).microseconds + /* "pyreadstat/_readstat_parser.pyx":995 + * readstat_types[cur_col] = "int16" + * elif var_type == READSTAT_TYPE_INT32: + * readstat_types[cur_col] = "int32" # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_FLOAT: + * readstat_types[cur_col] = "float" */ + if (unlikely((PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_int32) < 0))) __PYX_ERR(0, 995, __pyx_L1_error) -static CYTHON_INLINE int __pyx_f_7cpython_8datetime_timedelta_microseconds(PyObject *__pyx_v_o) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("timedelta_microseconds", 0); + /* "pyreadstat/_readstat_parser.pyx":994 + * elif var_type == READSTAT_TYPE_INT16: + * readstat_types[cur_col] = "int16" + * elif var_type == READSTAT_TYPE_INT32: # <<<<<<<<<<<<<< + * readstat_types[cur_col] = "int32" + * elif var_type == READSTAT_TYPE_FLOAT: + */ + break; + case READSTAT_TYPE_FLOAT: - /* "cpython/datetime.pxd":212 - * # Get microseconds of timedelta - * cdef inline int timedelta_microseconds(object o): - * return (o).microseconds # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_parser.pyx":997 + * readstat_types[cur_col] = "int32" + * elif var_type == READSTAT_TYPE_FLOAT: + * readstat_types[cur_col] = "float" # <<<<<<<<<<<<<< + * elif var_type == READSTAT_TYPE_DOUBLE: + * readstat_types[cur_col] = "double" */ - __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->microseconds; - goto __pyx_L0; + if (unlikely((PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_float) < 0))) __PYX_ERR(0, 997, __pyx_L1_error) - /* "cpython/datetime.pxd":211 - * - * # Get microseconds of timedelta - * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<< - * return (o).microseconds + /* "pyreadstat/_readstat_parser.pyx":996 + * elif var_type == READSTAT_TYPE_INT32: + * readstat_types[cur_col] = "int32" + * elif var_type == READSTAT_TYPE_FLOAT: # <<<<<<<<<<<<<< + * readstat_types[cur_col] = "float" + * elif var_type == READSTAT_TYPE_DOUBLE: */ + break; + case READSTAT_TYPE_DOUBLE: - /* function exit code */ - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "pyreadstat/_readstat_parser.pyx":999 + * readstat_types[cur_col] = "float" + * elif var_type == READSTAT_TYPE_DOUBLE: + * readstat_types[cur_col] = "double" # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("Unkown data type") + */ + if (unlikely((PyDict_SetItem(__pyx_v_readstat_types, __pyx_v_cur_col, __pyx_n_s_double) < 0))) __PYX_ERR(0, 999, __pyx_L1_error) -static PyObject *__pyx_tp_new_10pyreadstat_16_readstat_parser_data_container(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *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_10pyreadstat_16_readstat_parser_data_container *)o); - p->col_data = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_data_len = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_names = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_labels = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_numpy_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_dtypes_isobject = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_dytpes_isfloat = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_formats = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->col_formats_original = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->origin = Py_None; Py_INCREF(Py_None); - p->file_label = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->file_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->label_to_var_name = Py_None; Py_INCREF(Py_None); - p->labels_raw = Py_None; Py_INCREF(Py_None); - p->notes = Py_None; Py_INCREF(Py_None); - p->user_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->table_name = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->use_cols = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->missing_ranges = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->missing_user_values = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->variable_storage_width = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->variable_display_width = Py_None; Py_INCREF(Py_None); - p->variable_alignment = Py_None; Py_INCREF(Py_None); - p->variable_measure = Py_None; Py_INCREF(Py_None); - if (unlikely(__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; - return o; - bad: - Py_DECREF(o); o = 0; - return NULL; -} + /* "pyreadstat/_readstat_parser.pyx":998 + * elif var_type == READSTAT_TYPE_FLOAT: + * readstat_types[cur_col] = "float" + * elif var_type == READSTAT_TYPE_DOUBLE: # <<<<<<<<<<<<<< + * readstat_types[cur_col] = "double" + * else: + */ + break; + default: -static void __pyx_tp_dealloc_10pyreadstat_16_readstat_parser_data_container(PyObject *o) { - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *p = (struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)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->col_data); - Py_CLEAR(p->col_data_len); - Py_CLEAR(p->col_names); - Py_CLEAR(p->col_labels); - Py_CLEAR(p->col_dtypes); - Py_CLEAR(p->col_numpy_dtypes); - Py_CLEAR(p->col_dtypes_isobject); - Py_CLEAR(p->col_dytpes_isfloat); - Py_CLEAR(p->col_formats); - Py_CLEAR(p->col_formats_original); - Py_CLEAR(p->origin); - Py_CLEAR(p->file_label); - Py_CLEAR(p->file_encoding); - Py_CLEAR(p->label_to_var_name); - Py_CLEAR(p->labels_raw); - Py_CLEAR(p->notes); - Py_CLEAR(p->user_encoding); - Py_CLEAR(p->table_name); - Py_CLEAR(p->use_cols); - Py_CLEAR(p->missing_ranges); - Py_CLEAR(p->missing_user_values); - Py_CLEAR(p->variable_storage_width); - Py_CLEAR(p->variable_display_width); - Py_CLEAR(p->variable_alignment); - Py_CLEAR(p->variable_measure); - (*Py_TYPE(o)->tp_free)(o); -} + /* "pyreadstat/_readstat_parser.pyx":1001 + * readstat_types[cur_col] = "double" + * else: + * raise PyreadstatError("Unkown data type") # <<<<<<<<<<<<<< + * + * for indx, curset in data.missing_user_values.items(): + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1001, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + 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_5 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_s_Unkown_data_type}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1001, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 1001, __pyx_L1_error) + break; + } -static int __pyx_tp_traverse_10pyreadstat_16_readstat_parser_data_container(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *p = (struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)o; - if (p->col_data) { - e = (*v)(p->col_data, a); if (e) return e; - } - if (p->col_data_len) { - e = (*v)(p->col_data_len, a); if (e) return e; - } - if (p->col_names) { - e = (*v)(p->col_names, a); if (e) return e; - } - if (p->col_labels) { - e = (*v)(p->col_labels, a); if (e) return e; - } - if (p->col_dtypes) { - e = (*v)(p->col_dtypes, a); if (e) return e; - } - if (p->col_numpy_dtypes) { - e = (*v)(p->col_numpy_dtypes, a); if (e) return e; + /* "pyreadstat/_readstat_parser.pyx":983 + * original_types = dict() + * readstat_types = dict() + * for indx in range(metadata.number_columns): # <<<<<<<<<<<<<< + * cur_col = data.col_names[indx] + * cur_type = data.col_formats_original[indx] + */ } - if (p->col_dtypes_isobject) { - e = (*v)(p->col_dtypes_isobject, a); if (e) return e; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1003 + * raise PyreadstatError("Unkown data type") + * + * for indx, curset in data.missing_user_values.items(): # <<<<<<<<<<<<<< + * cur_col = data.col_names[indx] + * metadata.missing_user_values[cur_col] = sorted(list(curset)) + */ + if (unlikely(__pyx_v_data->missing_user_values == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); + __PYX_ERR(0, 1003, __pyx_L1_error) } - if (p->col_dytpes_isfloat) { - e = (*v)(p->col_dytpes_isfloat, a); if (e) return e; + __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_data->missing_user_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1003, __pyx_L1_error) } - if (p->col_formats) { - e = (*v)(p->col_formats, a); if (e) return e; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 1003, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 1003, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_7(__pyx_t_2); + 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, 1003, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(0, 1003, __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_4 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + __pyx_t_4 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L17_unpacking_failed; + __Pyx_GOTREF(__pyx_t_8); + index = 1; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L17_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 1003, __pyx_L1_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L18_unpacking_done; + __pyx_L17_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1003, __pyx_L1_error) + __pyx_L18_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_indx, __pyx_t_8); + __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_curset, __pyx_t_4); + __pyx_t_4 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1004 + * + * for indx, curset in data.missing_user_values.items(): + * cur_col = data.col_names[indx] # <<<<<<<<<<<<<< + * metadata.missing_user_values[cur_col] = sorted(list(curset)) + * + */ + if (unlikely(__pyx_v_data->col_names == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 1004, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_data->col_names, __pyx_v_indx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_cur_col, __pyx_t_3); + __pyx_t_3 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1005 + * for indx, curset in data.missing_user_values.items(): + * cur_col = data.col_names[indx] + * metadata.missing_user_values[cur_col] = sorted(list(curset)) # <<<<<<<<<<<<<< + * + * metadata.notes = data.notes + */ + __pyx_t_4 = PySequence_List(__pyx_v_curset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PySequence_List(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = ((PyObject*)__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_12 = PyList_Sort(__pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1005, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_missing_user_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (unlikely((PyObject_SetItem(__pyx_t_8, __pyx_v_cur_col, __pyx_t_3) < 0))) __PYX_ERR(0, 1005, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1003 + * raise PyreadstatError("Unkown data type") + * + * for indx, curset in data.missing_user_values.items(): # <<<<<<<<<<<<<< + * cur_col = data.col_names[indx] + * metadata.missing_user_values[cur_col] = sorted(list(curset)) + */ } - if (p->col_formats_original) { + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1007 + * metadata.missing_user_values[cur_col] = sorted(list(curset)) + * + * metadata.notes = data.notes # <<<<<<<<<<<<<< + * metadata.column_names = data.col_names + * metadata.column_labels = data.col_labels + */ + __pyx_t_2 = __pyx_v_data->notes; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_notes, __pyx_t_2) < 0) __PYX_ERR(0, 1007, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1008 + * + * metadata.notes = data.notes + * metadata.column_names = data.col_names # <<<<<<<<<<<<<< + * metadata.column_labels = data.col_labels + * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} + */ + __pyx_t_2 = __pyx_v_data->col_names; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_column_names, __pyx_t_2) < 0) __PYX_ERR(0, 1008, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1009 + * metadata.notes = data.notes + * metadata.column_names = data.col_names + * metadata.column_labels = data.col_labels # <<<<<<<<<<<<<< + * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} + * metadata.file_encoding = data.file_encoding + */ + __pyx_t_2 = __pyx_v_data->col_labels; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_column_labels, __pyx_t_2) < 0) __PYX_ERR(0, 1009, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1010 + * metadata.column_names = data.col_names + * metadata.column_labels = data.col_labels + * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} # <<<<<<<<<<<<<< + * metadata.file_encoding = data.file_encoding + * metadata.file_label = data.file_label + */ + { /* enter inner scope */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_data->col_names); + __Pyx_GIVEREF(__pyx_v_data->col_names); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data->col_names); + __Pyx_INCREF(__pyx_v_data->col_labels); + __Pyx_GIVEREF(__pyx_v_data->col_labels); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_data->col_labels); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) { + __pyx_t_3 = __pyx_t_8; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; + __pyx_t_7 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1010, __pyx_L22_error) + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + for (;;) { + if (likely(!__pyx_t_7)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 1010, __pyx_L22_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } else { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 1010, __pyx_L22_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_8); + #endif + } + } else { + __pyx_t_8 = __pyx_t_7(__pyx_t_3); + 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, 1010, __pyx_L22_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_8); + } + if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { + PyObject* sequence = __pyx_t_8; + 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, 1010, __pyx_L22_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_9); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_13 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1010, __pyx_L22_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); + index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_4)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + index = 1; __pyx_t_9 = __pyx_t_10(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L25_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_13), 2) < 0) __PYX_ERR(0, 1010, __pyx_L22_error) + __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + goto __pyx_L26_unpacking_done; + __pyx_L25_unpacking_failed:; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_10 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(0, 1010, __pyx_L22_error) + __pyx_L26_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_4); + __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_9); + __pyx_t_9 = 0; + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_7genexpr__pyx_v_v))) __PYX_ERR(0, 1010, __pyx_L22_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; + goto __pyx_L28_exit_scope; + __pyx_L22_error:; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; + goto __pyx_L1_error; + __pyx_L28_exit_scope:; + } /* exit inner scope */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_column_names_to_labels, __pyx_t_2) < 0) __PYX_ERR(0, 1010, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1011 + * metadata.column_labels = data.col_labels + * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} + * metadata.file_encoding = data.file_encoding # <<<<<<<<<<<<<< + * metadata.file_label = data.file_label + * metadata.variable_value_labels = variable_value_labels + */ + __pyx_t_2 = __pyx_v_data->file_encoding; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 1011, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1012 + * metadata.column_names_to_labels = {k:v for k,v in zip(data.col_names, data.col_labels)} + * metadata.file_encoding = data.file_encoding + * metadata.file_label = data.file_label # <<<<<<<<<<<<<< + * metadata.variable_value_labels = variable_value_labels + * metadata.value_labels = labels_raw + */ + __pyx_t_2 = __pyx_v_data->file_label; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_label, __pyx_t_2) < 0) __PYX_ERR(0, 1012, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1013 + * metadata.file_encoding = data.file_encoding + * metadata.file_label = data.file_label + * metadata.variable_value_labels = variable_value_labels # <<<<<<<<<<<<<< + * metadata.value_labels = labels_raw + * metadata.variable_to_label = label_to_var_name + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_value_labels, __pyx_v_variable_value_labels) < 0) __PYX_ERR(0, 1013, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1014 + * metadata.file_label = data.file_label + * metadata.variable_value_labels = variable_value_labels + * metadata.value_labels = labels_raw # <<<<<<<<<<<<<< + * metadata.variable_to_label = label_to_var_name + * metadata.original_variable_types = original_types + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels, __pyx_v_labels_raw) < 0) __PYX_ERR(0, 1014, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1015 + * metadata.variable_value_labels = variable_value_labels + * metadata.value_labels = labels_raw + * metadata.variable_to_label = label_to_var_name # <<<<<<<<<<<<<< + * metadata.original_variable_types = original_types + * metadata.readstat_variable_types = readstat_types + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label, __pyx_v_label_to_var_name) < 0) __PYX_ERR(0, 1015, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1016 + * metadata.value_labels = labels_raw + * metadata.variable_to_label = label_to_var_name + * metadata.original_variable_types = original_types # <<<<<<<<<<<<<< + * metadata.readstat_variable_types = readstat_types + * metadata.table_name = data.table_name + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_original_variable_types, __pyx_v_original_types) < 0) __PYX_ERR(0, 1016, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1017 + * metadata.variable_to_label = label_to_var_name + * metadata.original_variable_types = original_types + * metadata.readstat_variable_types = readstat_types # <<<<<<<<<<<<<< + * metadata.table_name = data.table_name + * metadata.missing_ranges = data.missing_ranges + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_readstat_variable_types, __pyx_v_readstat_types) < 0) __PYX_ERR(0, 1017, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1018 + * metadata.original_variable_types = original_types + * metadata.readstat_variable_types = readstat_types + * metadata.table_name = data.table_name # <<<<<<<<<<<<<< + * metadata.missing_ranges = data.missing_ranges + * metadata.variable_storage_width = data.variable_storage_width + */ + __pyx_t_2 = __pyx_v_data->table_name; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_table_name, __pyx_t_2) < 0) __PYX_ERR(0, 1018, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1019 + * metadata.readstat_variable_types = readstat_types + * metadata.table_name = data.table_name + * metadata.missing_ranges = data.missing_ranges # <<<<<<<<<<<<<< + * metadata.variable_storage_width = data.variable_storage_width + * metadata.variable_display_width = data.variable_display_width + */ + __pyx_t_2 = __pyx_v_data->missing_ranges; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_missing_ranges, __pyx_t_2) < 0) __PYX_ERR(0, 1019, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1020 + * metadata.table_name = data.table_name + * metadata.missing_ranges = data.missing_ranges + * metadata.variable_storage_width = data.variable_storage_width # <<<<<<<<<<<<<< + * metadata.variable_display_width = data.variable_display_width + * metadata.variable_alignment = data.variable_alignment + */ + __pyx_t_2 = __pyx_v_data->variable_storage_width; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_storage_width, __pyx_t_2) < 0) __PYX_ERR(0, 1020, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1021 + * metadata.missing_ranges = data.missing_ranges + * metadata.variable_storage_width = data.variable_storage_width + * metadata.variable_display_width = data.variable_display_width # <<<<<<<<<<<<<< + * metadata.variable_alignment = data.variable_alignment + * metadata.variable_measure = data.variable_measure + */ + __pyx_t_2 = __pyx_v_data->variable_display_width; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_display_width, __pyx_t_2) < 0) __PYX_ERR(0, 1021, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1022 + * metadata.variable_storage_width = data.variable_storage_width + * metadata.variable_display_width = data.variable_display_width + * metadata.variable_alignment = data.variable_alignment # <<<<<<<<<<<<<< + * metadata.variable_measure = data.variable_measure + * + */ + __pyx_t_2 = __pyx_v_data->variable_alignment; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_alignment, __pyx_t_2) < 0) __PYX_ERR(0, 1022, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1023 + * metadata.variable_display_width = data.variable_display_width + * metadata.variable_alignment = data.variable_alignment + * metadata.variable_measure = data.variable_measure # <<<<<<<<<<<<<< + * + * return metadata + */ + __pyx_t_2 = __pyx_v_data->variable_measure; + __Pyx_INCREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_measure, __pyx_t_2) < 0) __PYX_ERR(0, 1023, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1025 + * metadata.variable_measure = data.variable_measure + * + * return metadata # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_metadata); + __pyx_r = __pyx_v_metadata; + goto __pyx_L0; + + /* "pyreadstat/_readstat_parser.pyx":940 + * + * + * cdef object data_container_extract_metadata(data_container data): # <<<<<<<<<<<<<< + * """ + * Extracts metadata from a data container and puts it into a metadata + */ + + /* 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_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("pyreadstat._readstat_parser.data_container_extract_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_label_to_var_name); + __Pyx_XDECREF(__pyx_v_labels_raw); + __Pyx_XDECREF(__pyx_v_var_name); + __Pyx_XDECREF(__pyx_v_var_label); + __Pyx_XDECREF(__pyx_v_current_labels); + __Pyx_XDECREF(__pyx_v_original_types); + __Pyx_XDECREF(__pyx_v_metadata); + __Pyx_XDECREF(__pyx_v_variable_value_labels); + __Pyx_XDECREF(__pyx_v_readstat_types); + __Pyx_XDECREF(__pyx_v_indx); + __Pyx_XDECREF(__pyx_v_cur_col); + __Pyx_XDECREF(__pyx_v_cur_type); + __Pyx_XDECREF(__pyx_v_curset); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); + __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pyreadstat/_readstat_parser.pyx":1028 + * + * + * cdef object run_conversion(object filename_path, py_file_format file_format, py_file_extension file_extension, # <<<<<<<<<<<<<< + * str encoding, bint metaonly, bint dates_as_pandas, list usecols, bint usernan, + * bint no_datetime_conversion, long row_limit, long row_offset, str output_format, + */ + +static PyObject *__pyx_f_10pyreadstat_16_readstat_parser_run_conversion(PyObject *__pyx_v_filename_path, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format, __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension, PyObject *__pyx_v_encoding, int __pyx_v_metaonly, int __pyx_v_dates_as_pandas, PyObject *__pyx_v_usecols, int __pyx_v_usernan, int __pyx_v_no_datetime_conversion, long __pyx_v_row_limit, long __pyx_v_row_offset, PyObject *__pyx_v_output_format, PyObject *__pyx_v_extra_datetime_formats, PyObject *__pyx_v_extra_date_formats) { + PyObject *__pyx_v_filename_bytes = 0; + char *__pyx_v_filename; + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *__pyx_v_data = 0; + PyObject *__pyx_v_origin = 0; + PyObject *__pyx_v_allowed_formats = 0; + PyObject *__pyx_v_data_dict = 0; + PyObject *__pyx_v_data_frame = 0; + CYTHON_UNUSED void *__pyx_v_ctx; + PyObject *__pyx_v_metadata = NULL; + 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; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __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; + int __pyx_t_14; + int __pyx_t_15; + char *__pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run_conversion", 0); + __Pyx_INCREF(__pyx_v_output_format); + + /* "pyreadstat/_readstat_parser.pyx":1045 + * cdef object data_frame + * + * if hasattr(os, 'fsencode'): # <<<<<<<<<<<<<< + * try: + * filename_bytes = os.fsencode(filename_path) + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1045, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_HasAttr(__pyx_t_1, __pyx_n_s_fsencode); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1045, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1046 + * + * if hasattr(os, 'fsencode'): + * try: # <<<<<<<<<<<<<< + * filename_bytes = os.fsencode(filename_path) + * except UnicodeError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "pyreadstat/_readstat_parser.pyx":1047 + * if hasattr(os, 'fsencode'): + * try: + * filename_bytes = os.fsencode(filename_path) # <<<<<<<<<<<<<< + * except UnicodeError: + * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1047, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + __pyx_t_8 = 0; + 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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_filename_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(0, 1047, __pyx_L4_error) + __pyx_v_filename_bytes = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1046 + * + * if hasattr(os, 'fsencode'): + * try: # <<<<<<<<<<<<<< + * filename_bytes = os.fsencode(filename_path) + * except UnicodeError: + */ + } + __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; + goto __pyx_L9_try_end; + __pyx_L4_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; + + /* "pyreadstat/_readstat_parser.pyx":1048 + * try: + * filename_bytes = os.fsencode(filename_path) + * except UnicodeError: # <<<<<<<<<<<<<< + * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) + * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") + */ + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeError); + if (__pyx_t_8) { + __Pyx_AddTraceback("pyreadstat._readstat_parser.run_conversion", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_6) < 0) __PYX_ERR(0, 1048, __pyx_L6_except_error) + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_6); + + /* "pyreadstat/_readstat_parser.pyx":1049 + * filename_bytes = os.fsencode(filename_path) + * except UnicodeError: + * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) # <<<<<<<<<<<<<< + * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_warnings); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_warn); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1049, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_sys); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1049, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1049, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_8 = 1; + } + } + { + PyObject *__pyx_callargs[1] = {__pyx_t_12, }; + __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __pyx_t_13 = __Pyx_PyString_FormatSafe(__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1049, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_13}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1049, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1050 + * except UnicodeError: + * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) + * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") # <<<<<<<<<<<<<< + * else: + * if type(filename_path) == str: + */ + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_os); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1050, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_fsdecode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1050, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_11)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_11); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_filename_path}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1050, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_encode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1050, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1050, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_9))) __PYX_ERR(0, 1050, __pyx_L6_except_error) + __Pyx_XDECREF_SET(__pyx_v_filename_bytes, ((PyObject*)__pyx_t_9)); + __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + goto __pyx_L5_exception_handled; + } + goto __pyx_L6_except_error; + + /* "pyreadstat/_readstat_parser.pyx":1046 + * + * if hasattr(os, 'fsencode'): + * try: # <<<<<<<<<<<<<< + * filename_bytes = os.fsencode(filename_path) + * except UnicodeError: + */ + __pyx_L6_except_error:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L5_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + __pyx_L9_try_end:; + } + + /* "pyreadstat/_readstat_parser.pyx":1045 + * cdef object data_frame + * + * if hasattr(os, 'fsencode'): # <<<<<<<<<<<<<< + * try: + * filename_bytes = os.fsencode(filename_path) + */ + goto __pyx_L3; + } + + /* "pyreadstat/_readstat_parser.pyx":1052 + * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") + * else: + * if type(filename_path) == str: # <<<<<<<<<<<<<< + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: + */ + /*else*/ { + __pyx_t_6 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1052, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1052, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1053 + * else: + * if type(filename_path) == str: + * filename_bytes = filename_path.encode('utf-8') # <<<<<<<<<<<<<< + * elif type(filename_path) == bytes: + * filename_bytes = filename_path + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_s_utf_8}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1053, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_6))) __PYX_ERR(0, 1053, __pyx_L1_error) + __pyx_v_filename_bytes = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1052 + * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") + * else: + * if type(filename_path) == str: # <<<<<<<<<<<<<< + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: + */ + goto __pyx_L12; + } + + /* "pyreadstat/_readstat_parser.pyx":1054 + * if type(filename_path) == str: + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< + * filename_bytes = filename_path + * else: + */ + __pyx_t_6 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyBytes_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1054, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1054, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (likely(__pyx_t_2)) { + + /* "pyreadstat/_readstat_parser.pyx":1055 + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: + * filename_bytes = filename_path # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("path must be either str or bytes") + */ + if (!(likely(PyBytes_CheckExact(__pyx_v_filename_path))||((__pyx_v_filename_path) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_filename_path))) __PYX_ERR(0, 1055, __pyx_L1_error) + __pyx_t_6 = __pyx_v_filename_path; + __Pyx_INCREF(__pyx_t_6); + __pyx_v_filename_bytes = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1054 + * if type(filename_path) == str: + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< + * filename_bytes = filename_path + * else: + */ + goto __pyx_L12; + } + + /* "pyreadstat/_readstat_parser.pyx":1057 + * filename_bytes = filename_path + * else: + * raise PyreadstatError("path must be either str or bytes") # <<<<<<<<<<<<<< + * if type(filename_path) not in (str, bytes, unicode): + * raise PyreadstatError("path must be str, bytes or unicode") + */ + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1057, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = NULL; + __pyx_t_8 = 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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_s_path_must_be_either_str_or_bytes}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1057, __pyx_L1_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, 1057, __pyx_L1_error) + } + __pyx_L12:; + + /* "pyreadstat/_readstat_parser.pyx":1058 + * else: + * raise PyreadstatError("path must be either str or bytes") + * if type(filename_path) not in (str, bytes, unicode): # <<<<<<<<<<<<<< + * raise PyreadstatError("path must be str, bytes or unicode") + * filename_bytes = filename_path.encode('utf-8') + */ + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_filename_path))); + __pyx_t_6 = ((PyObject *)Py_TYPE(__pyx_v_filename_path)); + __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_t_6), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1058, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 1058, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_14) { + } else { + __pyx_t_2 = __pyx_t_14; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_t_6), ((PyObject *)(&PyBytes_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1058, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 1058, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_14) { + } else { + __pyx_t_2 = __pyx_t_14; + goto __pyx_L14_bool_binop_done; + } + __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_t_6), ((PyObject *)(&PyUnicode_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1058, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 1058, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = __pyx_t_14; + __pyx_L14_bool_binop_done:; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_14 = __pyx_t_2; + if (unlikely(__pyx_t_14)) { + + /* "pyreadstat/_readstat_parser.pyx":1059 + * raise PyreadstatError("path must be either str or bytes") + * if type(filename_path) not in (str, bytes, unicode): + * raise PyreadstatError("path must be str, bytes or unicode") # <<<<<<<<<<<<<< + * filename_bytes = filename_path.encode('utf-8') + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1059, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = NULL; + __pyx_t_8 = 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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_s_path_must_be_str_bytes_or_unicod}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1059, __pyx_L1_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, 1059, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1058 + * else: + * raise PyreadstatError("path must be either str or bytes") + * if type(filename_path) not in (str, bytes, unicode): # <<<<<<<<<<<<<< + * raise PyreadstatError("path must be str, bytes or unicode") + * filename_bytes = filename_path.encode('utf-8') + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1060 + * if type(filename_path) not in (str, bytes, unicode): + * raise PyreadstatError("path must be str, bytes or unicode") + * filename_bytes = filename_path.encode('utf-8') # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_s_utf_8}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1060, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_6))) __PYX_ERR(0, 1060, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_filename_bytes, ((PyObject*)__pyx_t_6)); + __pyx_t_6 = 0; + } + __pyx_L3:; + + /* "pyreadstat/_readstat_parser.pyx":1063 + * + * + * filename_bytes = os.path.expanduser(filename_bytes) # <<<<<<<<<<<<<< + * if not os.path.isfile(filename_bytes): + * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_filename_bytes}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_6))) __PYX_ERR(0, 1063, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_filename_bytes, ((PyObject*)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1064 + * + * filename_bytes = os.path.expanduser(filename_bytes) + * if not os.path.isfile(filename_bytes): # <<<<<<<<<<<<<< + * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isfile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_filename_bytes}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 1064, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = (!__pyx_t_14); + if (unlikely(__pyx_t_2)) { + + /* "pyreadstat/_readstat_parser.pyx":1065 + * filename_bytes = os.path.expanduser(filename_bytes) + * if not os.path.isfile(filename_bytes): + * raise PyreadstatError("File {0} does not exist!".format(filename_path)) # <<<<<<<<<<<<<< + * + * if output_format is None: + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_File_0_does_not_exist, __pyx_n_s_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_13 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_filename_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_1}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_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, 1065, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1064 + * + * filename_bytes = os.path.expanduser(filename_bytes) + * if not os.path.isfile(filename_bytes): # <<<<<<<<<<<<<< + * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + * + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1067 + * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + * + * if output_format is None: # <<<<<<<<<<<<<< + * output_format = 'pandas' + * allowed_formats = {'pandas', 'dict'} + */ + __pyx_t_2 = (__pyx_v_output_format == ((PyObject*)Py_None)); + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1068 + * + * if output_format is None: + * output_format = 'pandas' # <<<<<<<<<<<<<< + * allowed_formats = {'pandas', 'dict'} + * if output_format not in allowed_formats: + */ + __Pyx_INCREF(__pyx_n_s_pandas); + __Pyx_DECREF_SET(__pyx_v_output_format, __pyx_n_s_pandas); + + /* "pyreadstat/_readstat_parser.pyx":1067 + * raise PyreadstatError("File {0} does not exist!".format(filename_path)) + * + * if output_format is None: # <<<<<<<<<<<<<< + * output_format = 'pandas' + * allowed_formats = {'pandas', 'dict'} + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1069 + * if output_format is None: + * output_format = 'pandas' + * allowed_formats = {'pandas', 'dict'} # <<<<<<<<<<<<<< + * if output_format not in allowed_formats: + * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + */ + __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PySet_Add(__pyx_t_6, __pyx_n_s_pandas) < 0) __PYX_ERR(0, 1069, __pyx_L1_error) + if (PySet_Add(__pyx_t_6, __pyx_n_s_dict) < 0) __PYX_ERR(0, 1069, __pyx_L1_error) + __pyx_v_allowed_formats = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1070 + * output_format = 'pandas' + * allowed_formats = {'pandas', 'dict'} + * if output_format not in allowed_formats: # <<<<<<<<<<<<<< + * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + * + */ + __pyx_t_2 = (__Pyx_PySet_ContainsTF(__pyx_v_output_format, __pyx_v_allowed_formats, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1070, __pyx_L1_error) + if (unlikely(__pyx_t_2)) { + + /* "pyreadstat/_readstat_parser.pyx":1071 + * allowed_formats = {'pandas', 'dict'} + * if output_format not in allowed_formats: + * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) # <<<<<<<<<<<<<< + * + * if extra_date_formats is not None: + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_output_format_must_be_one_of_all, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_allowed_formats, __pyx_v_allowed_formats) < 0) __PYX_ERR(0, 1071, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_output_format, __pyx_v_output_format) < 0) __PYX_ERR(0, 1071, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1071, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(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_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_13}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1071, __pyx_L1_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, 1071, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1070 + * output_format = 'pandas' + * allowed_formats = {'pandas', 'dict'} + * if output_format not in allowed_formats: # <<<<<<<<<<<<<< + * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + * + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1073 + * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + * + * if extra_date_formats is not None: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_SAS: + * sas_date_formats.extend(extra_date_formats) + */ + __pyx_t_2 = (__pyx_v_extra_date_formats != ((PyObject*)Py_None)); + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1074 + * + * if extra_date_formats is not None: + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * sas_date_formats.extend(extra_date_formats) + * elif file_format == FILE_FORMAT_SPSS: + */ + switch (__pyx_v_file_format) { + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: + + /* "pyreadstat/_readstat_parser.pyx":1075 + * if extra_date_formats is not None: + * if file_format == FILE_FORMAT_SAS: + * sas_date_formats.extend(extra_date_formats) # <<<<<<<<<<<<<< + * elif file_format == FILE_FORMAT_SPSS: + * spss_date_formats.extend(extra_date_formats) + */ + if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 1075, __pyx_L1_error) + } + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, __pyx_v_extra_date_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1075, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1074 + * + * if extra_date_formats is not None: + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * sas_date_formats.extend(extra_date_formats) + * elif file_format == FILE_FORMAT_SPSS: + */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: + + /* "pyreadstat/_readstat_parser.pyx":1077 + * sas_date_formats.extend(extra_date_formats) + * elif file_format == FILE_FORMAT_SPSS: + * spss_date_formats.extend(extra_date_formats) # <<<<<<<<<<<<<< + * elif file_format == FILE_FORMAT_STATA: + * stata_date_formats.extend(extra_date_formats) + */ + if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 1077, __pyx_L1_error) + } + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, __pyx_v_extra_date_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1077, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1076 + * if file_format == FILE_FORMAT_SAS: + * sas_date_formats.extend(extra_date_formats) + * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< + * spss_date_formats.extend(extra_date_formats) + * elif file_format == FILE_FORMAT_STATA: + */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: + + /* "pyreadstat/_readstat_parser.pyx":1079 + * spss_date_formats.extend(extra_date_formats) + * elif file_format == FILE_FORMAT_STATA: + * stata_date_formats.extend(extra_date_formats) # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("Unknown file format") + */ + if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 1079, __pyx_L1_error) + } + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, __pyx_v_extra_date_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1079, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1078 + * elif file_format == FILE_FORMAT_SPSS: + * spss_date_formats.extend(extra_date_formats) + * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * stata_date_formats.extend(extra_date_formats) + * else: + */ + break; + default: + + /* "pyreadstat/_readstat_parser.pyx":1081 + * stata_date_formats.extend(extra_date_formats) + * else: + * raise PyreadstatError("Unknown file format") # <<<<<<<<<<<<<< + * if extra_datetime_formats is not None: + * if file_format == FILE_FORMAT_SAS: + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1081, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_kp_s_Unknown_file_format}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1081, __pyx_L1_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, 1081, __pyx_L1_error) + break; + } + + /* "pyreadstat/_readstat_parser.pyx":1073 + * raise PyreadstatError("output format must be one of {allowed_formats}, '{output_format}' was given".format(allowed_formats=allowed_formats, output_format=output_format)) + * + * if extra_date_formats is not None: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_SAS: + * sas_date_formats.extend(extra_date_formats) + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1082 + * else: + * raise PyreadstatError("Unknown file format") + * if extra_datetime_formats is not None: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_SAS: + * sas_datetime_formats.extend(extra_datetime_formats) + */ + __pyx_t_2 = (__pyx_v_extra_datetime_formats != ((PyObject*)Py_None)); + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1083 + * raise PyreadstatError("Unknown file format") + * if extra_datetime_formats is not None: + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * sas_datetime_formats.extend(extra_datetime_formats) + * elif file_format == FILE_FORMAT_SPSS: + */ + switch (__pyx_v_file_format) { + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: + + /* "pyreadstat/_readstat_parser.pyx":1084 + * if extra_datetime_formats is not None: + * if file_format == FILE_FORMAT_SAS: + * sas_datetime_formats.extend(extra_datetime_formats) # <<<<<<<<<<<<<< + * elif file_format == FILE_FORMAT_SPSS: + * spss_datetime_formats.extend(extra_datetime_formats) + */ + if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 1084, __pyx_L1_error) + } + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats, __pyx_v_extra_datetime_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1084, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1083 + * raise PyreadstatError("Unknown file format") + * if extra_datetime_formats is not None: + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * sas_datetime_formats.extend(extra_datetime_formats) + * elif file_format == FILE_FORMAT_SPSS: + */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: + + /* "pyreadstat/_readstat_parser.pyx":1086 + * sas_datetime_formats.extend(extra_datetime_formats) + * elif file_format == FILE_FORMAT_SPSS: + * spss_datetime_formats.extend(extra_datetime_formats) # <<<<<<<<<<<<<< + * elif file_format == FILE_FORMAT_STATA: + * stata_datetime_formats.extend(extra_datetime_formats) + */ + if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 1086, __pyx_L1_error) + } + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats, __pyx_v_extra_datetime_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1086, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1085 + * if file_format == FILE_FORMAT_SAS: + * sas_datetime_formats.extend(extra_datetime_formats) + * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< + * spss_datetime_formats.extend(extra_datetime_formats) + * elif file_format == FILE_FORMAT_STATA: + */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: + + /* "pyreadstat/_readstat_parser.pyx":1088 + * spss_datetime_formats.extend(extra_datetime_formats) + * elif file_format == FILE_FORMAT_STATA: + * stata_datetime_formats.extend(extra_datetime_formats) # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("Unknown file format") + */ + if (unlikely(__pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend"); + __PYX_ERR(0, 1088, __pyx_L1_error) + } + __pyx_t_15 = __Pyx_PyList_Extend(__pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats, __pyx_v_extra_datetime_formats); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 1088, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1087 + * elif file_format == FILE_FORMAT_SPSS: + * spss_datetime_formats.extend(extra_datetime_formats) + * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * stata_datetime_formats.extend(extra_datetime_formats) + * else: + */ + break; + default: + + /* "pyreadstat/_readstat_parser.pyx":1090 + * stata_datetime_formats.extend(extra_datetime_formats) + * else: + * raise PyreadstatError("Unknown file format") # <<<<<<<<<<<<<< + * global sas_all_formats, spss_all_formats, stata_all_formats + * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1090, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_kp_s_Unknown_file_format}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_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, 1090, __pyx_L1_error) + break; + } + + /* "pyreadstat/_readstat_parser.pyx":1082 + * else: + * raise PyreadstatError("Unknown file format") + * if extra_datetime_formats is not None: # <<<<<<<<<<<<<< + * if file_format == FILE_FORMAT_SAS: + * sas_datetime_formats.extend(extra_datetime_formats) + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1092 + * raise PyreadstatError("Unknown file format") + * global sas_all_formats, spss_all_formats, stata_all_formats + * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats # <<<<<<<<<<<<<< + * stata_all_formats = stata_date_formats + stata_datetime_formats + stata_time_formats + * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats + */ + __pyx_t_6 = PyNumber_Add(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, __pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1092, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_v_10pyreadstat_16_readstat_parser_sas_time_formats); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1092, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_all_formats); + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_all_formats, ((PyObject*)__pyx_t_7)); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1093 + * global sas_all_formats, spss_all_formats, stata_all_formats + * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats + * stata_all_formats = stata_date_formats + stata_datetime_formats + stata_time_formats # <<<<<<<<<<<<<< + * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats + * + */ + __pyx_t_7 = PyNumber_Add(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, __pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyNumber_Add(__pyx_t_7, __pyx_v_10pyreadstat_16_readstat_parser_stata_time_formats); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1093, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_all_formats); + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_all_formats, ((PyObject*)__pyx_t_6)); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1094 + * sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats + * stata_all_formats = stata_date_formats + stata_datetime_formats + stata_time_formats + * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats # <<<<<<<<<<<<<< + * + * filename = filename_bytes + */ + __pyx_t_6 = PyNumber_Add(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, __pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1094, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_v_10pyreadstat_16_readstat_parser_spss_time_formats); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1094, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_all_formats); + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_all_formats, ((PyObject*)__pyx_t_7)); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1096 + * spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats + * + * filename = filename_bytes # <<<<<<<<<<<<<< + * + * data = data_container() + */ + if (unlikely(__pyx_v_filename_bytes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); + __PYX_ERR(0, 1096, __pyx_L1_error) + } + __pyx_t_16 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename_bytes); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) __PYX_ERR(0, 1096, __pyx_L1_error) + __pyx_v_filename = ((char *)__pyx_t_16); + + /* "pyreadstat/_readstat_parser.pyx":1098 + * filename = filename_bytes + * + * data = data_container() # <<<<<<<<<<<<<< + * ctx = data + * + */ + __pyx_t_7 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10pyreadstat_16_readstat_parser_data_container)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1098, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_data = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)__pyx_t_7); + __pyx_t_7 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1099 + * + * data = data_container() + * ctx = data # <<<<<<<<<<<<<< + * + * data.file_format = file_format + */ + __pyx_v_ctx = ((void *)__pyx_v_data); + + /* "pyreadstat/_readstat_parser.pyx":1101 + * ctx = data + * + * data.file_format = file_format # <<<<<<<<<<<<<< + * data.metaonly = metaonly + * data.dates_as_pandas = dates_as_pandas + */ + __pyx_v_data->file_format = __pyx_v_file_format; + + /* "pyreadstat/_readstat_parser.pyx":1102 + * + * data.file_format = file_format + * data.metaonly = metaonly # <<<<<<<<<<<<<< + * data.dates_as_pandas = dates_as_pandas + * + */ + __pyx_v_data->metaonly = __pyx_v_metaonly; + + /* "pyreadstat/_readstat_parser.pyx":1103 + * data.file_format = file_format + * data.metaonly = metaonly + * data.dates_as_pandas = dates_as_pandas # <<<<<<<<<<<<<< + * + * if encoding: + */ + __pyx_v_data->dates_as_pandas = __pyx_v_dates_as_pandas; + + /* "pyreadstat/_readstat_parser.pyx":1105 + * data.dates_as_pandas = dates_as_pandas + * + * if encoding: # <<<<<<<<<<<<<< + * data.user_encoding = encoding + * + */ + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1105, __pyx_L1_error) + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1106 + * + * if encoding: + * data.user_encoding = encoding # <<<<<<<<<<<<<< + * + * if file_format == FILE_FORMAT_SAS: + */ + __Pyx_INCREF(__pyx_v_encoding); + __Pyx_GIVEREF(__pyx_v_encoding); + __Pyx_GOTREF(__pyx_v_data->user_encoding); + __Pyx_DECREF(__pyx_v_data->user_encoding); + __pyx_v_data->user_encoding = __pyx_v_encoding; + + /* "pyreadstat/_readstat_parser.pyx":1105 + * data.dates_as_pandas = dates_as_pandas + * + * if encoding: # <<<<<<<<<<<<<< + * data.user_encoding = encoding + * + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1108 + * data.user_encoding = encoding + * + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * origin = sas_origin + * elif file_format == FILE_FORMAT_SPSS: + */ + switch (__pyx_v_file_format) { + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS: + + /* "pyreadstat/_readstat_parser.pyx":1109 + * + * if file_format == FILE_FORMAT_SAS: + * origin = sas_origin # <<<<<<<<<<<<<< + * elif file_format == FILE_FORMAT_SPSS: + * origin = spss_origin + */ + __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_origin); + __pyx_v_origin = __pyx_v_10pyreadstat_16_readstat_parser_sas_origin; + + /* "pyreadstat/_readstat_parser.pyx":1108 + * data.user_encoding = encoding + * + * if file_format == FILE_FORMAT_SAS: # <<<<<<<<<<<<<< + * origin = sas_origin + * elif file_format == FILE_FORMAT_SPSS: + */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS: + + /* "pyreadstat/_readstat_parser.pyx":1111 + * origin = sas_origin + * elif file_format == FILE_FORMAT_SPSS: + * origin = spss_origin # <<<<<<<<<<<<<< + * elif file_format == FILE_FORMAT_STATA: + * origin = stata_origin + */ + __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_origin); + __pyx_v_origin = __pyx_v_10pyreadstat_16_readstat_parser_spss_origin; + + /* "pyreadstat/_readstat_parser.pyx":1110 + * if file_format == FILE_FORMAT_SAS: + * origin = sas_origin + * elif file_format == FILE_FORMAT_SPSS: # <<<<<<<<<<<<<< + * origin = spss_origin + * elif file_format == FILE_FORMAT_STATA: + */ + break; + case __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA: + + /* "pyreadstat/_readstat_parser.pyx":1113 + * origin = spss_origin + * elif file_format == FILE_FORMAT_STATA: + * origin = stata_origin # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("Unknown file format") + */ + __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_origin); + __pyx_v_origin = __pyx_v_10pyreadstat_16_readstat_parser_stata_origin; + + /* "pyreadstat/_readstat_parser.pyx":1112 + * elif file_format == FILE_FORMAT_SPSS: + * origin = spss_origin + * elif file_format == FILE_FORMAT_STATA: # <<<<<<<<<<<<<< + * origin = stata_origin + * else: + */ + break; + default: + + /* "pyreadstat/_readstat_parser.pyx":1115 + * origin = stata_origin + * else: + * raise PyreadstatError("Unknown file format") # <<<<<<<<<<<<<< + * + * data.origin = origin + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_kp_s_Unknown_file_format}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __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, 1115, __pyx_L1_error) + break; + } + + /* "pyreadstat/_readstat_parser.pyx":1117 + * raise PyreadstatError("Unknown file format") + * + * data.origin = origin # <<<<<<<<<<<<<< + * + * if usecols is not None: + */ + __Pyx_INCREF(__pyx_v_origin); + __Pyx_GIVEREF(__pyx_v_origin); + __Pyx_GOTREF(__pyx_v_data->origin); + __Pyx_DECREF(__pyx_v_data->origin); + __pyx_v_data->origin = __pyx_v_origin; + + /* "pyreadstat/_readstat_parser.pyx":1119 + * data.origin = origin + * + * if usecols is not None: # <<<<<<<<<<<<<< + * data.filter_cols = 1 + * data.use_cols = usecols + */ + __pyx_t_2 = (__pyx_v_usecols != ((PyObject*)Py_None)); + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1120 + * + * if usecols is not None: + * data.filter_cols = 1 # <<<<<<<<<<<<<< + * data.use_cols = usecols + * + */ + __pyx_v_data->filter_cols = 1; + + /* "pyreadstat/_readstat_parser.pyx":1121 + * if usecols is not None: + * data.filter_cols = 1 + * data.use_cols = usecols # <<<<<<<<<<<<<< + * + * data.usernan = usernan + */ + __Pyx_INCREF(__pyx_v_usecols); + __Pyx_GIVEREF(__pyx_v_usecols); + __Pyx_GOTREF(__pyx_v_data->use_cols); + __Pyx_DECREF(__pyx_v_data->use_cols); + __pyx_v_data->use_cols = __pyx_v_usecols; + + /* "pyreadstat/_readstat_parser.pyx":1119 + * data.origin = origin + * + * if usecols is not None: # <<<<<<<<<<<<<< + * data.filter_cols = 1 + * data.use_cols = usecols + */ + } + + /* "pyreadstat/_readstat_parser.pyx":1123 + * data.use_cols = usecols + * + * data.usernan = usernan # <<<<<<<<<<<<<< + * data.no_datetime_conversion = no_datetime_conversion + * + */ + __pyx_v_data->usernan = __pyx_v_usernan; + + /* "pyreadstat/_readstat_parser.pyx":1124 + * + * data.usernan = usernan + * data.no_datetime_conversion = no_datetime_conversion # <<<<<<<<<<<<<< + * + * # go! + */ + __pyx_v_data->no_datetime_conversion = __pyx_v_no_datetime_conversion; + + /* "pyreadstat/_readstat_parser.pyx":1127 + * + * # go! + * run_readstat_parser(filename, data, file_extension, row_limit, row_offset) # <<<<<<<<<<<<<< + * data_dict = data_container_to_dict(data) + * if output_format == 'dict': + */ + __pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser(__pyx_v_filename, __pyx_v_data, __pyx_v_file_extension, __pyx_v_row_limit, __pyx_v_row_offset); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1127, __pyx_L1_error) + + /* "pyreadstat/_readstat_parser.pyx":1128 + * # go! + * run_readstat_parser(filename, data, file_extension, row_limit, row_offset) + * data_dict = data_container_to_dict(data) # <<<<<<<<<<<<<< + * if output_format == 'dict': + * data_frame = data_dict + */ + __pyx_t_7 = __pyx_f_10pyreadstat_16_readstat_parser_data_container_to_dict(__pyx_v_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_data_dict = __pyx_t_7; + __pyx_t_7 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1129 + * run_readstat_parser(filename, data, file_extension, row_limit, row_offset) + * data_dict = data_container_to_dict(data) + * if output_format == 'dict': # <<<<<<<<<<<<<< + * data_frame = data_dict + * elif output_format == 'pandas': + */ + __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_output_format, __pyx_n_s_dict, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1129, __pyx_L1_error) + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1130 + * data_dict = data_container_to_dict(data) + * if output_format == 'dict': + * data_frame = data_dict # <<<<<<<<<<<<<< + * elif output_format == 'pandas': + * data_frame = dict_to_pandas_dataframe(data_dict, data) + */ + __Pyx_INCREF(__pyx_v_data_dict); + __pyx_v_data_frame = __pyx_v_data_dict; + + /* "pyreadstat/_readstat_parser.pyx":1129 + * run_readstat_parser(filename, data, file_extension, row_limit, row_offset) + * data_dict = data_container_to_dict(data) + * if output_format == 'dict': # <<<<<<<<<<<<<< + * data_frame = data_dict + * elif output_format == 'pandas': + */ + goto __pyx_L24; + } + + /* "pyreadstat/_readstat_parser.pyx":1131 + * if output_format == 'dict': + * data_frame = data_dict + * elif output_format == 'pandas': # <<<<<<<<<<<<<< + * data_frame = dict_to_pandas_dataframe(data_dict, data) + * metadata = data_container_extract_metadata(data) + */ + __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_output_format, __pyx_n_s_pandas, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1131, __pyx_L1_error) + if (__pyx_t_2) { + + /* "pyreadstat/_readstat_parser.pyx":1132 + * data_frame = data_dict + * elif output_format == 'pandas': + * data_frame = dict_to_pandas_dataframe(data_dict, data) # <<<<<<<<<<<<<< + * metadata = data_container_extract_metadata(data) + * + */ + __pyx_t_7 = __pyx_f_10pyreadstat_16_readstat_parser_dict_to_pandas_dataframe(__pyx_v_data_dict, __pyx_v_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_data_frame = __pyx_t_7; + __pyx_t_7 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1131 + * if output_format == 'dict': + * data_frame = data_dict + * elif output_format == 'pandas': # <<<<<<<<<<<<<< + * data_frame = dict_to_pandas_dataframe(data_dict, data) + * metadata = data_container_extract_metadata(data) + */ + } + __pyx_L24:; + + /* "pyreadstat/_readstat_parser.pyx":1133 + * elif output_format == 'pandas': + * data_frame = dict_to_pandas_dataframe(data_dict, data) + * metadata = data_container_extract_metadata(data) # <<<<<<<<<<<<<< + * + * return data_frame, metadata + */ + __pyx_t_7 = __pyx_f_10pyreadstat_16_readstat_parser_data_container_extract_metadata(__pyx_v_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_metadata = __pyx_t_7; + __pyx_t_7 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1135 + * metadata = data_container_extract_metadata(data) + * + * return data_frame, metadata # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_v_data_frame)) { __Pyx_RaiseUnboundLocalError("data_frame"); __PYX_ERR(0, 1135, __pyx_L1_error) } + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_data_frame); + __Pyx_GIVEREF(__pyx_v_data_frame); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_data_frame); + __Pyx_INCREF(__pyx_v_metadata); + __Pyx_GIVEREF(__pyx_v_metadata); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_metadata); + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; + goto __pyx_L0; + + /* "pyreadstat/_readstat_parser.pyx":1028 + * + * + * cdef object run_conversion(object filename_path, py_file_format file_format, py_file_extension file_extension, # <<<<<<<<<<<<<< + * str encoding, bint metaonly, bint dates_as_pandas, list usecols, bint usernan, + * bint no_datetime_conversion, long row_limit, long row_offset, str output_format, + */ + + /* 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_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("pyreadstat._readstat_parser.run_conversion", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_filename_bytes); + __Pyx_XDECREF((PyObject *)__pyx_v_data); + __Pyx_XDECREF(__pyx_v_origin); + __Pyx_XDECREF(__pyx_v_allowed_formats); + __Pyx_XDECREF(__pyx_v_data_dict); + __Pyx_XDECREF(__pyx_v_data_frame); + __Pyx_XDECREF(__pyx_v_metadata); + __Pyx_XDECREF(__pyx_v_output_format); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_10pyreadstat_16_readstat_parser_data_container(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *p; + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + p = ((struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)o); + p->col_data = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_data_len = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_names = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_labels = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_numpy_dtypes = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_dtypes_isobject = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_dytpes_isfloat = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_formats = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->col_formats_original = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->origin = Py_None; Py_INCREF(Py_None); + p->file_label = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->file_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->label_to_var_name = Py_None; Py_INCREF(Py_None); + p->labels_raw = Py_None; Py_INCREF(Py_None); + p->notes = Py_None; Py_INCREF(Py_None); + p->user_encoding = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->table_name = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->use_cols = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->missing_ranges = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->missing_user_values = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->variable_storage_width = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->variable_display_width = Py_None; Py_INCREF(Py_None); + p->variable_alignment = Py_None; Py_INCREF(Py_None); + p->variable_measure = Py_None; Py_INCREF(Py_None); + if (unlikely(__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_10pyreadstat_16_readstat_parser_data_container(PyObject *o) { + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *p = (struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_10pyreadstat_16_readstat_parser_data_container) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->col_data); + Py_CLEAR(p->col_data_len); + Py_CLEAR(p->col_names); + Py_CLEAR(p->col_labels); + Py_CLEAR(p->col_dtypes); + Py_CLEAR(p->col_numpy_dtypes); + Py_CLEAR(p->col_dtypes_isobject); + Py_CLEAR(p->col_dytpes_isfloat); + Py_CLEAR(p->col_formats); + Py_CLEAR(p->col_formats_original); + Py_CLEAR(p->origin); + Py_CLEAR(p->file_label); + Py_CLEAR(p->file_encoding); + Py_CLEAR(p->label_to_var_name); + Py_CLEAR(p->labels_raw); + Py_CLEAR(p->notes); + Py_CLEAR(p->user_encoding); + Py_CLEAR(p->table_name); + Py_CLEAR(p->use_cols); + Py_CLEAR(p->missing_ranges); + Py_CLEAR(p->missing_user_values); + Py_CLEAR(p->variable_storage_width); + Py_CLEAR(p->variable_display_width); + Py_CLEAR(p->variable_alignment); + Py_CLEAR(p->variable_measure); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_10pyreadstat_16_readstat_parser_data_container(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *p = (struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)o; + if (p->col_data) { + e = (*v)(p->col_data, a); if (e) return e; + } + if (p->col_data_len) { + e = (*v)(p->col_data_len, a); if (e) return e; + } + if (p->col_names) { + e = (*v)(p->col_names, a); if (e) return e; + } + if (p->col_labels) { + e = (*v)(p->col_labels, a); if (e) return e; + } + if (p->col_dtypes) { + e = (*v)(p->col_dtypes, a); if (e) return e; + } + if (p->col_numpy_dtypes) { + e = (*v)(p->col_numpy_dtypes, a); if (e) return e; + } + if (p->col_dtypes_isobject) { + e = (*v)(p->col_dtypes_isobject, a); if (e) return e; + } + if (p->col_dytpes_isfloat) { + e = (*v)(p->col_dytpes_isfloat, a); if (e) return e; + } + if (p->col_formats) { + e = (*v)(p->col_formats, a); if (e) return e; + } + if (p->col_formats_original) { e = (*v)(p->col_formats_original, a); if (e) return e; } if (p->origin) { @@ -13636,14 +17305,32 @@ static int __pyx_tp_clear_10pyreadstat_16_readstat_parser_data_container(PyObjec } static PyMethodDef __pyx_methods_10pyreadstat_16_readstat_parser_data_container[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_10pyreadstat_16_readstat_parser_data_container_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_10pyreadstat_16_readstat_parser_data_container}, + {Py_tp_doc, (void *)PyDoc_STR("\n This extension type holds all the data we need to get from our file from \n the readstat parser and will be used later to compose our pandas data frame\n ")}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_10pyreadstat_16_readstat_parser_data_container}, + {Py_tp_clear, (void *)__pyx_tp_clear_10pyreadstat_16_readstat_parser_data_container}, + {Py_tp_methods, (void *)__pyx_methods_10pyreadstat_16_readstat_parser_data_container}, + {Py_tp_new, (void *)__pyx_tp_new_10pyreadstat_16_readstat_parser_data_container}, + {0, 0}, +}; +static PyType_Spec __pyx_type_10pyreadstat_16_readstat_parser_data_container_spec = { + "pyreadstat._readstat_parser.data_container", + sizeof(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, + __pyx_type_10pyreadstat_16_readstat_parser_data_container_slots, +}; +#else static PyTypeObject __pyx_type_10pyreadstat_16_readstat_parser_data_container = { PyVarObject_HEAD_INIT(0, 0) - "pyreadstat._readstat_parser.data_container", /*tp_name*/ + "pyreadstat._readstat_parser.""data_container", /*tp_name*/ sizeof(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_10pyreadstat_16_readstat_parser_data_container, /*tp_dealloc*/ @@ -13672,7 +17359,7 @@ static PyTypeObject __pyx_type_10pyreadstat_16_readstat_parser_data_container = 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*/ - "\n This extension type holds all the data we need to get from our file from \n the readstat parser and will be used later to compose our pandas data frame\n ", /*tp_doc*/ + PyDoc_STR("\n This extension type holds all the data we need to get from our file from \n the readstat parser and will be used later to compose our pandas data frame\n "), /*tp_doc*/ __pyx_tp_traverse_10pyreadstat_16_readstat_parser_data_container, /*tp_traverse*/ __pyx_tp_clear_10pyreadstat_16_readstat_parser_data_container, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -13686,7 +17373,9 @@ static PyTypeObject __pyx_type_10pyreadstat_16_readstat_parser_data_container = 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_10pyreadstat_16_readstat_parser_data_container, /*tp_new*/ @@ -13700,51 +17389,30 @@ static PyTypeObject __pyx_type_10pyreadstat_16_readstat_parser_data_container = 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ #endif - #if PY_VERSION_HEX >= 0x030800b1 + #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 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif }; +#endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec__readstat_parser(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec__readstat_parser}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "_readstat_parser", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -13754,289 +17422,312 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_ADATE, __pyx_k_ADATE, sizeof(__pyx_k_ADATE), 0, 0, 1, 1}, - {&__pyx_n_s_ADATE10, __pyx_k_ADATE10, sizeof(__pyx_k_ADATE10), 0, 0, 1, 1}, - {&__pyx_n_s_ADATE8, __pyx_k_ADATE8, sizeof(__pyx_k_ADATE8), 0, 0, 1, 1}, - {&__pyx_n_s_B8601DA, __pyx_k_B8601DA, sizeof(__pyx_k_B8601DA), 0, 0, 1, 1}, - {&__pyx_n_s_B8601DN, __pyx_k_B8601DN, sizeof(__pyx_k_B8601DN), 0, 0, 1, 1}, - {&__pyx_n_s_B8601DT, __pyx_k_B8601DT, sizeof(__pyx_k_B8601DT), 0, 0, 1, 1}, - {&__pyx_n_s_B8601TM, __pyx_k_B8601TM, sizeof(__pyx_k_B8601TM), 0, 0, 1, 1}, - {&__pyx_n_s_DATE, __pyx_k_DATE, sizeof(__pyx_k_DATE), 0, 0, 1, 1}, - {&__pyx_n_s_DATE11, __pyx_k_DATE11, sizeof(__pyx_k_DATE11), 0, 0, 1, 1}, - {&__pyx_n_s_DATE12, __pyx_k_DATE12, sizeof(__pyx_k_DATE12), 0, 0, 1, 1}, - {&__pyx_n_s_DATE8, __pyx_k_DATE8, sizeof(__pyx_k_DATE8), 0, 0, 1, 1}, - {&__pyx_n_s_DATE9, __pyx_k_DATE9, sizeof(__pyx_k_DATE9), 0, 0, 1, 1}, - {&__pyx_n_s_DATEAMPM, __pyx_k_DATEAMPM, sizeof(__pyx_k_DATEAMPM), 0, 0, 1, 1}, - {&__pyx_n_s_DATETIME, __pyx_k_DATETIME, sizeof(__pyx_k_DATETIME), 0, 0, 1, 1}, - {&__pyx_n_s_DATETIME17, __pyx_k_DATETIME17, sizeof(__pyx_k_DATETIME17), 0, 0, 1, 1}, - {&__pyx_n_s_DATETIME18, __pyx_k_DATETIME18, sizeof(__pyx_k_DATETIME18), 0, 0, 1, 1}, - {&__pyx_n_s_DATETIME19, __pyx_k_DATETIME19, sizeof(__pyx_k_DATETIME19), 0, 0, 1, 1}, - {&__pyx_n_s_DATETIME20, __pyx_k_DATETIME20, sizeof(__pyx_k_DATETIME20), 0, 0, 1, 1}, - {&__pyx_n_s_DATETIME21, __pyx_k_DATETIME21, sizeof(__pyx_k_DATETIME21), 0, 0, 1, 1}, - {&__pyx_n_s_DATETIME22, __pyx_k_DATETIME22, sizeof(__pyx_k_DATETIME22), 0, 0, 1, 1}, - {&__pyx_kp_s_DATETIME23_2, __pyx_k_DATETIME23_2, sizeof(__pyx_k_DATETIME23_2), 0, 0, 1, 0}, - {&__pyx_n_s_DATETIME8, __pyx_k_DATETIME8, sizeof(__pyx_k_DATETIME8), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYY, __pyx_k_DDMMYY, sizeof(__pyx_k_DDMMYY), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYB, __pyx_k_DDMMYYB, sizeof(__pyx_k_DDMMYYB), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYB10, __pyx_k_DDMMYYB10, sizeof(__pyx_k_DDMMYYB10), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYC, __pyx_k_DDMMYYC, sizeof(__pyx_k_DDMMYYC), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYC10, __pyx_k_DDMMYYC10, sizeof(__pyx_k_DDMMYYC10), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYD, __pyx_k_DDMMYYD, sizeof(__pyx_k_DDMMYYD), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYD10, __pyx_k_DDMMYYD10, sizeof(__pyx_k_DDMMYYD10), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYN6, __pyx_k_DDMMYYN6, sizeof(__pyx_k_DDMMYYN6), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYN8, __pyx_k_DDMMYYN8, sizeof(__pyx_k_DDMMYYN8), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYP, __pyx_k_DDMMYYP, sizeof(__pyx_k_DDMMYYP), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYP10, __pyx_k_DDMMYYP10, sizeof(__pyx_k_DDMMYYP10), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYS, __pyx_k_DDMMYYS, sizeof(__pyx_k_DDMMYYS), 0, 0, 1, 1}, - {&__pyx_n_s_DDMMYYS10, __pyx_k_DDMMYYS10, sizeof(__pyx_k_DDMMYYS10), 0, 0, 1, 1}, - {&__pyx_n_s_DTDATE, __pyx_k_DTDATE, sizeof(__pyx_k_DTDATE), 0, 0, 1, 1}, - {&__pyx_n_s_DTIME, __pyx_k_DTIME, sizeof(__pyx_k_DTIME), 0, 0, 1, 1}, - {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1}, - {&__pyx_n_s_E8601DA, __pyx_k_E8601DA, sizeof(__pyx_k_E8601DA), 0, 0, 1, 1}, - {&__pyx_n_s_E8601DT, __pyx_k_E8601DT, sizeof(__pyx_k_E8601DT), 0, 0, 1, 1}, - {&__pyx_n_s_E8601TM, __pyx_k_E8601TM, sizeof(__pyx_k_E8601TM), 0, 0, 1, 1}, - {&__pyx_n_s_EDATE, __pyx_k_EDATE, sizeof(__pyx_k_EDATE), 0, 0, 1, 1}, - {&__pyx_n_s_EDATE10, __pyx_k_EDATE10, sizeof(__pyx_k_EDATE10), 0, 0, 1, 1}, - {&__pyx_n_s_EDATE8, __pyx_k_EDATE8, sizeof(__pyx_k_EDATE8), 0, 0, 1, 1}, - {&__pyx_kp_s_Failed_convert_C_to_python_value, __pyx_k_Failed_convert_C_to_python_value, sizeof(__pyx_k_Failed_convert_C_to_python_value), 0, 0, 1, 0}, - {&__pyx_kp_s_Failed_to_read_number_of_variabl, __pyx_k_Failed_to_read_number_of_variabl, sizeof(__pyx_k_Failed_to_read_number_of_variabl), 0, 0, 1, 0}, - {&__pyx_kp_s_File_0_does_not_exist, __pyx_k_File_0_does_not_exist, sizeof(__pyx_k_File_0_does_not_exist), 0, 0, 1, 0}, - {&__pyx_n_s_HHMM, __pyx_k_HHMM, sizeof(__pyx_k_HHMM), 0, 0, 1, 1}, - {&__pyx_n_s_IS8601DA, __pyx_k_IS8601DA, sizeof(__pyx_k_IS8601DA), 0, 0, 1, 1}, - {&__pyx_n_s_IS8601DT, __pyx_k_IS8601DT, sizeof(__pyx_k_IS8601DT), 0, 0, 1, 1}, - {&__pyx_n_s_IS8601TM, __pyx_k_IS8601TM, sizeof(__pyx_k_IS8601TM), 0, 0, 1, 1}, - {&__pyx_n_s_JDATE, __pyx_k_JDATE, sizeof(__pyx_k_JDATE), 0, 0, 1, 1}, - {&__pyx_n_s_JDATE5, __pyx_k_JDATE5, sizeof(__pyx_k_JDATE5), 0, 0, 1, 1}, - {&__pyx_n_s_JDATE7, __pyx_k_JDATE7, sizeof(__pyx_k_JDATE7), 0, 0, 1, 1}, - {&__pyx_kp_s_Just_defining_a_custom_exceptio, __pyx_k_Just_defining_a_custom_exceptio, sizeof(__pyx_k_Just_defining_a_custom_exceptio), 0, 0, 1, 0}, - {&__pyx_kp_s_Just_defining_a_custom_exceptio_2, __pyx_k_Just_defining_a_custom_exceptio_2, sizeof(__pyx_k_Just_defining_a_custom_exceptio_2), 0, 0, 1, 0}, - {&__pyx_kp_s_M8_ns, __pyx_k_M8_ns, sizeof(__pyx_k_M8_ns), 0, 0, 1, 0}, - {&__pyx_n_s_MDYAMPM, __pyx_k_MDYAMPM, sizeof(__pyx_k_MDYAMPM), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYY, __pyx_k_MMDDYY, sizeof(__pyx_k_MMDDYY), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYB, __pyx_k_MMDDYYB, sizeof(__pyx_k_MMDDYYB), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYB10, __pyx_k_MMDDYYB10, sizeof(__pyx_k_MMDDYYB10), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYC, __pyx_k_MMDDYYC, sizeof(__pyx_k_MMDDYYC), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYC10, __pyx_k_MMDDYYC10, sizeof(__pyx_k_MMDDYYC10), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYD, __pyx_k_MMDDYYD, sizeof(__pyx_k_MMDDYYD), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYD10, __pyx_k_MMDDYYD10, sizeof(__pyx_k_MMDDYYD10), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYN6, __pyx_k_MMDDYYN6, sizeof(__pyx_k_MMDDYYN6), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYN8, __pyx_k_MMDDYYN8, sizeof(__pyx_k_MMDDYYN8), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYP, __pyx_k_MMDDYYP, sizeof(__pyx_k_MMDDYYP), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYP10, __pyx_k_MMDDYYP10, sizeof(__pyx_k_MMDDYYP10), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYS, __pyx_k_MMDDYYS, sizeof(__pyx_k_MMDDYYS), 0, 0, 1, 1}, - {&__pyx_n_s_MMDDYYS10, __pyx_k_MMDDYYS10, sizeof(__pyx_k_MMDDYYS10), 0, 0, 1, 1}, - {&__pyx_n_s_NULL, __pyx_k_NULL, sizeof(__pyx_k_NULL), 0, 0, 1, 1}, - {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1}, - {&__pyx_n_s_PyreadstatError, __pyx_k_PyreadstatError, sizeof(__pyx_k_PyreadstatError), 0, 0, 1, 1}, - {&__pyx_n_s_ReadstatError, __pyx_k_ReadstatError, sizeof(__pyx_k_ReadstatError), 0, 0, 1, 1}, - {&__pyx_n_s_SDATE, __pyx_k_SDATE, sizeof(__pyx_k_SDATE), 0, 0, 1, 1}, - {&__pyx_n_s_SDATE10, __pyx_k_SDATE10, sizeof(__pyx_k_SDATE10), 0, 0, 1, 1}, - {&__pyx_n_s_SDATE8, __pyx_k_SDATE8, sizeof(__pyx_k_SDATE8), 0, 0, 1, 1}, - {&__pyx_kp_s_STRING_type_with_value_s_with_da, __pyx_k_STRING_type_with_value_s_with_da, sizeof(__pyx_k_STRING_type_with_value_s_with_da), 0, 0, 1, 0}, - {&__pyx_n_s_TIME, __pyx_k_TIME, sizeof(__pyx_k_TIME), 0, 0, 1, 1}, - {&__pyx_kp_s_TIME11_2, __pyx_k_TIME11_2, sizeof(__pyx_k_TIME11_2), 0, 0, 1, 0}, - {&__pyx_n_s_TIME20, __pyx_k_TIME20, sizeof(__pyx_k_TIME20), 0, 0, 1, 1}, - {&__pyx_kp_s_TIME20_3, __pyx_k_TIME20_3, sizeof(__pyx_k_TIME20_3), 0, 0, 1, 0}, - {&__pyx_n_s_TIME5, __pyx_k_TIME5, sizeof(__pyx_k_TIME5), 0, 0, 1, 1}, - {&__pyx_n_s_TIME8, __pyx_k_TIME8, sizeof(__pyx_k_TIME8), 0, 0, 1, 1}, - {&__pyx_n_s_TIMEAMPM, __pyx_k_TIMEAMPM, sizeof(__pyx_k_TIMEAMPM), 0, 0, 1, 1}, - {&__pyx_n_s_TOD, __pyx_k_TOD, sizeof(__pyx_k_TOD), 0, 0, 1, 1}, - {&__pyx_kp_s_This_class_holds_metadata_we_wa, __pyx_k_This_class_holds_metadata_we_wa, sizeof(__pyx_k_This_class_holds_metadata_we_wa), 0, 0, 1, 0}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_n_s_UnicodeError, __pyx_k_UnicodeError, sizeof(__pyx_k_UnicodeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unknown_file_format, __pyx_k_Unknown_file_format, sizeof(__pyx_k_Unknown_file_format), 0, 0, 1, 0}, - {&__pyx_kp_s_Unkown_data_type, __pyx_k_Unkown_data_type, sizeof(__pyx_k_Unkown_data_type), 0, 0, 1, 0}, - {&__pyx_n_s_WEEKDATE, __pyx_k_WEEKDATE, sizeof(__pyx_k_WEEKDATE), 0, 0, 1, 1}, - {&__pyx_n_s_WEEKDATX, __pyx_k_WEEKDATX, sizeof(__pyx_k_WEEKDATX), 0, 0, 1, 1}, - {&__pyx_n_s_YMDHMS16, __pyx_k_YMDHMS16, sizeof(__pyx_k_YMDHMS16), 0, 0, 1, 1}, - {&__pyx_n_s_YMDHMS19, __pyx_k_YMDHMS19, sizeof(__pyx_k_YMDHMS19), 0, 0, 1, 1}, - {&__pyx_kp_s_YMDHMS19_2, __pyx_k_YMDHMS19_2, sizeof(__pyx_k_YMDHMS19_2), 0, 0, 1, 0}, - {&__pyx_n_s_YMDHMS20, __pyx_k_YMDHMS20, sizeof(__pyx_k_YMDHMS20), 0, 0, 1, 1}, - {&__pyx_n_s_YYMMDD, __pyx_k_YYMMDD, sizeof(__pyx_k_YYMMDD), 0, 0, 1, 1}, - {&__pyx_n_s_YYMMDD10, __pyx_k_YYMMDD10, sizeof(__pyx_k_YYMMDD10), 0, 0, 1, 1}, - {&__pyx_n_s_YYMMDDB, __pyx_k_YYMMDDB, sizeof(__pyx_k_YYMMDDB), 0, 0, 1, 1}, - {&__pyx_n_s_YYMMDDD, __pyx_k_YYMMDDD, sizeof(__pyx_k_YYMMDDD), 0, 0, 1, 1}, - {&__pyx_n_s_YYMMDDN, __pyx_k_YYMMDDN, sizeof(__pyx_k_YYMMDDN), 0, 0, 1, 1}, - {&__pyx_n_s_YYMMDDP, __pyx_k_YYMMDDP, sizeof(__pyx_k_YYMMDDP), 0, 0, 1, 1}, - {&__pyx_n_s_YYMMDDS, __pyx_k_YYMMDDS, sizeof(__pyx_k_YYMMDDS), 0, 0, 1, 1}, - {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0}, - {&__pyx_n_s_allowed_formats, __pyx_k_allowed_formats, sizeof(__pyx_k_allowed_formats), 0, 0, 1, 1}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, - {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1}, - {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, - {&__pyx_kp_s_column_0_is_duplicated_renamed_t, __pyx_k_column_0_is_duplicated_renamed_t, sizeof(__pyx_k_column_0_is_duplicated_renamed_t), 0, 0, 1, 0}, - {&__pyx_n_s_column_labels, __pyx_k_column_labels, sizeof(__pyx_k_column_labels), 0, 0, 1, 1}, - {&__pyx_n_s_column_names, __pyx_k_column_names, sizeof(__pyx_k_column_names), 0, 0, 1, 1}, - {&__pyx_n_s_column_names_to_labels, __pyx_k_column_names_to_labels, sizeof(__pyx_k_column_names_to_labels), 0, 0, 1, 1}, - {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1}, - {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, - {&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0}, - {&__pyx_n_s_data_container, __pyx_k_data_container, sizeof(__pyx_k_data_container), 0, 0, 1, 1}, - {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1}, - {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtypes, __pyx_k_dtypes, sizeof(__pyx_k_dtypes), 0, 0, 1, 1}, - {&__pyx_n_s_duplicated, __pyx_k_duplicated, sizeof(__pyx_k_duplicated), 0, 0, 1, 1}, - {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1}, - {&__pyx_n_s_file_encoding, __pyx_k_file_encoding, sizeof(__pyx_k_file_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_file_label, __pyx_k_file_label, sizeof(__pyx_k_file_label), 0, 0, 1, 1}, - {&__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_k_file_path_could_not_be_encoded_w, sizeof(__pyx_k_file_path_could_not_be_encoded_w), 0, 0, 1, 0}, - {&__pyx_n_s_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 0, 0, 1, 1}, - {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_from_dict, __pyx_k_from_dict, sizeof(__pyx_k_from_dict), 0, 0, 1, 1}, - {&__pyx_n_s_fsdecode, __pyx_k_fsdecode, sizeof(__pyx_k_fsdecode), 0, 0, 1, 1}, - {&__pyx_n_s_fsencode, __pyx_k_fsencode, sizeof(__pyx_k_fsencode), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_n_s_hi, __pyx_k_hi, sizeof(__pyx_k_hi), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1}, - {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, - {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1}, - {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, - {&__pyx_n_s_isfile, __pyx_k_isfile, sizeof(__pyx_k_isfile), 0, 0, 1, 1}, - {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, - {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1}, - {&__pyx_n_s_lo, __pyx_k_lo, sizeof(__pyx_k_lo), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_metadata_container, __pyx_k_metadata_container, sizeof(__pyx_k_metadata_container), 0, 0, 1, 1}, - {&__pyx_n_s_metadata_container___init, __pyx_k_metadata_container___init, sizeof(__pyx_k_metadata_container___init), 0, 0, 1, 1}, - {&__pyx_n_s_missing_ranges, __pyx_k_missing_ranges, sizeof(__pyx_k_missing_ranges), 0, 0, 1, 1}, - {&__pyx_n_s_missing_user_values, __pyx_k_missing_user_values, sizeof(__pyx_k_missing_user_values), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1}, - {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, - {&__pyx_n_s_nominal, __pyx_k_nominal, sizeof(__pyx_k_nominal), 0, 0, 1, 1}, - {&__pyx_n_s_notes, __pyx_k_notes, sizeof(__pyx_k_notes), 0, 0, 1, 1}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1}, - {&__pyx_n_s_number_columns, __pyx_k_number_columns, sizeof(__pyx_k_number_columns), 0, 0, 1, 1}, - {&__pyx_n_s_number_rows, __pyx_k_number_rows, sizeof(__pyx_k_number_rows), 0, 0, 1, 1}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_ordinal, __pyx_k_ordinal, sizeof(__pyx_k_ordinal), 0, 0, 1, 1}, - {&__pyx_n_s_original_variable_types, __pyx_k_original_variable_types, sizeof(__pyx_k_original_variable_types), 0, 0, 1, 1}, - {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1}, - {&__pyx_n_s_output_format, __pyx_k_output_format, sizeof(__pyx_k_output_format), 0, 0, 1, 1}, - {&__pyx_kp_s_output_format_must_be_one_of_all, __pyx_k_output_format_must_be_one_of_all, sizeof(__pyx_k_output_format_must_be_one_of_all), 0, 0, 1, 0}, - {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, - {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, - {&__pyx_kp_s_path_must_be_either_str_or_bytes, __pyx_k_path_must_be_either_str_or_bytes, sizeof(__pyx_k_path_must_be_either_str_or_bytes), 0, 0, 1, 0}, - {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_pyreadstat__readstat_parser, __pyx_k_pyreadstat__readstat_parser, sizeof(__pyx_k_pyreadstat__readstat_parser), 0, 0, 1, 1}, - {&__pyx_kp_s_pyreadstat__readstat_parser_pyx, __pyx_k_pyreadstat__readstat_parser_pyx, sizeof(__pyx_k_pyreadstat__readstat_parser_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_readstat_to_numpy_types, __pyx_k_readstat_to_numpy_types, sizeof(__pyx_k_readstat_to_numpy_types), 0, 0, 1, 1}, - {&__pyx_n_s_readstat_variable_types, __pyx_k_readstat_variable_types, sizeof(__pyx_k_readstat_variable_types), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1}, - {&__pyx_n_s_sas_all_formats, __pyx_k_sas_all_formats, sizeof(__pyx_k_sas_all_formats), 0, 0, 1, 1}, - {&__pyx_n_s_sas_date_formats, __pyx_k_sas_date_formats, sizeof(__pyx_k_sas_date_formats), 0, 0, 1, 1}, - {&__pyx_n_s_sas_datetime_formats, __pyx_k_sas_datetime_formats, sizeof(__pyx_k_sas_datetime_formats), 0, 0, 1, 1}, - {&__pyx_n_s_sas_origin, __pyx_k_sas_origin, sizeof(__pyx_k_sas_origin), 0, 0, 1, 1}, - {&__pyx_n_s_sas_time_formats, __pyx_k_sas_time_formats, sizeof(__pyx_k_sas_time_formats), 0, 0, 1, 1}, - {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_spss_all_formats, __pyx_k_spss_all_formats, sizeof(__pyx_k_spss_all_formats), 0, 0, 1, 1}, - {&__pyx_n_s_spss_date_formats, __pyx_k_spss_date_formats, sizeof(__pyx_k_spss_date_formats), 0, 0, 1, 1}, - {&__pyx_n_s_spss_datetime_formats, __pyx_k_spss_datetime_formats, sizeof(__pyx_k_spss_datetime_formats), 0, 0, 1, 1}, - {&__pyx_n_s_spss_origin, __pyx_k_spss_origin, sizeof(__pyx_k_spss_origin), 0, 0, 1, 1}, - {&__pyx_n_s_spss_time_formats, __pyx_k_spss_time_formats, sizeof(__pyx_k_spss_time_formats), 0, 0, 1, 1}, - {&__pyx_n_s_stata_all_formats, __pyx_k_stata_all_formats, sizeof(__pyx_k_stata_all_formats), 0, 0, 1, 1}, - {&__pyx_n_s_stata_date_formats, __pyx_k_stata_date_formats, sizeof(__pyx_k_stata_date_formats), 0, 0, 1, 1}, - {&__pyx_n_s_stata_datetime_formats, __pyx_k_stata_datetime_formats, sizeof(__pyx_k_stata_datetime_formats), 0, 0, 1, 1}, - {&__pyx_n_s_stata_origin, __pyx_k_stata_origin, sizeof(__pyx_k_stata_origin), 0, 0, 1, 1}, - {&__pyx_n_s_stata_time_formats, __pyx_k_stata_time_formats, sizeof(__pyx_k_stata_time_formats), 0, 0, 1, 1}, - {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1}, - {&__pyx_n_s_surrogateescape, __pyx_k_surrogateescape, sizeof(__pyx_k_surrogateescape), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_kp_s_tC, __pyx_k_tC, sizeof(__pyx_k_tC), 0, 0, 1, 0}, - {&__pyx_n_s_table_name, __pyx_k_table_name, sizeof(__pyx_k_table_name), 0, 0, 1, 1}, - {&__pyx_kp_s_tc, __pyx_k_tc, sizeof(__pyx_k_tc), 0, 0, 1, 0}, - {&__pyx_kp_s_tcHH_MM, __pyx_k_tcHH_MM, sizeof(__pyx_k_tcHH_MM), 0, 0, 1, 0}, - {&__pyx_kp_s_tcHH_MM_SS, __pyx_k_tcHH_MM_SS, sizeof(__pyx_k_tcHH_MM_SS), 0, 0, 1, 0}, - {&__pyx_kp_s_td, __pyx_k_td, sizeof(__pyx_k_td), 0, 0, 1, 0}, - {&__pyx_kp_s_tdCCYY_NN_DD, __pyx_k_tdCCYY_NN_DD, sizeof(__pyx_k_tdCCYY_NN_DD), 0, 0, 1, 0}, - {&__pyx_kp_s_tdD_m_Y, __pyx_k_tdD_m_Y, sizeof(__pyx_k_tdD_m_Y), 0, 0, 1, 0}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1}, - {&__pyx_n_s_to_datetime, __pyx_k_to_datetime, sizeof(__pyx_k_to_datetime), 0, 0, 1, 1}, - {&__pyx_n_s_tolist, __pyx_k_tolist, sizeof(__pyx_k_tolist), 0, 0, 1, 1}, - {&__pyx_n_s_undetermined, __pyx_k_undetermined, sizeof(__pyx_k_undetermined), 0, 0, 1, 1}, - {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1}, - {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0}, - {&__pyx_n_s_value_labels, __pyx_k_value_labels, sizeof(__pyx_k_value_labels), 0, 0, 1, 1}, - {&__pyx_n_s_variable_alignment, __pyx_k_variable_alignment, sizeof(__pyx_k_variable_alignment), 0, 0, 1, 1}, - {&__pyx_n_s_variable_display_width, __pyx_k_variable_display_width, sizeof(__pyx_k_variable_display_width), 0, 0, 1, 1}, - {&__pyx_n_s_variable_measure, __pyx_k_variable_measure, sizeof(__pyx_k_variable_measure), 0, 0, 1, 1}, - {&__pyx_n_s_variable_storage_width, __pyx_k_variable_storage_width, sizeof(__pyx_k_variable_storage_width), 0, 0, 1, 1}, - {&__pyx_n_s_variable_to_label, __pyx_k_variable_to_label, sizeof(__pyx_k_variable_to_label), 0, 0, 1, 1}, - {&__pyx_n_s_variable_value_labels, __pyx_k_variable_value_labels, sizeof(__pyx_k_variable_value_labels), 0, 0, 1, 1}, - {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1}, - {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1}, - {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_ADATE, __pyx_k_ADATE, sizeof(__pyx_k_ADATE), 0, 0, 1, 1}, + {&__pyx_n_s_ADATE10, __pyx_k_ADATE10, sizeof(__pyx_k_ADATE10), 0, 0, 1, 1}, + {&__pyx_n_s_ADATE8, __pyx_k_ADATE8, sizeof(__pyx_k_ADATE8), 0, 0, 1, 1}, + {&__pyx_n_s_B8601DA, __pyx_k_B8601DA, sizeof(__pyx_k_B8601DA), 0, 0, 1, 1}, + {&__pyx_n_s_B8601DN, __pyx_k_B8601DN, sizeof(__pyx_k_B8601DN), 0, 0, 1, 1}, + {&__pyx_n_s_B8601DT, __pyx_k_B8601DT, sizeof(__pyx_k_B8601DT), 0, 0, 1, 1}, + {&__pyx_n_s_B8601TM, __pyx_k_B8601TM, sizeof(__pyx_k_B8601TM), 0, 0, 1, 1}, + {&__pyx_n_s_DATE, __pyx_k_DATE, sizeof(__pyx_k_DATE), 0, 0, 1, 1}, + {&__pyx_n_s_DATE11, __pyx_k_DATE11, sizeof(__pyx_k_DATE11), 0, 0, 1, 1}, + {&__pyx_n_s_DATE12, __pyx_k_DATE12, sizeof(__pyx_k_DATE12), 0, 0, 1, 1}, + {&__pyx_n_s_DATE8, __pyx_k_DATE8, sizeof(__pyx_k_DATE8), 0, 0, 1, 1}, + {&__pyx_n_s_DATE9, __pyx_k_DATE9, sizeof(__pyx_k_DATE9), 0, 0, 1, 1}, + {&__pyx_n_s_DATEAMPM, __pyx_k_DATEAMPM, sizeof(__pyx_k_DATEAMPM), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME, __pyx_k_DATETIME, sizeof(__pyx_k_DATETIME), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME17, __pyx_k_DATETIME17, sizeof(__pyx_k_DATETIME17), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME18, __pyx_k_DATETIME18, sizeof(__pyx_k_DATETIME18), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME19, __pyx_k_DATETIME19, sizeof(__pyx_k_DATETIME19), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME20, __pyx_k_DATETIME20, sizeof(__pyx_k_DATETIME20), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME21, __pyx_k_DATETIME21, sizeof(__pyx_k_DATETIME21), 0, 0, 1, 1}, + {&__pyx_n_s_DATETIME22, __pyx_k_DATETIME22, sizeof(__pyx_k_DATETIME22), 0, 0, 1, 1}, + {&__pyx_kp_s_DATETIME23_2, __pyx_k_DATETIME23_2, sizeof(__pyx_k_DATETIME23_2), 0, 0, 1, 0}, + {&__pyx_n_s_DATETIME8, __pyx_k_DATETIME8, sizeof(__pyx_k_DATETIME8), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYY, __pyx_k_DDMMYY, sizeof(__pyx_k_DDMMYY), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYB, __pyx_k_DDMMYYB, sizeof(__pyx_k_DDMMYYB), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYB10, __pyx_k_DDMMYYB10, sizeof(__pyx_k_DDMMYYB10), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYC, __pyx_k_DDMMYYC, sizeof(__pyx_k_DDMMYYC), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYC10, __pyx_k_DDMMYYC10, sizeof(__pyx_k_DDMMYYC10), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYD, __pyx_k_DDMMYYD, sizeof(__pyx_k_DDMMYYD), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYD10, __pyx_k_DDMMYYD10, sizeof(__pyx_k_DDMMYYD10), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYN6, __pyx_k_DDMMYYN6, sizeof(__pyx_k_DDMMYYN6), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYN8, __pyx_k_DDMMYYN8, sizeof(__pyx_k_DDMMYYN8), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYP, __pyx_k_DDMMYYP, sizeof(__pyx_k_DDMMYYP), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYP10, __pyx_k_DDMMYYP10, sizeof(__pyx_k_DDMMYYP10), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYS, __pyx_k_DDMMYYS, sizeof(__pyx_k_DDMMYYS), 0, 0, 1, 1}, + {&__pyx_n_s_DDMMYYS10, __pyx_k_DDMMYYS10, sizeof(__pyx_k_DDMMYYS10), 0, 0, 1, 1}, + {&__pyx_n_s_DTDATE, __pyx_k_DTDATE, sizeof(__pyx_k_DTDATE), 0, 0, 1, 1}, + {&__pyx_n_s_DTIME, __pyx_k_DTIME, sizeof(__pyx_k_DTIME), 0, 0, 1, 1}, + {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1}, + {&__pyx_n_s_E8601DA, __pyx_k_E8601DA, sizeof(__pyx_k_E8601DA), 0, 0, 1, 1}, + {&__pyx_n_s_E8601DT, __pyx_k_E8601DT, sizeof(__pyx_k_E8601DT), 0, 0, 1, 1}, + {&__pyx_n_s_E8601TM, __pyx_k_E8601TM, sizeof(__pyx_k_E8601TM), 0, 0, 1, 1}, + {&__pyx_n_s_EDATE, __pyx_k_EDATE, sizeof(__pyx_k_EDATE), 0, 0, 1, 1}, + {&__pyx_n_s_EDATE10, __pyx_k_EDATE10, sizeof(__pyx_k_EDATE10), 0, 0, 1, 1}, + {&__pyx_n_s_EDATE8, __pyx_k_EDATE8, sizeof(__pyx_k_EDATE8), 0, 0, 1, 1}, + {&__pyx_kp_s_Failed_convert_C_to_python_value, __pyx_k_Failed_convert_C_to_python_value, sizeof(__pyx_k_Failed_convert_C_to_python_value), 0, 0, 1, 0}, + {&__pyx_kp_s_Failed_to_read_number_of_variabl, __pyx_k_Failed_to_read_number_of_variabl, sizeof(__pyx_k_Failed_to_read_number_of_variabl), 0, 0, 1, 0}, + {&__pyx_kp_s_File_0_does_not_exist, __pyx_k_File_0_does_not_exist, sizeof(__pyx_k_File_0_does_not_exist), 0, 0, 1, 0}, + {&__pyx_n_s_HHMM, __pyx_k_HHMM, sizeof(__pyx_k_HHMM), 0, 0, 1, 1}, + {&__pyx_n_s_IS8601DA, __pyx_k_IS8601DA, sizeof(__pyx_k_IS8601DA), 0, 0, 1, 1}, + {&__pyx_n_s_IS8601DT, __pyx_k_IS8601DT, sizeof(__pyx_k_IS8601DT), 0, 0, 1, 1}, + {&__pyx_n_s_IS8601TM, __pyx_k_IS8601TM, sizeof(__pyx_k_IS8601TM), 0, 0, 1, 1}, + {&__pyx_n_s_JDATE, __pyx_k_JDATE, sizeof(__pyx_k_JDATE), 0, 0, 1, 1}, + {&__pyx_n_s_JDATE5, __pyx_k_JDATE5, sizeof(__pyx_k_JDATE5), 0, 0, 1, 1}, + {&__pyx_n_s_JDATE7, __pyx_k_JDATE7, sizeof(__pyx_k_JDATE7), 0, 0, 1, 1}, + {&__pyx_kp_s_Just_defining_a_custom_exceptio, __pyx_k_Just_defining_a_custom_exceptio, sizeof(__pyx_k_Just_defining_a_custom_exceptio), 0, 0, 1, 0}, + {&__pyx_kp_s_Just_defining_a_custom_exceptio_2, __pyx_k_Just_defining_a_custom_exceptio_2, sizeof(__pyx_k_Just_defining_a_custom_exceptio_2), 0, 0, 1, 0}, + {&__pyx_kp_s_M8_ns, __pyx_k_M8_ns, sizeof(__pyx_k_M8_ns), 0, 0, 1, 0}, + {&__pyx_n_s_MDYAMPM, __pyx_k_MDYAMPM, sizeof(__pyx_k_MDYAMPM), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYY, __pyx_k_MMDDYY, sizeof(__pyx_k_MMDDYY), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYB, __pyx_k_MMDDYYB, sizeof(__pyx_k_MMDDYYB), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYB10, __pyx_k_MMDDYYB10, sizeof(__pyx_k_MMDDYYB10), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYC, __pyx_k_MMDDYYC, sizeof(__pyx_k_MMDDYYC), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYC10, __pyx_k_MMDDYYC10, sizeof(__pyx_k_MMDDYYC10), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYD, __pyx_k_MMDDYYD, sizeof(__pyx_k_MMDDYYD), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYD10, __pyx_k_MMDDYYD10, sizeof(__pyx_k_MMDDYYD10), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYN6, __pyx_k_MMDDYYN6, sizeof(__pyx_k_MMDDYYN6), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYN8, __pyx_k_MMDDYYN8, sizeof(__pyx_k_MMDDYYN8), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYP, __pyx_k_MMDDYYP, sizeof(__pyx_k_MMDDYYP), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYP10, __pyx_k_MMDDYYP10, sizeof(__pyx_k_MMDDYYP10), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYS, __pyx_k_MMDDYYS, sizeof(__pyx_k_MMDDYYS), 0, 0, 1, 1}, + {&__pyx_n_s_MMDDYYS10, __pyx_k_MMDDYYS10, sizeof(__pyx_k_MMDDYYS10), 0, 0, 1, 1}, + {&__pyx_n_s_NULL, __pyx_k_NULL, sizeof(__pyx_k_NULL), 0, 0, 1, 1}, + {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1}, + {&__pyx_n_s_PyreadstatError, __pyx_k_PyreadstatError, sizeof(__pyx_k_PyreadstatError), 0, 0, 1, 1}, + {&__pyx_n_s_ReadstatError, __pyx_k_ReadstatError, sizeof(__pyx_k_ReadstatError), 0, 0, 1, 1}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s_SDATE, __pyx_k_SDATE, sizeof(__pyx_k_SDATE), 0, 0, 1, 1}, + {&__pyx_n_s_SDATE10, __pyx_k_SDATE10, sizeof(__pyx_k_SDATE10), 0, 0, 1, 1}, + {&__pyx_n_s_SDATE8, __pyx_k_SDATE8, sizeof(__pyx_k_SDATE8), 0, 0, 1, 1}, + {&__pyx_kp_s_STRING_type_with_value_s_with_da, __pyx_k_STRING_type_with_value_s_with_da, sizeof(__pyx_k_STRING_type_with_value_s_with_da), 0, 0, 1, 0}, + {&__pyx_n_s_TIME, __pyx_k_TIME, sizeof(__pyx_k_TIME), 0, 0, 1, 1}, + {&__pyx_kp_s_TIME11_2, __pyx_k_TIME11_2, sizeof(__pyx_k_TIME11_2), 0, 0, 1, 0}, + {&__pyx_n_s_TIME20, __pyx_k_TIME20, sizeof(__pyx_k_TIME20), 0, 0, 1, 1}, + {&__pyx_kp_s_TIME20_3, __pyx_k_TIME20_3, sizeof(__pyx_k_TIME20_3), 0, 0, 1, 0}, + {&__pyx_n_s_TIME5, __pyx_k_TIME5, sizeof(__pyx_k_TIME5), 0, 0, 1, 1}, + {&__pyx_n_s_TIME8, __pyx_k_TIME8, sizeof(__pyx_k_TIME8), 0, 0, 1, 1}, + {&__pyx_n_s_TIMEAMPM, __pyx_k_TIMEAMPM, sizeof(__pyx_k_TIMEAMPM), 0, 0, 1, 1}, + {&__pyx_n_s_TOD, __pyx_k_TOD, sizeof(__pyx_k_TOD), 0, 0, 1, 1}, + {&__pyx_kp_s_This_class_holds_metadata_we_wa, __pyx_k_This_class_holds_metadata_we_wa, sizeof(__pyx_k_This_class_holds_metadata_we_wa), 0, 0, 1, 0}, + {&__pyx_kp_s_Time_zones_are_not_available_fro, __pyx_k_Time_zones_are_not_available_fro, sizeof(__pyx_k_Time_zones_are_not_available_fro), 0, 0, 1, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_n_s_UnicodeError, __pyx_k_UnicodeError, sizeof(__pyx_k_UnicodeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unknown_file_format, __pyx_k_Unknown_file_format, sizeof(__pyx_k_Unknown_file_format), 0, 0, 1, 0}, + {&__pyx_kp_s_Unkown_data_type, __pyx_k_Unkown_data_type, sizeof(__pyx_k_Unkown_data_type), 0, 0, 1, 0}, + {&__pyx_n_s_WEEKDATE, __pyx_k_WEEKDATE, sizeof(__pyx_k_WEEKDATE), 0, 0, 1, 1}, + {&__pyx_n_s_WEEKDATX, __pyx_k_WEEKDATX, sizeof(__pyx_k_WEEKDATX), 0, 0, 1, 1}, + {&__pyx_n_s_YMDHMS16, __pyx_k_YMDHMS16, sizeof(__pyx_k_YMDHMS16), 0, 0, 1, 1}, + {&__pyx_n_s_YMDHMS19, __pyx_k_YMDHMS19, sizeof(__pyx_k_YMDHMS19), 0, 0, 1, 1}, + {&__pyx_kp_s_YMDHMS19_2, __pyx_k_YMDHMS19_2, sizeof(__pyx_k_YMDHMS19_2), 0, 0, 1, 0}, + {&__pyx_n_s_YMDHMS20, __pyx_k_YMDHMS20, sizeof(__pyx_k_YMDHMS20), 0, 0, 1, 1}, + {&__pyx_n_s_YYMMDD, __pyx_k_YYMMDD, sizeof(__pyx_k_YYMMDD), 0, 0, 1, 1}, + {&__pyx_n_s_YYMMDD10, __pyx_k_YYMMDD10, sizeof(__pyx_k_YYMMDD10), 0, 0, 1, 1}, + {&__pyx_n_s_YYMMDDB, __pyx_k_YYMMDDB, sizeof(__pyx_k_YYMMDDB), 0, 0, 1, 1}, + {&__pyx_n_s_YYMMDDD, __pyx_k_YYMMDDD, sizeof(__pyx_k_YYMMDDD), 0, 0, 1, 1}, + {&__pyx_n_s_YYMMDDN, __pyx_k_YYMMDDN, sizeof(__pyx_k_YYMMDDN), 0, 0, 1, 1}, + {&__pyx_n_s_YYMMDDP, __pyx_k_YYMMDDP, sizeof(__pyx_k_YYMMDDP), 0, 0, 1, 1}, + {&__pyx_n_s_YYMMDDS, __pyx_k_YYMMDDS, sizeof(__pyx_k_YYMMDDS), 0, 0, 1, 1}, + {&__pyx_n_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 1}, + {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, + {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0}, + {&__pyx_n_s__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 0, 1, 1}, + {&__pyx_n_s_allowed_formats, __pyx_k_allowed_formats, sizeof(__pyx_k_allowed_formats), 0, 0, 1, 1}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1}, + {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_kp_s_column_0_is_duplicated_renamed_t, __pyx_k_column_0_is_duplicated_renamed_t, sizeof(__pyx_k_column_0_is_duplicated_renamed_t), 0, 0, 1, 0}, + {&__pyx_n_s_column_labels, __pyx_k_column_labels, sizeof(__pyx_k_column_labels), 0, 0, 1, 1}, + {&__pyx_n_s_column_names, __pyx_k_column_names, sizeof(__pyx_k_column_names), 0, 0, 1, 1}, + {&__pyx_n_s_column_names_to_labels, __pyx_k_column_names_to_labels, sizeof(__pyx_k_column_names_to_labels), 0, 0, 1, 1}, + {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_kp_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0}, + {&__pyx_n_s_data_container, __pyx_k_data_container, sizeof(__pyx_k_data_container), 0, 0, 1, 1}, + {&__pyx_n_s_data_container___reduce_cython, __pyx_k_data_container___reduce_cython, sizeof(__pyx_k_data_container___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_data_container___setstate_cython, __pyx_k_data_container___setstate_cython, sizeof(__pyx_k_data_container___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_dict_2, __pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtypes, __pyx_k_dtypes, sizeof(__pyx_k_dtypes), 0, 0, 1, 1}, + {&__pyx_n_s_duplicated, __pyx_k_duplicated, sizeof(__pyx_k_duplicated), 0, 0, 1, 1}, + {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1}, + {&__pyx_n_s_file_encoding, __pyx_k_file_encoding, sizeof(__pyx_k_file_encoding), 0, 0, 1, 1}, + {&__pyx_n_s_file_label, __pyx_k_file_label, sizeof(__pyx_k_file_label), 0, 0, 1, 1}, + {&__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_k_file_path_could_not_be_encoded_w, sizeof(__pyx_k_file_path_could_not_be_encoded_w), 0, 0, 1, 0}, + {&__pyx_n_s_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 0, 0, 1, 1}, + {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_from_dict, __pyx_k_from_dict, sizeof(__pyx_k_from_dict), 0, 0, 1, 1}, + {&__pyx_n_s_fsdecode, __pyx_k_fsdecode, sizeof(__pyx_k_fsdecode), 0, 0, 1, 1}, + {&__pyx_n_s_fsencode, __pyx_k_fsencode, sizeof(__pyx_k_fsencode), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_hi, __pyx_k_hi, sizeof(__pyx_k_hi), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_s_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1}, + {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_isfile, __pyx_k_isfile, sizeof(__pyx_k_isfile), 0, 0, 1, 1}, + {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, + {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1}, + {&__pyx_n_s_lo, __pyx_k_lo, sizeof(__pyx_k_lo), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_metadata_container, __pyx_k_metadata_container, sizeof(__pyx_k_metadata_container), 0, 0, 1, 1}, + {&__pyx_n_s_metadata_container___init, __pyx_k_metadata_container___init, sizeof(__pyx_k_metadata_container___init), 0, 0, 1, 1}, + {&__pyx_n_s_missing_ranges, __pyx_k_missing_ranges, sizeof(__pyx_k_missing_ranges), 0, 0, 1, 1}, + {&__pyx_n_s_missing_user_values, __pyx_k_missing_user_values, sizeof(__pyx_k_missing_user_values), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_mro_entries, __pyx_k_mro_entries, sizeof(__pyx_k_mro_entries), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_nominal, __pyx_k_nominal, sizeof(__pyx_k_nominal), 0, 0, 1, 1}, + {&__pyx_n_s_notes, __pyx_k_notes, sizeof(__pyx_k_notes), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1}, + {&__pyx_n_s_number_columns, __pyx_k_number_columns, sizeof(__pyx_k_number_columns), 0, 0, 1, 1}, + {&__pyx_n_s_number_rows, __pyx_k_number_rows, sizeof(__pyx_k_number_rows), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, + {&__pyx_n_s_ordinal, __pyx_k_ordinal, sizeof(__pyx_k_ordinal), 0, 0, 1, 1}, + {&__pyx_n_s_original_variable_types, __pyx_k_original_variable_types, sizeof(__pyx_k_original_variable_types), 0, 0, 1, 1}, + {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1}, + {&__pyx_n_s_output_format, __pyx_k_output_format, sizeof(__pyx_k_output_format), 0, 0, 1, 1}, + {&__pyx_kp_s_output_format_must_be_one_of_all, __pyx_k_output_format_must_be_one_of_all, sizeof(__pyx_k_output_format_must_be_one_of_all), 0, 0, 1, 0}, + {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, + {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, + {&__pyx_kp_s_path_must_be_either_str_or_bytes, __pyx_k_path_must_be_either_str_or_bytes, sizeof(__pyx_k_path_must_be_either_str_or_bytes), 0, 0, 1, 0}, + {&__pyx_kp_s_path_must_be_str_bytes_or_unicod, __pyx_k_path_must_be_str_bytes_or_unicod, sizeof(__pyx_k_path_must_be_str_bytes_or_unicod), 0, 0, 1, 0}, + {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_pyreadstat__readstat_parser, __pyx_k_pyreadstat__readstat_parser, sizeof(__pyx_k_pyreadstat__readstat_parser), 0, 0, 1, 1}, + {&__pyx_kp_s_pyreadstat__readstat_parser_pyx, __pyx_k_pyreadstat__readstat_parser_pyx, sizeof(__pyx_k_pyreadstat__readstat_parser_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_readstat_to_numpy_types, __pyx_k_readstat_to_numpy_types, sizeof(__pyx_k_readstat_to_numpy_types), 0, 0, 1, 1}, + {&__pyx_n_s_readstat_variable_types, __pyx_k_readstat_variable_types, sizeof(__pyx_k_readstat_variable_types), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1}, + {&__pyx_n_s_sas_all_formats, __pyx_k_sas_all_formats, sizeof(__pyx_k_sas_all_formats), 0, 0, 1, 1}, + {&__pyx_n_s_sas_date_formats, __pyx_k_sas_date_formats, sizeof(__pyx_k_sas_date_formats), 0, 0, 1, 1}, + {&__pyx_n_s_sas_datetime_formats, __pyx_k_sas_datetime_formats, sizeof(__pyx_k_sas_datetime_formats), 0, 0, 1, 1}, + {&__pyx_n_s_sas_origin, __pyx_k_sas_origin, sizeof(__pyx_k_sas_origin), 0, 0, 1, 1}, + {&__pyx_n_s_sas_time_formats, __pyx_k_sas_time_formats, sizeof(__pyx_k_sas_time_formats), 0, 0, 1, 1}, + {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_spss_all_formats, __pyx_k_spss_all_formats, sizeof(__pyx_k_spss_all_formats), 0, 0, 1, 1}, + {&__pyx_n_s_spss_date_formats, __pyx_k_spss_date_formats, sizeof(__pyx_k_spss_date_formats), 0, 0, 1, 1}, + {&__pyx_n_s_spss_datetime_formats, __pyx_k_spss_datetime_formats, sizeof(__pyx_k_spss_datetime_formats), 0, 0, 1, 1}, + {&__pyx_n_s_spss_origin, __pyx_k_spss_origin, sizeof(__pyx_k_spss_origin), 0, 0, 1, 1}, + {&__pyx_n_s_spss_time_formats, __pyx_k_spss_time_formats, sizeof(__pyx_k_spss_time_formats), 0, 0, 1, 1}, + {&__pyx_n_s_stata_all_formats, __pyx_k_stata_all_formats, sizeof(__pyx_k_stata_all_formats), 0, 0, 1, 1}, + {&__pyx_n_s_stata_date_formats, __pyx_k_stata_date_formats, sizeof(__pyx_k_stata_date_formats), 0, 0, 1, 1}, + {&__pyx_n_s_stata_datetime_formats, __pyx_k_stata_datetime_formats, sizeof(__pyx_k_stata_datetime_formats), 0, 0, 1, 1}, + {&__pyx_n_s_stata_origin, __pyx_k_stata_origin, sizeof(__pyx_k_stata_origin), 0, 0, 1, 1}, + {&__pyx_n_s_stata_time_formats, __pyx_k_stata_time_formats, sizeof(__pyx_k_stata_time_formats), 0, 0, 1, 1}, + {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, + {&__pyx_n_s_surrogateescape, __pyx_k_surrogateescape, sizeof(__pyx_k_surrogateescape), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_kp_s_tC, __pyx_k_tC, sizeof(__pyx_k_tC), 0, 0, 1, 0}, + {&__pyx_n_s_table_name, __pyx_k_table_name, sizeof(__pyx_k_table_name), 0, 0, 1, 1}, + {&__pyx_kp_s_tc, __pyx_k_tc, sizeof(__pyx_k_tc), 0, 0, 1, 0}, + {&__pyx_kp_s_tcHH_MM, __pyx_k_tcHH_MM, sizeof(__pyx_k_tcHH_MM), 0, 0, 1, 0}, + {&__pyx_kp_s_tcHH_MM_SS, __pyx_k_tcHH_MM_SS, sizeof(__pyx_k_tcHH_MM_SS), 0, 0, 1, 0}, + {&__pyx_kp_s_td, __pyx_k_td, sizeof(__pyx_k_td), 0, 0, 1, 0}, + {&__pyx_kp_s_tdCCYY_NN_DD, __pyx_k_tdCCYY_NN_DD, sizeof(__pyx_k_tdCCYY_NN_DD), 0, 0, 1, 0}, + {&__pyx_kp_s_tdD_m_Y, __pyx_k_tdD_m_Y, sizeof(__pyx_k_tdD_m_Y), 0, 0, 1, 0}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1}, + {&__pyx_n_s_to_datetime, __pyx_k_to_datetime, sizeof(__pyx_k_to_datetime), 0, 0, 1, 1}, + {&__pyx_n_s_tolist, __pyx_k_tolist, sizeof(__pyx_k_tolist), 0, 0, 1, 1}, + {&__pyx_n_s_undetermined, __pyx_k_undetermined, sizeof(__pyx_k_undetermined), 0, 0, 1, 1}, + {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1}, + {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0}, + {&__pyx_n_s_value_labels, __pyx_k_value_labels, sizeof(__pyx_k_value_labels), 0, 0, 1, 1}, + {&__pyx_n_s_variable_alignment, __pyx_k_variable_alignment, sizeof(__pyx_k_variable_alignment), 0, 0, 1, 1}, + {&__pyx_n_s_variable_display_width, __pyx_k_variable_display_width, sizeof(__pyx_k_variable_display_width), 0, 0, 1, 1}, + {&__pyx_n_s_variable_measure, __pyx_k_variable_measure, sizeof(__pyx_k_variable_measure), 0, 0, 1, 1}, + {&__pyx_n_s_variable_storage_width, __pyx_k_variable_storage_width, sizeof(__pyx_k_variable_storage_width), 0, 0, 1, 1}, + {&__pyx_n_s_variable_to_label, __pyx_k_variable_to_label, sizeof(__pyx_k_variable_to_label), 0, 0, 1, 1}, + {&__pyx_n_s_variable_value_labels, __pyx_k_variable_value_labels, sizeof(__pyx_k_variable_value_labels), 0, 0, 1, 1}, + {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1}, + {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1}, + {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 70, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 526, __pyx_L1_error) __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 648, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 929, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 1009, __pyx_L1_error) - __pyx_builtin_UnicodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeError); if (!__pyx_builtin_UnicodeError) __PYX_ERR(0, 1047, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 930, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 1010, __pyx_L1_error) + __pyx_builtin_UnicodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeError); if (!__pyx_builtin_UnicodeError) __PYX_ERR(0, 1048, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(2, 308, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 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__") + /* "cpython/datetime.pxd":308 + * cdef inline object timezone_new(object offset, object name=None): + * if PY_VERSION_HEX < 0x030700b1: + * raise RuntimeError('Time zones are not available from the C-API.') # <<<<<<<<<<<<<< + * return __Pyx_TimeZone_FromOffsetAndName(offset, name if name is not None else NULL) + * */ - __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_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Time_zones_are_not_available_fro); if (unlikely(!__pyx_tuple_)) __PYX_ERR(2, 308, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - /* "pyreadstat/_readstat_parser.pyx":513 * # pre-allocate data * if metaonly: @@ -14044,9 +17735,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * else: * obs_count = dc.n_obs */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 513, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); /* "pyreadstat/_readstat_parser.pyx":614 * if var_max_rows <= obs_index: @@ -14055,9 +17746,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if iscurnptypeobject or iscurnptypefloat: * buf_list.fill(np.nan) */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_int_100000); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_100000); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 614, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); /* "pyreadstat/_readstat_parser.pyx":634 * dc.col_dtypes_isobject[index] = 1 @@ -14066,9 +17757,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * dc.col_data[index][obs_index:] = np.nan * #dc.col_data[index][obs_index] = NAN */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 634, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); /* "pyreadstat/_readstat_parser.pyx":654 * dc.col_dytpes_isfloat[index] = 0 @@ -14077,20 +17768,41 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * dc.col_data[index][obs_index] = chr(missing_tag) * curset = dc.missing_user_values.get(index) */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 654, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 654, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "pyreadstat/_readstat_parser.pyx":1049 + /* "pyreadstat/_readstat_parser.pyx":1050 * except UnicodeError: * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") # <<<<<<<<<<<<<< * else: - * IF PY_MAJOR_VERSION >2: + * if type(filename_path) == str: + */ + __pyx_tuple__7 = PyTuple_Pack(2, __pyx_kp_s_utf_8, __pyx_n_s_surrogateescape); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 1050, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(1, 1, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_tuple__8 = PyTuple_Pack(2, __pyx_kp_s_utf_8, __pyx_n_s_surrogateescape); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1049, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(1, 3, __pyx_L1_error) /* "pyreadstat/_readstat_parser.pyx":120 * This class holds metadata we want to give back to python @@ -14099,21 +17811,21 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.column_names = list() * self.column_labels = list() */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat__readstat_parser_pyx, __pyx_n_s_init, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat__readstat_parser_pyx, __pyx_n_s_init, 120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_get.method_name = &__pyx_n_s_get; __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_umethod_PyDict_Type_items.method_name = &__pyx_n_s_items; + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_100000 = PyInt_FromLong(100000L); if (unlikely(!__pyx_int_100000)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -14121,6 +17833,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -14199,11 +17917,11 @@ static int __Pyx_modinit_function_export_code(void) { if (__Pyx_ExportFunction("handle_value_label", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_handle_value_label, "int (char *, readstat_value_t, char *, void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("handle_note", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_handle_note, "int (int, char *, void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("check_exit_status", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_check_exit_status, "void (readstat_error_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("run_readstat_parser", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser, "void (char *, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *, readstat_error_t (readstat_parser_t *, char const *, void *), long, long)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("run_readstat_parser", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_run_readstat_parser, "void (char *, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension, long, long)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("data_container_to_dict", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_data_container_to_dict, "PyObject *(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("dict_to_pandas_dataframe", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_dict_to_pandas_dataframe, "PyObject *(PyObject *, struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("data_container_extract_metadata", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_data_container_extract_metadata, "PyObject *(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("run_conversion", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_run_conversion, "PyObject *(PyObject *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format, readstat_error_t (readstat_parser_t *, char const *, void *), PyObject *, int, int, PyObject *, int, int, long, long, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("run_conversion", (void (*)(void))__pyx_f_10pyreadstat_16_readstat_parser_run_conversion, "PyObject *(PyObject *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format, __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension, PyObject *, int, int, PyObject *, int, int, long, long, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -14218,16 +17936,29 @@ 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_10pyreadstat_16_readstat_parser_data_container) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_10pyreadstat_16_readstat_parser_data_container.tp_print = 0; + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_10pyreadstat_16_readstat_parser_data_container = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_10pyreadstat_16_readstat_parser_data_container_spec, NULL); if (unlikely(!__pyx_ptype_10pyreadstat_16_readstat_parser_data_container)) __PYX_ERR(0, 74, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_10pyreadstat_16_readstat_parser_data_container_spec, __pyx_ptype_10pyreadstat_16_readstat_parser_data_container) < 0) __PYX_ERR(0, 74, __pyx_L1_error) + #else + __pyx_ptype_10pyreadstat_16_readstat_parser_data_container = &__pyx_type_10pyreadstat_16_readstat_parser_data_container; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_10pyreadstat_16_readstat_parser_data_container) < 0) __PYX_ERR(0, 74, __pyx_L1_error) #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pyreadstat_16_readstat_parser_data_container.tp_dictoffset && __pyx_type_10pyreadstat_16_readstat_parser_data_container.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_10pyreadstat_16_readstat_parser_data_container.tp_getattro = __Pyx_PyObject_GenericGetAttr; + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_10pyreadstat_16_readstat_parser_data_container->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_10pyreadstat_16_readstat_parser_data_container->tp_dictoffset && __pyx_ptype_10pyreadstat_16_readstat_parser_data_container->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_10pyreadstat_16_readstat_parser_data_container->tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_data_container, (PyObject *)&__pyx_type_10pyreadstat_16_readstat_parser_data_container) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10pyreadstat_16_readstat_parser_data_container) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - __pyx_ptype_10pyreadstat_16_readstat_parser_data_container = &__pyx_type_10pyreadstat_16_readstat_parser_data_container; + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_data_container, (PyObject *) __pyx_ptype_10pyreadstat_16_readstat_parser_data_container) < 0) __PYX_ERR(0, 74, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_10pyreadstat_16_readstat_parser_data_container) < 0) __PYX_ERR(0, 74, __pyx_L1_error) + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -14245,27 +17976,23 @@ static int __Pyx_modinit_type_import_code(void) { /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_0(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyTypeObject), #else - sizeof(PyHeapTypeObject), + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyHeapTypeObject), #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule("datetime"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("datetime"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_8datetime_date = __Pyx_ImportType(__pyx_t_1, "datetime", "date", sizeof(PyDateTime_Date), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_8datetime_date) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_ptype_7cpython_8datetime_time = __Pyx_ImportType(__pyx_t_1, "datetime", "time", sizeof(PyDateTime_Time), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_8datetime_time) __PYX_ERR(2, 12, __pyx_L1_error) - __pyx_ptype_7cpython_8datetime_datetime = __Pyx_ImportType(__pyx_t_1, "datetime", "datetime", sizeof(PyDateTime_DateTime), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_8datetime_datetime) __PYX_ERR(2, 15, __pyx_L1_error) - __pyx_ptype_7cpython_8datetime_timedelta = __Pyx_ImportType(__pyx_t_1, "datetime", "timedelta", sizeof(PyDateTime_Delta), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_8datetime_timedelta) __PYX_ERR(2, 18, __pyx_L1_error) - __pyx_ptype_7cpython_8datetime_tzinfo = __Pyx_ImportType(__pyx_t_1, "datetime", "tzinfo", sizeof(PyDateTime_TZInfo), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_8datetime_tzinfo) __PYX_ERR(2, 21, __pyx_L1_error) + __pyx_ptype_7cpython_8datetime_date = __Pyx_ImportType_3_0_0(__pyx_t_1, "datetime", "date", sizeof(PyDateTime_Date), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyDateTime_Date),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_8datetime_date) __PYX_ERR(2, 70, __pyx_L1_error) + __pyx_ptype_7cpython_8datetime_time = __Pyx_ImportType_3_0_0(__pyx_t_1, "datetime", "time", sizeof(PyDateTime_Time), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyDateTime_Time),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_8datetime_time) __PYX_ERR(2, 83, __pyx_L1_error) + __pyx_ptype_7cpython_8datetime_datetime = __Pyx_ImportType_3_0_0(__pyx_t_1, "datetime", "datetime", sizeof(PyDateTime_DateTime), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyDateTime_DateTime),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_8datetime_datetime) __PYX_ERR(2, 109, __pyx_L1_error) + __pyx_ptype_7cpython_8datetime_timedelta = __Pyx_ImportType_3_0_0(__pyx_t_1, "datetime", "timedelta", sizeof(PyDateTime_Delta), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyDateTime_Delta),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_8datetime_timedelta) __PYX_ERR(2, 147, __pyx_L1_error) + __pyx_ptype_7cpython_8datetime_tzinfo = __Pyx_ImportType_3_0_0(__pyx_t_1, "datetime", "tzinfo", sizeof(PyDateTime_TZInfo), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(PyDateTime_TZInfo),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_7cpython_8datetime_tzinfo) __PYX_ERR(2, 160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -14292,6 +18019,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec__readstat_parser(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec__readstat_parser}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "_readstat_parser", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -14342,12 +18118,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -14357,8 +18142,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -14368,8 +18154,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -14385,10 +18175,15 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__readstat_parser(PyObject *__pyx_p #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -14402,6 +18197,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__readstat_parser(PyObject *__pyx_p #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("_readstat_parser", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to _readstat_parser pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = 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(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -14420,48 +18244,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("_readstat_parser", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __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(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -14473,7 +18280,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "pyreadstat._readstat_parser")) { - if (unlikely(PyDict_SetItemString(modules, "pyreadstat._readstat_parser", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "pyreadstat._readstat_parser", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -14483,10 +18290,10 @@ if (!__Pyx_RefNanny) { if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); - if (unlikely(__Pyx_modinit_variable_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_variable_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ @@ -14501,19 +18308,19 @@ if (!__Pyx_RefNanny) { * import os * import warnings */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_OrderedDict); __Pyx_GIVEREF(__pyx_n_s_OrderedDict); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_OrderedDict); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_OrderedDict); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __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_OrderedDict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":26 * #from datetime import timedelta, datetime @@ -14522,10 +18329,10 @@ if (!__Pyx_RefNanny) { * import warnings * import sys */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_3) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":27 * from collections import OrderedDict @@ -14534,10 +18341,10 @@ if (!__Pyx_RefNanny) { * import sys * */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_2) < 0) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_warnings, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_3) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":28 * import os @@ -14546,10 +18353,10 @@ if (!__Pyx_RefNanny) { * * import pandas as pd */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_3) < 0) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":30 * import sys @@ -14558,10 +18365,10 @@ if (!__Pyx_RefNanny) { * import numpy as np * #from pandas._libs import Timestamp */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_pandas, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_3) < 0) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":31 * @@ -14570,10 +18377,10 @@ if (!__Pyx_RefNanny) { * #from pandas._libs import Timestamp * */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_3) < 0) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":37 * @@ -14582,7 +18389,7 @@ if (!__Pyx_RefNanny) { * * cdef list sas_date_formats = ["WEEKDATE", "MMDDYY", "DDMMYY", "YYMMDD", "DATE", "DATE9", "YYMMDD10", */ - __pyx_f_7cpython_8datetime_import_datetime(); + __pyx_f_7cpython_8datetime_import_datetime(); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L1_error) /* "pyreadstat/_readstat_parser.pyx":39 * import_datetime() @@ -14591,135 +18398,135 @@ if (!__Pyx_RefNanny) { * "DDMMYYB", "DDMMYYB10", "DDMMYYC", "DDMMYYC10", "DDMMYYD", "DDMMYYD10", * "DDMMYYN6", "DDMMYYN8", "DDMMYYP", "DDMMYYP10", "DDMMYYS", "DDMMYYS10", */ - __pyx_t_2 = PyList_New(41); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(41); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_WEEKDATE); __Pyx_GIVEREF(__pyx_n_s_WEEKDATE); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_WEEKDATE); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_WEEKDATE); __Pyx_INCREF(__pyx_n_s_MMDDYY); __Pyx_GIVEREF(__pyx_n_s_MMDDYY); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_MMDDYY); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_MMDDYY); __Pyx_INCREF(__pyx_n_s_DDMMYY); __Pyx_GIVEREF(__pyx_n_s_DDMMYY); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_DDMMYY); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_DDMMYY); __Pyx_INCREF(__pyx_n_s_YYMMDD); __Pyx_GIVEREF(__pyx_n_s_YYMMDD); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_YYMMDD); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_YYMMDD); __Pyx_INCREF(__pyx_n_s_DATE); __Pyx_GIVEREF(__pyx_n_s_DATE); - PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_DATE); + PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_DATE); __Pyx_INCREF(__pyx_n_s_DATE9); __Pyx_GIVEREF(__pyx_n_s_DATE9); - PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_DATE9); + PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_DATE9); __Pyx_INCREF(__pyx_n_s_YYMMDD10); __Pyx_GIVEREF(__pyx_n_s_YYMMDD10); - PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_YYMMDD10); + PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_YYMMDD10); __Pyx_INCREF(__pyx_n_s_DDMMYYB); __Pyx_GIVEREF(__pyx_n_s_DDMMYYB); - PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_DDMMYYB); + PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_s_DDMMYYB); __Pyx_INCREF(__pyx_n_s_DDMMYYB10); __Pyx_GIVEREF(__pyx_n_s_DDMMYYB10); - PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_DDMMYYB10); + PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_DDMMYYB10); __Pyx_INCREF(__pyx_n_s_DDMMYYC); __Pyx_GIVEREF(__pyx_n_s_DDMMYYC); - PyList_SET_ITEM(__pyx_t_2, 9, __pyx_n_s_DDMMYYC); + PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_s_DDMMYYC); __Pyx_INCREF(__pyx_n_s_DDMMYYC10); __Pyx_GIVEREF(__pyx_n_s_DDMMYYC10); - PyList_SET_ITEM(__pyx_t_2, 10, __pyx_n_s_DDMMYYC10); + PyList_SET_ITEM(__pyx_t_3, 10, __pyx_n_s_DDMMYYC10); __Pyx_INCREF(__pyx_n_s_DDMMYYD); __Pyx_GIVEREF(__pyx_n_s_DDMMYYD); - PyList_SET_ITEM(__pyx_t_2, 11, __pyx_n_s_DDMMYYD); + PyList_SET_ITEM(__pyx_t_3, 11, __pyx_n_s_DDMMYYD); __Pyx_INCREF(__pyx_n_s_DDMMYYD10); __Pyx_GIVEREF(__pyx_n_s_DDMMYYD10); - PyList_SET_ITEM(__pyx_t_2, 12, __pyx_n_s_DDMMYYD10); + PyList_SET_ITEM(__pyx_t_3, 12, __pyx_n_s_DDMMYYD10); __Pyx_INCREF(__pyx_n_s_DDMMYYN6); __Pyx_GIVEREF(__pyx_n_s_DDMMYYN6); - PyList_SET_ITEM(__pyx_t_2, 13, __pyx_n_s_DDMMYYN6); + PyList_SET_ITEM(__pyx_t_3, 13, __pyx_n_s_DDMMYYN6); __Pyx_INCREF(__pyx_n_s_DDMMYYN8); __Pyx_GIVEREF(__pyx_n_s_DDMMYYN8); - PyList_SET_ITEM(__pyx_t_2, 14, __pyx_n_s_DDMMYYN8); + PyList_SET_ITEM(__pyx_t_3, 14, __pyx_n_s_DDMMYYN8); __Pyx_INCREF(__pyx_n_s_DDMMYYP); __Pyx_GIVEREF(__pyx_n_s_DDMMYYP); - PyList_SET_ITEM(__pyx_t_2, 15, __pyx_n_s_DDMMYYP); + PyList_SET_ITEM(__pyx_t_3, 15, __pyx_n_s_DDMMYYP); __Pyx_INCREF(__pyx_n_s_DDMMYYP10); __Pyx_GIVEREF(__pyx_n_s_DDMMYYP10); - PyList_SET_ITEM(__pyx_t_2, 16, __pyx_n_s_DDMMYYP10); + PyList_SET_ITEM(__pyx_t_3, 16, __pyx_n_s_DDMMYYP10); __Pyx_INCREF(__pyx_n_s_DDMMYYS); __Pyx_GIVEREF(__pyx_n_s_DDMMYYS); - PyList_SET_ITEM(__pyx_t_2, 17, __pyx_n_s_DDMMYYS); + PyList_SET_ITEM(__pyx_t_3, 17, __pyx_n_s_DDMMYYS); __Pyx_INCREF(__pyx_n_s_DDMMYYS10); __Pyx_GIVEREF(__pyx_n_s_DDMMYYS10); - PyList_SET_ITEM(__pyx_t_2, 18, __pyx_n_s_DDMMYYS10); + PyList_SET_ITEM(__pyx_t_3, 18, __pyx_n_s_DDMMYYS10); __Pyx_INCREF(__pyx_n_s_MMDDYYB); __Pyx_GIVEREF(__pyx_n_s_MMDDYYB); - PyList_SET_ITEM(__pyx_t_2, 19, __pyx_n_s_MMDDYYB); + PyList_SET_ITEM(__pyx_t_3, 19, __pyx_n_s_MMDDYYB); __Pyx_INCREF(__pyx_n_s_MMDDYYB10); __Pyx_GIVEREF(__pyx_n_s_MMDDYYB10); - PyList_SET_ITEM(__pyx_t_2, 20, __pyx_n_s_MMDDYYB10); + PyList_SET_ITEM(__pyx_t_3, 20, __pyx_n_s_MMDDYYB10); __Pyx_INCREF(__pyx_n_s_MMDDYYC); __Pyx_GIVEREF(__pyx_n_s_MMDDYYC); - PyList_SET_ITEM(__pyx_t_2, 21, __pyx_n_s_MMDDYYC); + PyList_SET_ITEM(__pyx_t_3, 21, __pyx_n_s_MMDDYYC); __Pyx_INCREF(__pyx_n_s_MMDDYYC10); __Pyx_GIVEREF(__pyx_n_s_MMDDYYC10); - PyList_SET_ITEM(__pyx_t_2, 22, __pyx_n_s_MMDDYYC10); + PyList_SET_ITEM(__pyx_t_3, 22, __pyx_n_s_MMDDYYC10); __Pyx_INCREF(__pyx_n_s_MMDDYYD); __Pyx_GIVEREF(__pyx_n_s_MMDDYYD); - PyList_SET_ITEM(__pyx_t_2, 23, __pyx_n_s_MMDDYYD); + PyList_SET_ITEM(__pyx_t_3, 23, __pyx_n_s_MMDDYYD); __Pyx_INCREF(__pyx_n_s_MMDDYYD10); __Pyx_GIVEREF(__pyx_n_s_MMDDYYD10); - PyList_SET_ITEM(__pyx_t_2, 24, __pyx_n_s_MMDDYYD10); + PyList_SET_ITEM(__pyx_t_3, 24, __pyx_n_s_MMDDYYD10); __Pyx_INCREF(__pyx_n_s_MMDDYYN6); __Pyx_GIVEREF(__pyx_n_s_MMDDYYN6); - PyList_SET_ITEM(__pyx_t_2, 25, __pyx_n_s_MMDDYYN6); + PyList_SET_ITEM(__pyx_t_3, 25, __pyx_n_s_MMDDYYN6); __Pyx_INCREF(__pyx_n_s_MMDDYYN8); __Pyx_GIVEREF(__pyx_n_s_MMDDYYN8); - PyList_SET_ITEM(__pyx_t_2, 26, __pyx_n_s_MMDDYYN8); + PyList_SET_ITEM(__pyx_t_3, 26, __pyx_n_s_MMDDYYN8); __Pyx_INCREF(__pyx_n_s_MMDDYYP); __Pyx_GIVEREF(__pyx_n_s_MMDDYYP); - PyList_SET_ITEM(__pyx_t_2, 27, __pyx_n_s_MMDDYYP); + PyList_SET_ITEM(__pyx_t_3, 27, __pyx_n_s_MMDDYYP); __Pyx_INCREF(__pyx_n_s_MMDDYYP10); __Pyx_GIVEREF(__pyx_n_s_MMDDYYP10); - PyList_SET_ITEM(__pyx_t_2, 28, __pyx_n_s_MMDDYYP10); + PyList_SET_ITEM(__pyx_t_3, 28, __pyx_n_s_MMDDYYP10); __Pyx_INCREF(__pyx_n_s_MMDDYYS); __Pyx_GIVEREF(__pyx_n_s_MMDDYYS); - PyList_SET_ITEM(__pyx_t_2, 29, __pyx_n_s_MMDDYYS); + PyList_SET_ITEM(__pyx_t_3, 29, __pyx_n_s_MMDDYYS); __Pyx_INCREF(__pyx_n_s_MMDDYYS10); __Pyx_GIVEREF(__pyx_n_s_MMDDYYS10); - PyList_SET_ITEM(__pyx_t_2, 30, __pyx_n_s_MMDDYYS10); + PyList_SET_ITEM(__pyx_t_3, 30, __pyx_n_s_MMDDYYS10); __Pyx_INCREF(__pyx_n_s_WEEKDATX); __Pyx_GIVEREF(__pyx_n_s_WEEKDATX); - PyList_SET_ITEM(__pyx_t_2, 31, __pyx_n_s_WEEKDATX); + PyList_SET_ITEM(__pyx_t_3, 31, __pyx_n_s_WEEKDATX); __Pyx_INCREF(__pyx_n_s_DTDATE); __Pyx_GIVEREF(__pyx_n_s_DTDATE); - PyList_SET_ITEM(__pyx_t_2, 32, __pyx_n_s_DTDATE); + PyList_SET_ITEM(__pyx_t_3, 32, __pyx_n_s_DTDATE); __Pyx_INCREF(__pyx_n_s_IS8601DA); __Pyx_GIVEREF(__pyx_n_s_IS8601DA); - PyList_SET_ITEM(__pyx_t_2, 33, __pyx_n_s_IS8601DA); + PyList_SET_ITEM(__pyx_t_3, 33, __pyx_n_s_IS8601DA); __Pyx_INCREF(__pyx_n_s_E8601DA); __Pyx_GIVEREF(__pyx_n_s_E8601DA); - PyList_SET_ITEM(__pyx_t_2, 34, __pyx_n_s_E8601DA); + PyList_SET_ITEM(__pyx_t_3, 34, __pyx_n_s_E8601DA); __Pyx_INCREF(__pyx_n_s_B8601DA); __Pyx_GIVEREF(__pyx_n_s_B8601DA); - PyList_SET_ITEM(__pyx_t_2, 35, __pyx_n_s_B8601DA); + PyList_SET_ITEM(__pyx_t_3, 35, __pyx_n_s_B8601DA); __Pyx_INCREF(__pyx_n_s_YYMMDDB); __Pyx_GIVEREF(__pyx_n_s_YYMMDDB); - PyList_SET_ITEM(__pyx_t_2, 36, __pyx_n_s_YYMMDDB); + PyList_SET_ITEM(__pyx_t_3, 36, __pyx_n_s_YYMMDDB); __Pyx_INCREF(__pyx_n_s_YYMMDDD); __Pyx_GIVEREF(__pyx_n_s_YYMMDDD); - PyList_SET_ITEM(__pyx_t_2, 37, __pyx_n_s_YYMMDDD); + PyList_SET_ITEM(__pyx_t_3, 37, __pyx_n_s_YYMMDDD); __Pyx_INCREF(__pyx_n_s_YYMMDDN); __Pyx_GIVEREF(__pyx_n_s_YYMMDDN); - PyList_SET_ITEM(__pyx_t_2, 38, __pyx_n_s_YYMMDDN); + PyList_SET_ITEM(__pyx_t_3, 38, __pyx_n_s_YYMMDDN); __Pyx_INCREF(__pyx_n_s_YYMMDDP); __Pyx_GIVEREF(__pyx_n_s_YYMMDDP); - PyList_SET_ITEM(__pyx_t_2, 39, __pyx_n_s_YYMMDDP); + PyList_SET_ITEM(__pyx_t_3, 39, __pyx_n_s_YYMMDDP); __Pyx_INCREF(__pyx_n_s_YYMMDDS); __Pyx_GIVEREF(__pyx_n_s_YYMMDDS); - PyList_SET_ITEM(__pyx_t_2, 40, __pyx_n_s_YYMMDDS); + PyList_SET_ITEM(__pyx_t_3, 40, __pyx_n_s_YYMMDDS); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_date_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":48 * "IS8601DA", "E8601DA", "B8601DA", @@ -14728,48 +18535,48 @@ if (!__Pyx_RefNanny) { * "E8601DT", "DATEAMPM", "MDYAMPM", "IS8601DT", "B8601DT", "B8601DN"] * cdef list sas_time_formats = ["TIME", "HHMM", "TIME20.3", "TIME20", "TIME5", "TOD", "TIMEAMPM", "IS8601TM", "E8601TM", "B8601TM", ] */ - __pyx_t_2 = PyList_New(12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_DATETIME); __Pyx_GIVEREF(__pyx_n_s_DATETIME); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DATETIME); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_DATETIME); __Pyx_INCREF(__pyx_n_s_DATETIME18); __Pyx_GIVEREF(__pyx_n_s_DATETIME18); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DATETIME18); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_DATETIME18); __Pyx_INCREF(__pyx_n_s_DATETIME19); __Pyx_GIVEREF(__pyx_n_s_DATETIME19); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_DATETIME19); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_DATETIME19); __Pyx_INCREF(__pyx_n_s_DATETIME20); __Pyx_GIVEREF(__pyx_n_s_DATETIME20); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_DATETIME20); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_DATETIME20); __Pyx_INCREF(__pyx_n_s_DATETIME21); __Pyx_GIVEREF(__pyx_n_s_DATETIME21); - PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_DATETIME21); + PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_DATETIME21); __Pyx_INCREF(__pyx_n_s_DATETIME22); __Pyx_GIVEREF(__pyx_n_s_DATETIME22); - PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_DATETIME22); + PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_DATETIME22); __Pyx_INCREF(__pyx_n_s_E8601DT); __Pyx_GIVEREF(__pyx_n_s_E8601DT); - PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_E8601DT); + PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_E8601DT); __Pyx_INCREF(__pyx_n_s_DATEAMPM); __Pyx_GIVEREF(__pyx_n_s_DATEAMPM); - PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_DATEAMPM); + PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_s_DATEAMPM); __Pyx_INCREF(__pyx_n_s_MDYAMPM); __Pyx_GIVEREF(__pyx_n_s_MDYAMPM); - PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_MDYAMPM); + PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_MDYAMPM); __Pyx_INCREF(__pyx_n_s_IS8601DT); __Pyx_GIVEREF(__pyx_n_s_IS8601DT); - PyList_SET_ITEM(__pyx_t_2, 9, __pyx_n_s_IS8601DT); + PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_s_IS8601DT); __Pyx_INCREF(__pyx_n_s_B8601DT); __Pyx_GIVEREF(__pyx_n_s_B8601DT); - PyList_SET_ITEM(__pyx_t_2, 10, __pyx_n_s_B8601DT); + PyList_SET_ITEM(__pyx_t_3, 10, __pyx_n_s_B8601DT); __Pyx_INCREF(__pyx_n_s_B8601DN); __Pyx_GIVEREF(__pyx_n_s_B8601DN); - PyList_SET_ITEM(__pyx_t_2, 11, __pyx_n_s_B8601DN); + PyList_SET_ITEM(__pyx_t_3, 11, __pyx_n_s_B8601DN); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_datetime_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":50 * cdef list sas_datetime_formats = ["DATETIME", "DATETIME18", "DATETIME19", "DATETIME20", "DATETIME21", "DATETIME22", @@ -14778,42 +18585,42 @@ if (!__Pyx_RefNanny) { * # "HOUR" # these do not print as full time formats in sas * #cdef list sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats */ - __pyx_t_2 = PyList_New(10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_TIME); __Pyx_GIVEREF(__pyx_n_s_TIME); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_TIME); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_TIME); __Pyx_INCREF(__pyx_n_s_HHMM); __Pyx_GIVEREF(__pyx_n_s_HHMM); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_HHMM); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_HHMM); __Pyx_INCREF(__pyx_kp_s_TIME20_3); __Pyx_GIVEREF(__pyx_kp_s_TIME20_3); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_kp_s_TIME20_3); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_kp_s_TIME20_3); __Pyx_INCREF(__pyx_n_s_TIME20); __Pyx_GIVEREF(__pyx_n_s_TIME20); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_TIME20); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_TIME20); __Pyx_INCREF(__pyx_n_s_TIME5); __Pyx_GIVEREF(__pyx_n_s_TIME5); - PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_TIME5); + PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_TIME5); __Pyx_INCREF(__pyx_n_s_TOD); __Pyx_GIVEREF(__pyx_n_s_TOD); - PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_TOD); + PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_TOD); __Pyx_INCREF(__pyx_n_s_TIMEAMPM); __Pyx_GIVEREF(__pyx_n_s_TIMEAMPM); - PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_TIMEAMPM); + PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_TIMEAMPM); __Pyx_INCREF(__pyx_n_s_IS8601TM); __Pyx_GIVEREF(__pyx_n_s_IS8601TM); - PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_IS8601TM); + PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_s_IS8601TM); __Pyx_INCREF(__pyx_n_s_E8601TM); __Pyx_GIVEREF(__pyx_n_s_E8601TM); - PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_E8601TM); + PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_E8601TM); __Pyx_INCREF(__pyx_n_s_B8601TM); __Pyx_GIVEREF(__pyx_n_s_B8601TM); - PyList_SET_ITEM(__pyx_t_2, 9, __pyx_n_s_B8601TM); + PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_s_B8601TM); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_time_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_time_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_time_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":54 * #cdef list sas_all_formats = sas_date_formats + sas_datetime_formats + sas_time_formats @@ -14822,12 +18629,12 @@ if (!__Pyx_RefNanny) { * * cdef list spss_datetime_formats = ["DATETIME", "DATETIME8", 'DATETIME17', 'DATETIME20', 'DATETIME23.2',"YMDHMS16","YMDHMS19","YMDHMS19.2", "YMDHMS20"] */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_datetime_new(0x7A8, 1, 1, 0, 0, 0, 0, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_7cpython_8datetime_datetime_new(0x7A8, 1, 1, 0, 0, 0, 0, Py_None, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_sas_origin); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_origin, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_sas_origin, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":56 * cdef object sas_origin = datetime_new(1960, 1, 1, 0, 0, 0, 0, None) @@ -14836,39 +18643,39 @@ if (!__Pyx_RefNanny) { * cdef list spss_date_formats = ["DATE",'DATE8','DATE11', 'DATE12', "ADATE","ADATE8", "ADATE10", "EDATE", 'EDATE8','EDATE10', "JDATE", "JDATE5", "JDATE7", "SDATE", "SDATE8", "SDATE10",] * cdef list spss_time_formats = ["TIME", "DTIME", 'TIME8', 'TIME5', 'TIME11.2'] */ - __pyx_t_2 = PyList_New(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_DATETIME); __Pyx_GIVEREF(__pyx_n_s_DATETIME); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DATETIME); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_DATETIME); __Pyx_INCREF(__pyx_n_s_DATETIME8); __Pyx_GIVEREF(__pyx_n_s_DATETIME8); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DATETIME8); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_DATETIME8); __Pyx_INCREF(__pyx_n_s_DATETIME17); __Pyx_GIVEREF(__pyx_n_s_DATETIME17); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_DATETIME17); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_DATETIME17); __Pyx_INCREF(__pyx_n_s_DATETIME20); __Pyx_GIVEREF(__pyx_n_s_DATETIME20); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_DATETIME20); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_DATETIME20); __Pyx_INCREF(__pyx_kp_s_DATETIME23_2); __Pyx_GIVEREF(__pyx_kp_s_DATETIME23_2); - PyList_SET_ITEM(__pyx_t_2, 4, __pyx_kp_s_DATETIME23_2); + PyList_SET_ITEM(__pyx_t_3, 4, __pyx_kp_s_DATETIME23_2); __Pyx_INCREF(__pyx_n_s_YMDHMS16); __Pyx_GIVEREF(__pyx_n_s_YMDHMS16); - PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_YMDHMS16); + PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_YMDHMS16); __Pyx_INCREF(__pyx_n_s_YMDHMS19); __Pyx_GIVEREF(__pyx_n_s_YMDHMS19); - PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_YMDHMS19); + PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_YMDHMS19); __Pyx_INCREF(__pyx_kp_s_YMDHMS19_2); __Pyx_GIVEREF(__pyx_kp_s_YMDHMS19_2); - PyList_SET_ITEM(__pyx_t_2, 7, __pyx_kp_s_YMDHMS19_2); + PyList_SET_ITEM(__pyx_t_3, 7, __pyx_kp_s_YMDHMS19_2); __Pyx_INCREF(__pyx_n_s_YMDHMS20); __Pyx_GIVEREF(__pyx_n_s_YMDHMS20); - PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_YMDHMS20); + PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_YMDHMS20); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_datetime_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":57 * @@ -14877,60 +18684,60 @@ if (!__Pyx_RefNanny) { * cdef list spss_time_formats = ["TIME", "DTIME", 'TIME8', 'TIME5', 'TIME11.2'] * #cdef list spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats */ - __pyx_t_2 = PyList_New(16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_DATE); __Pyx_GIVEREF(__pyx_n_s_DATE); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DATE); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_DATE); __Pyx_INCREF(__pyx_n_s_DATE8); __Pyx_GIVEREF(__pyx_n_s_DATE8); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DATE8); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_DATE8); __Pyx_INCREF(__pyx_n_s_DATE11); __Pyx_GIVEREF(__pyx_n_s_DATE11); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_DATE11); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_DATE11); __Pyx_INCREF(__pyx_n_s_DATE12); __Pyx_GIVEREF(__pyx_n_s_DATE12); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_DATE12); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_DATE12); __Pyx_INCREF(__pyx_n_s_ADATE); __Pyx_GIVEREF(__pyx_n_s_ADATE); - PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_ADATE); + PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_ADATE); __Pyx_INCREF(__pyx_n_s_ADATE8); __Pyx_GIVEREF(__pyx_n_s_ADATE8); - PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_ADATE8); + PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_ADATE8); __Pyx_INCREF(__pyx_n_s_ADATE10); __Pyx_GIVEREF(__pyx_n_s_ADATE10); - PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_ADATE10); + PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_ADATE10); __Pyx_INCREF(__pyx_n_s_EDATE); __Pyx_GIVEREF(__pyx_n_s_EDATE); - PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_EDATE); + PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_s_EDATE); __Pyx_INCREF(__pyx_n_s_EDATE8); __Pyx_GIVEREF(__pyx_n_s_EDATE8); - PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_EDATE8); + PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_EDATE8); __Pyx_INCREF(__pyx_n_s_EDATE10); __Pyx_GIVEREF(__pyx_n_s_EDATE10); - PyList_SET_ITEM(__pyx_t_2, 9, __pyx_n_s_EDATE10); + PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_s_EDATE10); __Pyx_INCREF(__pyx_n_s_JDATE); __Pyx_GIVEREF(__pyx_n_s_JDATE); - PyList_SET_ITEM(__pyx_t_2, 10, __pyx_n_s_JDATE); + PyList_SET_ITEM(__pyx_t_3, 10, __pyx_n_s_JDATE); __Pyx_INCREF(__pyx_n_s_JDATE5); __Pyx_GIVEREF(__pyx_n_s_JDATE5); - PyList_SET_ITEM(__pyx_t_2, 11, __pyx_n_s_JDATE5); + PyList_SET_ITEM(__pyx_t_3, 11, __pyx_n_s_JDATE5); __Pyx_INCREF(__pyx_n_s_JDATE7); __Pyx_GIVEREF(__pyx_n_s_JDATE7); - PyList_SET_ITEM(__pyx_t_2, 12, __pyx_n_s_JDATE7); + PyList_SET_ITEM(__pyx_t_3, 12, __pyx_n_s_JDATE7); __Pyx_INCREF(__pyx_n_s_SDATE); __Pyx_GIVEREF(__pyx_n_s_SDATE); - PyList_SET_ITEM(__pyx_t_2, 13, __pyx_n_s_SDATE); + PyList_SET_ITEM(__pyx_t_3, 13, __pyx_n_s_SDATE); __Pyx_INCREF(__pyx_n_s_SDATE8); __Pyx_GIVEREF(__pyx_n_s_SDATE8); - PyList_SET_ITEM(__pyx_t_2, 14, __pyx_n_s_SDATE8); + PyList_SET_ITEM(__pyx_t_3, 14, __pyx_n_s_SDATE8); __Pyx_INCREF(__pyx_n_s_SDATE10); __Pyx_GIVEREF(__pyx_n_s_SDATE10); - PyList_SET_ITEM(__pyx_t_2, 15, __pyx_n_s_SDATE10); + PyList_SET_ITEM(__pyx_t_3, 15, __pyx_n_s_SDATE10); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_date_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":58 * cdef list spss_datetime_formats = ["DATETIME", "DATETIME8", 'DATETIME17', 'DATETIME20', 'DATETIME23.2',"YMDHMS16","YMDHMS19","YMDHMS19.2", "YMDHMS20"] @@ -14939,27 +18746,27 @@ if (!__Pyx_RefNanny) { * #cdef list spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats * cdef list spss_all_formats */ - __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_TIME); __Pyx_GIVEREF(__pyx_n_s_TIME); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_TIME); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_TIME); __Pyx_INCREF(__pyx_n_s_DTIME); __Pyx_GIVEREF(__pyx_n_s_DTIME); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DTIME); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_DTIME); __Pyx_INCREF(__pyx_n_s_TIME8); __Pyx_GIVEREF(__pyx_n_s_TIME8); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_TIME8); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_TIME8); __Pyx_INCREF(__pyx_n_s_TIME5); __Pyx_GIVEREF(__pyx_n_s_TIME5); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_TIME5); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_TIME5); __Pyx_INCREF(__pyx_kp_s_TIME11_2); __Pyx_GIVEREF(__pyx_kp_s_TIME11_2); - PyList_SET_ITEM(__pyx_t_2, 4, __pyx_kp_s_TIME11_2); + PyList_SET_ITEM(__pyx_t_3, 4, __pyx_kp_s_TIME11_2); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_time_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_time_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_time_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":61 * #cdef list spss_all_formats = spss_date_formats + spss_datetime_formats + spss_time_formats @@ -14968,12 +18775,12 @@ if (!__Pyx_RefNanny) { * * cdef list stata_datetime_formats = ["%tC", "%tc"] */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_datetime_new(0x62E, 10, 14, 0, 0, 0, 0, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_7cpython_8datetime_datetime_new(0x62E, 10, 14, 0, 0, 0, 0, Py_None, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_spss_origin); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_origin, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_spss_origin, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":63 * cdef object spss_origin = datetime_new(1582, 10, 14, 0, 0, 0, 0, None) @@ -14982,18 +18789,18 @@ if (!__Pyx_RefNanny) { * cdef list stata_date_formats = ["%td", "%d", "%tdD_m_Y", "%tdCCYY-NN-DD"] * cdef list stata_time_formats = ["%tcHH:MM:SS", "%tcHH:MM"] */ - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_kp_s_tC); __Pyx_GIVEREF(__pyx_kp_s_tC); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_tC); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_tC); __Pyx_INCREF(__pyx_kp_s_tc); __Pyx_GIVEREF(__pyx_kp_s_tc); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_s_tc); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_kp_s_tc); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_datetime_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":64 * @@ -15002,24 +18809,24 @@ if (!__Pyx_RefNanny) { * cdef list stata_time_formats = ["%tcHH:MM:SS", "%tcHH:MM"] * #cdef list stata_all_formats = stata_datetime_formats + stata_date_formats + stata_time_formats */ - __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_kp_s_td); __Pyx_GIVEREF(__pyx_kp_s_td); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_td); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_td); __Pyx_INCREF(__pyx_kp_s_d); __Pyx_GIVEREF(__pyx_kp_s_d); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_s_d); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_kp_s_d); __Pyx_INCREF(__pyx_kp_s_tdD_m_Y); __Pyx_GIVEREF(__pyx_kp_s_tdD_m_Y); - PyList_SET_ITEM(__pyx_t_2, 2, __pyx_kp_s_tdD_m_Y); + PyList_SET_ITEM(__pyx_t_3, 2, __pyx_kp_s_tdD_m_Y); __Pyx_INCREF(__pyx_kp_s_tdCCYY_NN_DD); __Pyx_GIVEREF(__pyx_kp_s_tdCCYY_NN_DD); - PyList_SET_ITEM(__pyx_t_2, 3, __pyx_kp_s_tdCCYY_NN_DD); + PyList_SET_ITEM(__pyx_t_3, 3, __pyx_kp_s_tdCCYY_NN_DD); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_date_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":65 * cdef list stata_datetime_formats = ["%tC", "%tc"] @@ -15028,18 +18835,18 @@ if (!__Pyx_RefNanny) { * #cdef list stata_all_formats = stata_datetime_formats + stata_date_formats + stata_time_formats * cdef list stata_all_formats */ - __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_kp_s_tcHH_MM_SS); __Pyx_GIVEREF(__pyx_kp_s_tcHH_MM_SS); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_tcHH_MM_SS); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_s_tcHH_MM_SS); __Pyx_INCREF(__pyx_kp_s_tcHH_MM); __Pyx_GIVEREF(__pyx_kp_s_tcHH_MM); - PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_s_tcHH_MM); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_kp_s_tcHH_MM); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_time_formats); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_time_formats, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_time_formats, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":68 * #cdef list stata_all_formats = stata_datetime_formats + stata_date_formats + stata_time_formats @@ -15048,12 +18855,12 @@ if (!__Pyx_RefNanny) { * * cdef dict readstat_to_numpy_types = {READSTAT_TYPE_STRING: object, READSTAT_TYPE_STRING_REF: object, */ - __pyx_t_2 = __pyx_f_7cpython_8datetime_datetime_new(0x7A8, 1, 1, 0, 0, 0, 0, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_7cpython_8datetime_datetime_new(0x7A8, 1, 1, 0, 0, 0, 0, Py_None, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_stata_origin); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_origin, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_stata_origin, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":70 * cdef object stata_origin = datetime_new(1960, 1, 1, 0, 0, 0, 0, None) @@ -15062,16 +18869,16 @@ if (!__Pyx_RefNanny) { * READSTAT_TYPE_INT8: np.int64, READSTAT_TYPE_INT16: np.int64, READSTAT_TYPE_INT32:np.int64, * READSTAT_TYPE_FLOAT: np.float64, READSTAT_TYPE_DOUBLE: np.float64} */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_builtin_object) < 0) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING_REF); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_builtin_object) < 0) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_builtin_object) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING_REF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_builtin_object) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/_readstat_parser.pyx":71 * @@ -15080,36 +18887,36 @@ if (!__Pyx_RefNanny) { * READSTAT_TYPE_FLOAT: np.float64, READSTAT_TYPE_DOUBLE: np.float64} * */ - __pyx_t_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_5) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_t_3) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_t_5, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_t_4, __pyx_t_2) < 0) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_1) < 0) __PYX_ERR(0, 70, __pyx_L1_error) - __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; /* "pyreadstat/_readstat_parser.pyx":72 * cdef dict readstat_to_numpy_types = {READSTAT_TYPE_STRING: object, READSTAT_TYPE_STRING_REF: object, @@ -15118,30 +18925,51 @@ if (!__Pyx_RefNanny) { * * cdef class data_container: */ - __pyx_t_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_FLOAT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_FLOAT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_5) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_t_4, __pyx_t_3) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_t_5, __pyx_t_4) < 0) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_16_readstat_parser_14data_container_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_data_container___reduce_cython, NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * 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_3 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_16_readstat_parser_14data_container_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_data_container___setstate_cython, NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_parser.pyx":116 * self.no_datetime_conversion = 0 @@ -15150,8 +18978,8 @@ if (!__Pyx_RefNanny) { * """ * This class holds metadata we want to give back to python */ - __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_metadata_container, __pyx_n_s_metadata_container, (PyObject *) NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_kp_s_This_class_holds_metadata_we_wa); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_metadata_container, __pyx_n_s_metadata_container, (PyObject *) NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_kp_s_This_class_holds_metadata_we_wa); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); /* "pyreadstat/_readstat_parser.pyx":120 * This class holds metadata we want to give back to python @@ -15160,10 +18988,10 @@ if (!__Pyx_RefNanny) { * self.column_names = list() * self.column_labels = list() */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_16_readstat_parser_18metadata_container_1__init__, 0, __pyx_n_s_metadata_container___init, NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __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, 120, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_16_readstat_parser_18metadata_container_1__init__, 0, __pyx_n_s_metadata_container___init, NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "pyreadstat/_readstat_parser.pyx":116 * self.no_datetime_conversion = 0 @@ -15172,11 +19000,11 @@ if (!__Pyx_RefNanny) { * """ * This class holds metadata we want to give back to python */ - __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_metadata_container, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_metadata_container, __pyx_t_3) < 0) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_metadata_container, __pyx_empty_tuple, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_metadata_container, __pyx_t_4) < 0) __PYX_ERR(0, 116, __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; /* "pyreadstat/_readstat_parser.pyx":142 * @@ -15185,136 +19013,697 @@ if (!__Pyx_RefNanny) { * """ * Just defining a custom exception to raise when readstat gives an error return code. */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); + __Pyx_GIVEREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_4 = __Pyx_PEP560_update_bases(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_4, __pyx_n_s_ReadstatError, __pyx_n_s_ReadstatError, (PyObject *) NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_kp_s_Just_defining_a_custom_exceptio); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__pyx_t_4 != __pyx_t_3) { + if (unlikely((PyDict_SetItemString(__pyx_t_2, "__orig_bases__", __pyx_t_3) < 0))) __PYX_ERR(0, 142, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_n_s_ReadstatError, __pyx_t_4, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadstatError, __pyx_t_3) < 0) __PYX_ERR(0, 142, __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_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "pyreadstat/_readstat_parser.pyx":148 + * pass + * + * class PyreadstatError(Exception): # <<<<<<<<<<<<<< + * """ + * Just defining a custom exception to raise when pyreadstat raises an exception. + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); + __Pyx_GIVEREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_5 = __Pyx_PEP560_update_bases(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_5, __pyx_n_s_PyreadstatError, __pyx_n_s_PyreadstatError, (PyObject *) NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_kp_s_Just_defining_a_custom_exceptio_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_2, __pyx_n_s_ReadstatError, __pyx_n_s_ReadstatError, (PyObject *) NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_kp_s_Just_defining_a_custom_exceptio); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) + if (__pyx_t_5 != __pyx_t_4) { + if (unlikely((PyDict_SetItemString(__pyx_t_3, "__orig_bases__", __pyx_t_4) < 0))) __PYX_ERR(0, 148, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_PyreadstatError, __pyx_t_5, __pyx_t_3, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ReadstatError, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadstatError, __pyx_t_1) < 0) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PyreadstatError, __pyx_t_4) < 0) __PYX_ERR(0, 148, __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_5); __pyx_t_5 = 0; + + /* "pyreadstat/_readstat_parser.pyx":1 + * # cython: c_string_type=unicode, c_string_encoding=utf8, language_level=2 # <<<<<<<<<<<<<< + * + * # ############################################################################# + */ + __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init pyreadstat._readstat_parser", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init pyreadstat._readstat_parser"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif - /* "pyreadstat/_readstat_parser.pyx":148 - * pass - * - * class PyreadstatError(Exception): # <<<<<<<<<<<<<< - * """ - * Just defining a custom exception to raise when pyreadstat raises an exception. - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_2, __pyx_n_s_PyreadstatError, __pyx_n_s_PyreadstatError, (PyObject *) NULL, __pyx_n_s_pyreadstat__readstat_parser, __pyx_kp_s_Just_defining_a_custom_exceptio_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_PyreadstatError, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PyreadstatError, __pyx_t_1) < 0) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __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; +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} - /* "pyreadstat/_readstat_parser.pyx":1 - * # cython: c_string_type=unicode, c_string_encoding=utf8, language_level=2 # <<<<<<<<<<<<<< - * - * # ############################################################################# - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} - /* "cpython/datetime.pxd":211 - * - * # Get microseconds of timedelta - * cdef inline int timedelta_microseconds(object o): # <<<<<<<<<<<<<< - * return (o).microseconds - */ +/* ExtTypeTest */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + __Pyx_TypeName obj_type_name; + __Pyx_TypeName type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_TypeError, + "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME, + obj_type_name, type_name); + __Pyx_DECREF_TypeName(obj_type_name); + __Pyx_DECREF_TypeName(type_name); + return 0; +} - /*--- Wrapped vars code ---*/ +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init pyreadstat._readstat_parser", __pyx_clineno, __pyx_lineno, __pyx_filename); +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init pyreadstat._readstat_parser"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#endif + } +bad: + Py_XDECREF(owned_instance); + return; } +#endif -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; } #endif -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } #endif - return PyObject_GetAttr(obj, attr_name); -} + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } #endif +} -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); #else - "name '%.200s' is not defined", PyString_AS_STRING(name)); +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; #endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; } - return result; + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) } +#endif /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( @@ -15344,25 +19733,41 @@ static void __Pyx_RaiseArgtupleInvalid( /* KeywordStringCheck */ static int __Pyx_CheckKeywordStrings( - PyObject *kwdict, + PyObject *kw, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; #if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) goto invalid_keyword; return 1; #else - while (PyDict_Next(kwdict, &pos, &key, 0)) { + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + if (unlikely(PyTuple_GET_SIZE(kw) == 0)) + return 1; + if (!kw_allowed) { + key = PyTuple_GET_ITEM(kw, 0); + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < PyTuple_GET_SIZE(kw); pos++) { + key = PyTuple_GET_ITEM(kw, pos); + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_Check(key))) #endif if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; } - if ((!kw_allowed) && unlikely(key)) + if (!kw_allowed && unlikely(key)) goto invalid_keyword; return 1; invalid_keyword_type: @@ -15371,219 +19776,147 @@ static int __Pyx_CheckKeywordStrings( return 0; #endif invalid_keyword: - PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else + PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif } -#endif -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + if (kwds_is_tuple) { + if (pos >= PyTuple_GET_SIZE(kwds)) break; + key = PyTuple_GET_ITEM(kwds, pos); + value = kwvalues[pos]; + pos++; } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; } + name++; } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + goto invalid_keyword; } -#endif } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif bad: - Py_XDECREF(owned_instance); - return; + return -1; } -#endif /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS @@ -15599,49 +19932,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr } #endif -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* None */ +/* ModFloat[double] */ static CYTHON_INLINE double __Pyx_mod_double(double a, double b) { double r = fmod(a, b); r += ((r != 0) & ((r < 0) ^ (b < 0))) * b; @@ -15649,7 +19940,7 @@ static CYTHON_INLINE double __Pyx_mod_double(double a, double b) { } /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -15678,7 +19969,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -15694,7 +19984,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -15765,7 +20055,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON @@ -15787,95 +20076,87 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallNoArg */ +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) #else - if (likely(PyCFunction_Check(func))) + if (PyCFunction_Check(func)) #endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } } } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } } -} #endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } + #endif + #endif + #if CYTHON_VECTORCALL + vectorcallfunc f = _PyVectorcall_Function(func); + if (f) { + return f(func, args, (size_t)nargs, kwargs); } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); + } + #endif + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } -#endif /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -15936,10 +20217,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, 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); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -15948,7 +20237,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -16002,6 +20291,14 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) } else if (unlikely(PyErr_Occurred())) { return NULL; } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) @@ -16020,38 +20317,78 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) return __Pyx_GetBuiltinName(name); } -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); +/* RaiseUnboundLocalError */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* UnicodeConcatInPlace */ +# if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +static int +__Pyx_unicode_modifiable(PyObject *unicode) +{ + if (Py_REFCNT(unicode) != 1) + return 0; + if (!PyUnicode_CheckExact(unicode)) + return 0; + if (PyUnicode_CHECK_INTERNED(unicode)) + return 0; + return 1; +} +static CYTHON_INLINE PyObject *__Pyx_PyUnicode_ConcatInPlaceImpl(PyObject **p_left, PyObject *right + #if CYTHON_REFNANNY + , void* __pyx_refnanny + #endif + ) { + PyObject *left = *p_left; + Py_ssize_t left_len, right_len, new_len; + if (unlikely(__Pyx_PyUnicode_READY(left) == -1)) + return NULL; + if (unlikely(__Pyx_PyUnicode_READY(right) == -1)) + return NULL; + left_len = PyUnicode_GET_LENGTH(left); + if (left_len == 0) { + Py_INCREF(right); + return right; + } + right_len = PyUnicode_GET_LENGTH(right); + if (right_len == 0) { + Py_INCREF(left); + return left; + } + if (unlikely(left_len > PY_SSIZE_T_MAX - right_len)) { + PyErr_SetString(PyExc_OverflowError, + "strings are too large to concat"); + return NULL; } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); + new_len = left_len + right_len; + if (__Pyx_unicode_modifiable(left) + && PyUnicode_CheckExact(right) + && PyUnicode_KIND(right) <= PyUnicode_KIND(left) + && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) { + __Pyx_GIVEREF(*p_left); + if (unlikely(PyUnicode_Resize(p_left, new_len) != 0)) { + __Pyx_GOTREF(*p_left); + return NULL; + } + __Pyx_INCREF(*p_left); + _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len); + return *p_left; + } else { + return __Pyx_PyUnicode_Concat(left, right); } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} + } +#endif -/* None */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; } /* DictGetItem */ @@ -16081,7 +20418,7 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { /* SetItemInt */ static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; - if (!j) return -1; + if (unlikely(!j)) return -1; r = PyObject_SetItem(o, j, v); Py_DECREF(j); return r; @@ -16099,10 +20436,19 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje 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); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_ass_subscript) { + int r; + PyObject *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return -1; + r = mm->mp_ass_subscript(o, key, v); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -16111,7 +20457,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje PyErr_Clear(); } } - return m->sq_ass_item(o, i, v); + return sm->sq_ass_item(o, i, v); } } #else @@ -16131,7 +20477,8 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, 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) { + int has_cstart, int has_cstop, int wraparound) { + __Pyx_TypeName obj_type_name; #if CYTHON_USE_TYPE_SLOTS PyMappingMethods* mp; #if PY_MAJOR_VERSION < 3 @@ -16170,9 +20517,13 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, } return ms->sq_ass_slice(obj, cstart, cstop, value); } +#else + CYTHON_UNUSED_VAR(wraparound); #endif mp = Py_TYPE(obj)->tp_as_mapping; if (likely(mp && mp->mp_ass_subscript)) +#else + CYTHON_UNUSED_VAR(wraparound); #endif { int result; @@ -16218,14 +20569,35 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, } return result; } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, - "'%.200s' object does not support slice %.10s", - Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion"); + "'" __Pyx_FMT_TYPENAME "' object does not support slice %.10s", + obj_type_name, value ? "assignment" : "deletion"); + __Pyx_DECREF_TypeName(obj_type_name); bad: return -1; } +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* UnpackUnboundCMethod */ +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + PyObject *result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), + METH_VARARGS | METH_KEYWORDS, + NULL +}; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); @@ -16235,13 +20607,43 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #else + if (likely(!PyCFunction_Check(method))) #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); - } + } else +#endif +#if defined(CYTHON_COMPILING_IN_PYPY) +#elif PY_VERSION_HEX >= 0x03090000 + if (PyCFunction_CheckExact(method)) +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); #endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + target->method = unbound_method; + } + } return 0; } @@ -16252,13 +20654,13 @@ static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* 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) { + } 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 { + #else return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + #endif + } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } } @@ -16356,7 +20758,7 @@ static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObje /* 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 +#if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (unlikely(PyErr_Occurred())) @@ -16383,10 +20785,17 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec return value; } +/* PyObjectCall2Args */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* PyObjectGetMethod */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrgetfunc f = NULL; @@ -16403,11 +20812,13 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me descr = _PyType_Lookup(tp, name); if (likely(descr != NULL)) { Py_INCREF(descr); -#if PY_MAJOR_VERSION >= 3 +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) #endif #else #ifdef __Pyx_CyFunction_USED @@ -16448,18 +20859,20 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me Py_DECREF(descr); goto try_unpack; } - if (descr != NULL) { + if (likely(descr != NULL)) { *method = descr; return 0; } + type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); #endif + __Pyx_DECREF_TypeName(type_name); return 0; #else attr = __Pyx_PyObject_GetAttrStr(obj, name); @@ -16510,160 +20923,12 @@ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { return 0; } -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - /* 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) { + int has_cstart, int has_cstop, int wraparound) { + __Pyx_TypeName obj_type_name; #if CYTHON_USE_TYPE_SLOTS PyMappingMethods* mp; #if PY_MAJOR_VERSION < 3 @@ -16702,9 +20967,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, } return ms->sq_slice(obj, cstart, cstop); } +#else + CYTHON_UNUSED_VAR(wraparound); #endif mp = Py_TYPE(obj)->tp_as_mapping; if (likely(mp && mp->mp_subscript)) +#else + CYTHON_UNUSED_VAR(wraparound); #endif { PyObject* result; @@ -16750,8 +21019,10 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, } return result; } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); + "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); bad: return NULL; } @@ -16771,37 +21042,16 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* exc_type = tstate->curexc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); if (unlikely(exc_type)) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) return -1; - } + __Pyx_PyErr_Clear(); + return 0; } return 0; -#endif } /* UnpackItemEndCheck */ @@ -16810,38 +21060,55 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; - } else { - return __Pyx_IterFinish(); } - return 0; + return __Pyx_IterFinish(); } /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } key_value = __Pyx_PyIndex_AsSsize_t(index); if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return NULL; } -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); } - return __Pyx_PyObject_GetIndex(obj, key); + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); } #endif @@ -16894,7 +21161,7 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { return -1; } r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { + if (!r) { PyErr_Clear(); return 0; } else { @@ -16904,12 +21171,12 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { } /* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE 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) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -16921,21 +21188,46 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* 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 + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -16956,31 +21248,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject 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 } #endif @@ -16991,20 +21259,32 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -17026,12 +21306,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -17112,17 +21401,238 @@ static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, in return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n = PyTuple_GET_SIZE(bases); + for (i = 1; i < n; i++) + { + PyObject *b0 = PyTuple_GET_ITEM(bases, i); + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } + } + return 0; +} +#endif + +/* PyType_Ready */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif + __Pyx_DECREF_TypeName(type_name); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { @@ -17162,33 +21672,12 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } #endif -/* PyObjectGetAttrStrNoError */ -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -} - /* SetupReduce */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { @@ -17204,17 +21693,35 @@ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { #if CYTHON_USE_PYTYPE_LOOKUP - if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); #else - if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } #endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else @@ -17236,7 +21743,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); @@ -17252,13 +21759,20 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { } goto __PYX_GOOD; __PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); + } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); @@ -17267,18 +21781,21 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(setstate_cython); return ret; } +#endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_0 +#define __PYX_HAVE_RT_ImportType_3_0_0 +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; -#ifdef Py_LIMITED_API + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; + PyObject *py_itemsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) @@ -17289,8 +21806,9 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) @@ -17300,22 +21818,38 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; #endif - if ((size_t)basicsize < size) { + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_0 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_0 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -17331,39 +21865,37 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; PyObject *module = 0; - PyObject *global_dict = 0; PyObject *empty_dict = 0; - PyObject *list; + PyObject *empty_list = 0; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) + if (unlikely(!py_import)) goto bad; - #endif - if (from_list) - list = from_list; - else { + if (!from_list) { empty_list = PyList_New(0); - if (!empty_list) + if (unlikely(!empty_list)) goto bad; - list = empty_list; + from_list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; + #endif empty_dict = PyDict_New(); - if (!empty_dict) + if (unlikely(!empty_dict)) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + #if CYTHON_COMPILING_IN_LIMITED_API module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) + name, empty_dict, empty_dict, from_list, 1); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + #endif + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) goto bad; PyErr_Clear(); } @@ -17374,23 +21906,28 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); - if (!py_level) + if (unlikely(!py_level)) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else + #if CYTHON_COMPILING_IN_LIMITED_API + module = PyImport_ImportModuleLevelObject( + name, empty_dict, empty_dict, from_list, level); + #else module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); + name, __pyx_d, empty_dict, from_list, level); + #endif #endif } } bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); return module; } @@ -17398,6 +21935,35 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__8); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); @@ -17408,56 +21974,349 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { return value; } +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__9; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* ImportDottedModuleRelFirst */ +static PyObject *__Pyx_ImportDottedModuleRelFirst(PyObject *name, PyObject *parts_tuple) { + PyObject *module; + PyObject *from_list = NULL; +#if PY_MAJOR_VERSION < 3 + PyObject *star = __pyx_n_s__9; + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); +#endif + module = __Pyx_Import(name, from_list, -1); + Py_XDECREF(from_list); + if (module) { + #if PY_MAJOR_VERSION >= 3 + if (parts_tuple) { + module = __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); + } + #endif + return module; + } + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + return NULL; + PyErr_Clear(); + return __Pyx_ImportDottedModule(name, parts_tuple); +} + +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + /* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { goto bad; } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { goto bad; } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; done: - Py_DECREF(fake_module); - return cached_type; + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif /* CythonFunctionShared */ -#include +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + CYTHON_UNUSED_VAR(closure); if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; @@ -17470,25 +22329,25 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp = op->func_doc; + CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; @@ -17497,9 +22356,9 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -17510,22 +22369,21 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "__name__ must be set to a string object"); return -1; } - tmp = op->func_name; Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_name, value); return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -17536,25 +22394,14 @@ __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHO "__qualname__ must be set to a string object"); return -1; } - tmp = op->func_qualname; Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); return 0; } static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) @@ -17564,9 +22411,9 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); @@ -17577,28 +22424,30 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "setting function's dictionary to a non-dict"); return -1; } - tmp = op->func_dict; Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_dict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } @@ -17625,27 +22474,28 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; @@ -17655,27 +22505,28 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *co return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; @@ -17685,24 +22536,23 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void * return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; - } else if (!PyDict_Check(value)) { + } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; @@ -17711,13 +22561,42 @@ __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void Py_INCREF(result); return result; } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); + PyList_SET_ITEM(fromlist, 0, marker); + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, @@ -17730,20 +22609,37 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif {0, 0, 0, 0, 0} }; static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 Py_INCREF(m->func_qualname); return m->func_qualname; #else - return PyString_FromString(m->func.m_ml->ml_name); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { @@ -17753,26 +22649,31 @@ static PyMethodDef __pyx_CyFunction_methods[] = { #if PY_VERSION_HEX < 0x030500A0 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyCFunctionObject *cf = (PyCFunctionObject*) op; if (unlikely(op == NULL)) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; + cf->m_ml = ml; + cf->m_self = (PyObject *) op; Py_XINCREF(closure); op->func_closure = closure; Py_XINCREF(module); - op->func.m_module = module; + cf->m_module = module; op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); @@ -17784,23 +22685,56 @@ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef * op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); + Py_CLEAR(((PyCFunctionObject*)m)->m_module); Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -17816,7 +22750,7 @@ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { @@ -17826,16 +22760,17 @@ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); + Py_VISIT(((PyCFunctionObject*)m)->m_module); Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -17844,24 +22779,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } return 0; } -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ -#if PY_MAJOR_VERSION < 3 - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; -#endif - return __Pyx_PyMethod_New(func, obj, type); -} static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { @@ -17918,9 +22835,7 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py } break; default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", @@ -17933,6 +22848,17 @@ static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *a static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; @@ -17944,6 +22870,14 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); @@ -17953,13 +22887,175 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P } return result; } +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif 0, 0, #if PY_MAJOR_VERSION < 3 @@ -17977,7 +23073,13 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#ifdef _Py_TPFLAGS_HAVE_VECTORCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, @@ -17994,7 +23096,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { __pyx_CyFunction_getsets, 0, 0, - __Pyx_CyFunction_descr_get, + __Pyx_PyMethod_New, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, @@ -18012,15 +23114,27 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030400a1 0, #endif -#if PY_VERSION_HEX >= 0x030800b1 +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 0, #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, #endif }; -static int __pyx_CyFunction_init(void) { +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } @@ -18104,25 +23218,43 @@ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bas return (PyObject*) metaclass; } +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); +#if PY_MAJOR_VERSION < 3 + if (unlikely(PyInstance_Check(obj))) + return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name); +#endif + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); + PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_n_s_prepare); if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); + PyObject *pargs[3] = {NULL, name, bases}; + ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); Py_DECREF(prep); - Py_DECREF(pargs); } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) + if (unlikely(PyErr_Occurred())) return NULL; - PyErr_Clear(); ns = PyDict_New(); } } else { @@ -18131,18 +23263,153 @@ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, if (unlikely(!ns)) return NULL; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; +#if PY_VERSION_HEX >= 0x03030000 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; +#else + CYTHON_MAYBE_UNUSED_VAR(qualname); +#endif if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; return ns; bad: Py_DECREF(ns); return NULL; } +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS +static int __Pyx_SetNamesPEP487(PyObject *type_obj) { + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *names_to_set, *key, *value, *set_name, *tmp; + Py_ssize_t i = 0; +#if CYTHON_USE_TYPE_SLOTS + names_to_set = PyDict_Copy(type->tp_dict); +#else + { + PyObject *d = PyObject_GetAttr(type_obj, __pyx_n_s_dict_2); + names_to_set = NULL; + if (likely(d)) { + PyObject *names_to_set = PyDict_New(); + int ret = likely(names_to_set) ? PyDict_Update(names_to_set, d) : -1; + Py_DECREF(d); + if (unlikely(ret < 0)) + Py_CLEAR(names_to_set); + } + } +#endif + if (unlikely(names_to_set == NULL)) + goto bad; + while (PyDict_Next(names_to_set, &i, &key, &value)) { + set_name = __Pyx_PyObject_LookupSpecialNoError(value, __pyx_n_s_set_name); + if (unlikely(set_name != NULL)) { + tmp = __Pyx_PyObject_Call2Args(set_name, type_obj, key); + Py_DECREF(set_name); + if (unlikely(tmp == NULL)) { + __Pyx_TypeName value_type_name = + __Pyx_PyType_GetName(Py_TYPE(value)); + __Pyx_TypeName type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_RuntimeError, +#if PY_MAJOR_VERSION >= 3 + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %R " "in '" __Pyx_FMT_TYPENAME "'", + value_type_name, key, type_name); +#else + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %.100s in '" __Pyx_FMT_TYPENAME "'", + value_type_name, + PyString_Check(key) ? PyString_AS_STRING(key) : "?", + type_name); +#endif + goto bad; + } else { + Py_DECREF(tmp); + } + } + else if (unlikely(PyErr_Occurred())) { + goto bad; + } + } + Py_DECREF(names_to_set); + return 0; +bad: + Py_XDECREF(names_to_set); + return -1; +} +static PyObject *__Pyx_InitSubclassPEP487(PyObject *type_obj, PyObject *mkw) { +#if CYTHON_USE_TYPE_SLOTS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *mro = type->tp_mro; + Py_ssize_t i, nbases; + if (unlikely(!mro)) goto done; + (void) &__Pyx_GetBuiltinName; + Py_INCREF(mro); + nbases = PyTuple_GET_SIZE(mro); + assert(PyTuple_GET_ITEM(mro, 0) == type_obj); + for (i = 1; i < nbases-1; i++) { + PyObject *base, *dict, *meth; + base = PyTuple_GET_ITEM(mro, i); + dict = ((PyTypeObject *)base)->tp_dict; + meth = __Pyx_PyDict_GetItemStrWithError(dict, __pyx_n_s_init_subclass); + if (unlikely(meth)) { + descrgetfunc f = Py_TYPE(meth)->tp_descr_get; + PyObject *res; + Py_INCREF(meth); + if (likely(f)) { + res = f(meth, NULL, type_obj); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + meth = res; + } + res = __Pyx_PyObject_FastCallDict(meth, NULL, 0, mkw); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + Py_DECREF(res); + goto done; + } else if (unlikely(PyErr_Occurred())) { + goto bad; + } + } +done: + Py_XDECREF(mro); + return type_obj; +bad: + Py_XDECREF(mro); + Py_DECREF(type_obj); + return NULL; +#else + PyObject *super_type, *super, *func, *res; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + super_type = __Pyx_GetBuiltinName(__pyx_n_s_super); +#else + super_type = (PyObject*) &PySuper_Type; + (void) &__Pyx_GetBuiltinName; +#endif + super = likely(super_type) ? __Pyx_PyObject_Call2Args(super_type, type_obj, type_obj) : NULL; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + Py_XDECREF(super_type); +#endif + if (unlikely(!super)) { + Py_CLEAR(type_obj); + goto done; + } + func = __Pyx_PyObject_GetAttrStrNoError(super, __pyx_n_s_init_subclass); + Py_DECREF(super); + if (likely(!func)) { + if (unlikely(PyErr_Occurred())) + Py_CLEAR(type_obj); + goto done; + } + res = __Pyx_PyObject_FastCallDict(func, NULL, 0, mkw); + Py_DECREF(func); + if (unlikely(!res)) + Py_CLEAR(type_obj); + Py_XDECREF(res); +done: + return type_obj; +#endif +} +#endif static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; + PyObject *result; PyObject *owned_metaclass = NULL; + PyObject *margs[4] = {NULL, name, bases, dict}; if (allow_py2_metaclass) { owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); if (owned_metaclass) { @@ -18160,25 +23427,105 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return NULL; owned_metaclass = metaclass; } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); + result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, +#if PY_VERSION_HEX < 0x030600A4 + (metaclass == (PyObject*)&PyType_Type) ? NULL : mkw +#else + mkw +#endif + ); + Py_XDECREF(owned_metaclass); +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS + if (likely(result) && likely(PyType_Check(result))) { + if (unlikely(__Pyx_SetNamesPEP487(result) < 0)) { + Py_CLEAR(result); + } else { + result = __Pyx_InitSubclassPEP487(result, mkw); + } + } +#else + (void) &__Pyx_GetBuiltinName; +#endif + return result; +} + +/* Py3UpdateBases */ +static PyObject* +__Pyx_PEP560_update_bases(PyObject *bases) +{ + Py_ssize_t i, j, size_bases; + PyObject *base, *meth, *new_base, *result, *new_bases = NULL; + size_bases = PyTuple_GET_SIZE(bases); + for (i = 0; i < size_bases; i++) { + base = PyTuple_GET_ITEM(bases, i); + if (PyType_Check(base)) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_n_s_mro_entries); + if (!meth && PyErr_Occurred()) { + goto error; + } + if (!meth) { + if (new_bases) { + if (PyList_Append(new_bases, base) < 0) { + goto error; + } + } + continue; + } + new_base = __Pyx_PyObject_CallOneArg(meth, bases); + Py_DECREF(meth); + if (!new_base) { + goto error; + } + if (!PyTuple_Check(new_base)) { + PyErr_SetString(PyExc_TypeError, + "__mro_entries__ must return a tuple"); + Py_DECREF(new_base); + goto error; + } + if (!new_bases) { + if (!(new_bases = PyList_New(i))) { + goto error; + } + for (j = 0; j < i; j++) { + base = PyTuple_GET_ITEM(bases, j); + PyList_SET_ITEM(new_bases, j, base); + Py_INCREF(base); + } + } + j = PyList_GET_SIZE(new_bases); + if (PyList_SetSlice(new_bases, j, j, new_base) < 0) { + goto error; + } + Py_DECREF(new_base); + } + if (!new_bases) { + Py_INCREF(bases); + return bases; } - Py_XDECREF(owned_metaclass); + result = PyList_AsTuple(new_bases); + Py_DECREF(new_bases); return result; +error: + Py_XDECREF(new_bases); + return NULL; } /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -18192,7 +23539,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -18203,7 +23550,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -18214,6 +23561,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -18292,44 +23640,63 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + _PyTraceback_Add(funcname, filename, py_line); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -18342,11 +23709,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -18354,14 +23726,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); - if (!py_code) goto bad; + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( @@ -18377,6 +23759,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ @@ -18489,7 +23872,7 @@ static CYTHON_INLINE readstat_type_t __Pyx_PyInt_As_readstat_type_t(PyObject *x) const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(readstat_type_t) < sizeof(long)) { + if ((sizeof(readstat_type_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(readstat_type_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -18503,40 +23886,45 @@ static CYTHON_INLINE readstat_type_t __Pyx_PyInt_As_readstat_type_t(PyObject *x) 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 (readstat_type_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(readstat_type_t, digit, digits[0]) - case 2: - if (8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) >= 2 * PyLong_SHIFT) { - return (readstat_type_t) (((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) >= 2 * PyLong_SHIFT)) { + return (readstat_type_t) (((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) >= 3 * PyLong_SHIFT) { - return (readstat_type_t) (((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + break; + case 3: + if ((8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) >= 3 * PyLong_SHIFT)) { + return (readstat_type_t) (((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) >= 4 * PyLong_SHIFT) { - return (readstat_type_t) (((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + break; + case 4: + if ((8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) >= 4 * PyLong_SHIFT)) { + return (readstat_type_t) (((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -18549,111 +23937,89 @@ static CYTHON_INLINE readstat_type_t __Pyx_PyInt_As_readstat_type_t(PyObject *x) goto raise_neg_overflow; } #endif - if (sizeof(readstat_type_t) <= sizeof(unsigned long)) { + if ((sizeof(readstat_type_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(readstat_type_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(readstat_type_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, 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 (readstat_type_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(readstat_type_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(readstat_type_t, digit, +digits[0]) - case -2: - if (8 * sizeof(readstat_type_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT) { - return (readstat_type_t) (((readstat_type_t)-1)*(((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(readstat_type_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT)) { + return (readstat_type_t) (((readstat_type_t)-1)*(((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT) { - return (readstat_type_t) ((((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT)) { + return (readstat_type_t) ((((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT) { - return (readstat_type_t) (((readstat_type_t)-1)*(((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT)) { + return (readstat_type_t) (((readstat_type_t)-1)*(((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT) { - return (readstat_type_t) ((((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT)) { + return (readstat_type_t) ((((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT) { - return (readstat_type_t) (((readstat_type_t)-1)*(((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT)) { + return (readstat_type_t) (((readstat_type_t)-1)*(((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT) { - return (readstat_type_t) ((((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT)) { + return (readstat_type_t) ((((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(readstat_type_t) <= sizeof(long)) { + if ((sizeof(readstat_type_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(readstat_type_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(readstat_type_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, 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 - readstat_type_t 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 (readstat_type_t) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (readstat_type_t) -1; } else { readstat_type_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -18685,7 +24051,7 @@ static CYTHON_INLINE __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) < sizeof(long)) { + if ((sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -18699,40 +24065,45 @@ static CYTHON_INLINE __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format 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 (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) 0; - case 1: __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, digit, digits[0]) - case 2: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) >= 2 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) >= 2 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) >= 3 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0])); + break; + case 3: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) >= 3 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) >= 4 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0])); + break; + case 4: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) >= 4 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -18745,111 +24116,89 @@ static CYTHON_INLINE __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format goto raise_neg_overflow; } #endif - if (sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(unsigned long)) { + if ((sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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 (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) 0; - case -1: __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, digit, +digits[0]) - case -2: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 2 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)-1)*(((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 2 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)-1)*(((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 2 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) ((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + break; + case 2: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 2 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) ((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 3 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)-1)*(((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + break; + case -3: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 3 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)-1)*(((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 3 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) ((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + break; + case 3: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 3 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) ((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 4 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)-1)*(((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + break; + case -4: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 4 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) (((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)-1)*(((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 4 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) ((((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + break; + case 4: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) - 1 > 4 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) ((((((((((__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(long)) { + if ((sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format, 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 - __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format 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 (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (__pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format) -1; } else { __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -18995,7 +24344,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -19009,40 +24358,45 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -19055,109 +24409,181 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -19191,7 +24617,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -19205,40 +24631,45 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -19251,109 +24682,181 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -19374,11 +24877,26 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { return (int) -1; } +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__15)); + } + return name; +} +#endif + /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -19399,6 +24917,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } return __Pyx_InBases(a, b); } +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; @@ -19423,11 +24957,11 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc } #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); + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } - return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { @@ -19476,13 +25010,35 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char ctversion[5]; + int same=1, i, found_dot; + const char* rt_from_call = Py_GetVersion(); + PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + found_dot = 0; + for (i = 0; i < 4; i++) { + if (!ctversion[i]) { + same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); + break; + } + if (rt_from_call[i] != ctversion[i]) { + same = 0; + break; + } + } + if (!same) { + char rtversion[5] = {'\0'}; char message[200]; + for (i=0; i<4; ++i) { + if (rt_from_call[i] == '.') { + if (found_dot) break; + found_dot = 1; + } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { + break; + } + rtversion[i] = rt_from_call[i]; + } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -19503,11 +25059,7 @@ static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) { if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0) goto bad; } -#if PY_VERSION_HEX >= 0x02070000 cobj = PyCapsule_New(p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0); -#endif if (!cobj) goto bad; if (PyDict_SetItem(d, name, cobj) < 0) @@ -19540,11 +25092,7 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s goto bad; } tmp.fp = f; -#if PY_VERSION_HEX >= 0x02070000 cobj = PyCapsule_New(tmp.p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); -#endif if (!cobj) goto bad; if (PyDict_SetItemString(d, name, cobj) < 0) @@ -19559,9 +25107,31 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s } /* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -19569,23 +25139,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -19647,7 +25205,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -19676,22 +25234,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -19757,13 +25319,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -19806,6 +25366,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } @@ -19814,4 +25391,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/pyreadstat/_readstat_parser.pxd b/pyreadstat/_readstat_parser.pxd index ceb6ea9..2899197 100644 --- a/pyreadstat/_readstat_parser.pxd +++ b/pyreadstat/_readstat_parser.pxd @@ -19,6 +19,13 @@ from libc.stddef cimport wchar_t from readstat_api cimport * # Definitions of enum types +ctypedef enum py_file_extension: + FILE_EXT_SAV + FILE_EXT_SAS7BDAT + FILE_EXT_DTA + FILE_EXT_XPORT + FILE_EXT_POR + FILE_EXT_SAS7BCAT ctypedef enum py_file_format: FILE_FORMAT_SAS @@ -95,11 +102,11 @@ cdef int handle_note (int note_index, char *note, void *ctx) except READSTAT_HAN cdef void check_exit_status(readstat_error_t retcode) except * -cdef void run_readstat_parser(char * filename, data_container data, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), long row_limit, long row_offset) except * +cdef void run_readstat_parser(char * filename, data_container data, py_file_extension file_extension, long row_limit, long row_offset) except * cdef object data_container_to_dict(data_container data) cdef object dict_to_pandas_dataframe(object final_container, data_container data) cdef object data_container_extract_metadata(data_container data) -cdef object run_conversion(object filename_path, py_file_format file_format, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), +cdef object run_conversion(object filename_path, py_file_format file_format, py_file_extension file_extension, str encoding, bint metaonly, bint dates_as_pandas, list usecols, bint usernan, bint no_datetime_conversion, long row_limit, long row_offset, str output_format, list extra_datetime_formats, list extra_date_formats) @@ -126,26 +133,25 @@ cdef object stata_origin # Stuff for opening files on windows in order to handle international characters # Courtesy of Jonathon Love # works only in python 3 -IF PY_MAJOR_VERSION >2: +#cdef extern from "readstat_io_unistd.h": +# cdef struct unistd_io_ctx_t "unistd_io_ctx_s": +# int fd + +cdef extern from "Python.h": + wchar_t* PyUnicode_AsWideCharString(object, Py_ssize_t *) except NULL + +# these ones would make the c file produced by cython not portable between windows and unix +# therefore the conditional including of the libraries is handled in C +cdef extern from "conditional_includes.h": + int _wsopen(const wchar_t *filename, int oflag, int shflag, int pmode) + int _O_RDONLY + int _O_BINARY + int _O_WRONLY + int _O_CREAT + int _SH_DENYRW # Denies read and write access to a file. + int _SH_DENYWR # Denies write access to a file. + int _SH_DENYRD # Denies read access to a file. + int _SH_DENYNO + void assign_fd(void *io_ctx, int fd) + long seek_fd(readstat_off_t offset, readstat_io_flags_t whence, void *io_ctx) - cdef extern from "readstat_io_unistd.h": - cdef struct unistd_io_ctx_t "unistd_io_ctx_s": - pass - - cdef extern from "Python.h": - wchar_t* PyUnicode_AsWideCharString(object, Py_ssize_t *) except NULL - - # these ones would make the c file produced by cython not portable between windows and unix - # therefore the conditional including of the libraries is handled in C - cdef extern from "conditional_includes.h": - int _wsopen(const wchar_t *filename, int oflag, int shflag, int pmode) - int _O_RDONLY - int _O_BINARY - int _O_WRONLY - int _O_CREAT - int _SH_DENYRW # Denies read and write access to a file. - int _SH_DENYWR # Denies write access to a file. - int _SH_DENYRD # Denies read access to a file. - int _SH_DENYNO - void assign_fd(void *io_ctx, int fd) - long seek_fd(readstat_off_t offset, readstat_io_flags_t whence, void *io_ctx) diff --git a/pyreadstat/_readstat_parser.pyx b/pyreadstat/_readstat_parser.pyx index cd067db..8ba95ab 100644 --- a/pyreadstat/_readstat_parser.pyx +++ b/pyreadstat/_readstat_parser.pyx @@ -768,25 +768,18 @@ cdef int handle_open(const char *u8_path, void *io_ctx) except READSTAT_HANDLER_ Special open handler for windows in order to be able to handle paths with international characters Courtesy of Jonathon Love. """ - IF PY_MAJOR_VERSION >2: - - cdef int fd - cdef Py_ssize_t length - - if not os.path.isfile(u8_path): - return -1 - - #IF UNAME_SYSNAME == 'Windows': - if os.name == "nt": - - u16_path = PyUnicode_AsWideCharString(u8_path, &length) - fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) - assign_fd(io_ctx, fd) - return fd - #ELSE: - else: - return -1 - ELSE: + cdef int fd + cdef Py_ssize_t length + + if not os.path.isfile(u8_path): + return -1 + + if os.name == "nt": + u16_path = PyUnicode_AsWideCharString(u8_path, &length) + fd = _wsopen(u16_path, _O_RDONLY | _O_BINARY, _SH_DENYWR, 0) + assign_fd(io_ctx, fd) + return fd + else: return -1 @@ -803,7 +796,7 @@ cdef void check_exit_status(readstat_error_t retcode) except *: raise ReadstatError(err_message) -cdef void run_readstat_parser(char * filename, data_container data, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), long row_limit, long row_offset) except *: +cdef void run_readstat_parser(char * filename, data_container data, py_file_extension file_extension, long row_limit, long row_offset) except *: """ Runs the parsing of the file by readstat library """ @@ -841,13 +834,9 @@ cdef void run_readstat_parser(char * filename, data_container data, readstat_err check_exit_status(readstat_set_note_handler(parser, note_handler)) # on windows we need a custom open handler in order to deal with internation characters in the path. - IF PY_MAJOR_VERSION >2: - if os.name == "nt": - open_handler = handle_open - readstat_set_open_handler(parser, open_handler) - ELSE: - if os.name == "nt": - raise PyreadstatError("Python 2 on windows not supported!") + if os.name == "nt": + open_handler = handle_open + readstat_set_open_handler(parser, open_handler) if not metaonly: check_exit_status(readstat_set_value_handler(parser, value_handler)) @@ -864,7 +853,19 @@ cdef void run_readstat_parser(char * filename, data_container data, readstat_err check_exit_status(readstat_set_row_offset(parser, row_offset)) # parse! - error = parse_func(parser, filename, ctx); + if file_extension == FILE_EXT_SAV: + error = readstat_parse_sav(parser, filename, ctx); + elif file_extension == FILE_EXT_SAS7BDAT: + error = readstat_parse_sas7bdat(parser, filename, ctx); + elif file_extension == FILE_EXT_DTA: + error = readstat_parse_dta(parser, filename, ctx); + elif file_extension == FILE_EXT_XPORT: + error = readstat_parse_xport(parser, filename, ctx); + elif file_extension == FILE_EXT_POR: + error = readstat_parse_por(parser, filename, ctx); + elif file_extension == FILE_EXT_SAS7BCAT: + error = readstat_parse_sas7bcat(parser, filename, ctx); + #error = parse_func(parser, filename, ctx); readstat_parser_free(parser) # check if a python error ocurred, if yes, it will be printed by the interpreter, # if not, make sure that the return from parse_func is OK, if not print @@ -1024,7 +1025,7 @@ cdef object data_container_extract_metadata(data_container data): return metadata -cdef object run_conversion(object filename_path, py_file_format file_format, readstat_error_t parse_func(readstat_parser_t *parse, const char *, void *), +cdef object run_conversion(object filename_path, py_file_format file_format, py_file_extension file_extension, str encoding, bint metaonly, bint dates_as_pandas, list usecols, bint usernan, bint no_datetime_conversion, long row_limit, long row_offset, str output_format, list extra_datetime_formats, list extra_date_formats): @@ -1048,17 +1049,15 @@ cdef object run_conversion(object filename_path, py_file_format file_format, rea warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") else: - IF PY_MAJOR_VERSION >2: - if type(filename_path) == str: - filename_bytes = filename_path.encode('utf-8') - elif type(filename_path) == bytes: - filename_bytes = filename_path - else: - raise PyreadstatError("path must be either str or bytes") - ELSE: - if type(filename_path) not in (str, bytes, unicode): - raise PyreadstatError("path must be str, bytes or unicode") + if type(filename_path) == str: filename_bytes = filename_path.encode('utf-8') + elif type(filename_path) == bytes: + filename_bytes = filename_path + else: + raise PyreadstatError("path must be either str or bytes") + if type(filename_path) not in (str, bytes, unicode): + raise PyreadstatError("path must be str, bytes or unicode") + filename_bytes = filename_path.encode('utf-8') filename_bytes = os.path.expanduser(filename_bytes) @@ -1125,7 +1124,7 @@ cdef object run_conversion(object filename_path, py_file_format file_format, rea data.no_datetime_conversion = no_datetime_conversion # go! - run_readstat_parser(filename, data, parse_func, row_limit, row_offset) + run_readstat_parser(filename, data, file_extension, row_limit, row_offset) data_dict = data_container_to_dict(data) if output_format == 'dict': data_frame = data_dict diff --git a/pyreadstat/_readstat_writer.c b/pyreadstat/_readstat_writer.c index 9c61b72..435c793 100644 --- a/pyreadstat/_readstat_writer.c +++ b/pyreadstat/_readstat_writer.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 3.0.0 */ /* BEGIN: Cython Metadata { @@ -13,7 +13,6 @@ "-DHAVE_ZLIB=1" ], "include_dirs": [ - "./pyreadstat", "pyreadstat", "src", "src/stata", @@ -78,20 +77,32 @@ END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "3_0_0" +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030000F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -110,9 +121,7 @@ END: Cython Metadata */ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -120,12 +129,18 @@ END: Cython Metadata */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -150,27 +165,159 @@ END: Cython Metadata */ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS @@ -193,25 +340,29 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -220,10 +371,7 @@ END: Cython Metadata */ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS @@ -232,7 +380,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -250,27 +398,60 @@ END: Cython Metadata */ #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) + #endif + #if PY_VERSION_HEX < 0x030700A3 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -295,6 +476,17 @@ END: Cython Metadata */ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -308,13 +500,16 @@ END: Cython Metadata */ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -326,24 +521,47 @@ END: Cython Metadata */ #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -353,13 +571,26 @@ END: Cython Metadata */ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -375,26 +606,113 @@ END: Cython Metadata */ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject *co=NULL, *result=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(p))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; + if (!(empty = PyTuple_New(0))) goto end; + result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); + end: + Py_XDECREF((PyObject*) co); + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -408,6 +726,12 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -422,30 +746,53 @@ END: Cython Metadata */ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); +#else + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -454,6 +801,22 @@ END: Cython Metadata */ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -484,6 +847,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -496,34 +881,86 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_PEP393_ENABLED 1 - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #endif #else #define CYTHON_PEP393_ENABLED 0 @@ -533,11 +970,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -548,14 +985,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -584,8 +1027,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -604,6 +1053,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -615,6 +1066,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -627,15 +1081,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 @@ -655,8 +1104,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { } __Pyx_PyAsyncMethodsStruct; #endif -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif #endif #include #ifdef NAN @@ -679,7 +1130,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -693,7 +1153,6 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include #include -#include #include "readstat.h" #include "readstat_io_unistd.h" #include "conditional_includes.h" @@ -766,9 +1225,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -776,11 +1235,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -794,6 +1264,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -805,7 +1276,52 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -827,7 +1343,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -892,29 +1408,47 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { "pyreadstat/_readstat_writer.pyx", "pyreadstat/_readstat_parser.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container; -/* "_readstat_parser.pxd":23 +/* "_readstat_parser.pxd":22 + * * # Definitions of enum types + * ctypedef enum py_file_extension: # <<<<<<<<<<<<<< + * FILE_EXT_SAV + * FILE_EXT_SAS7BDAT + */ +enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension { + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAV, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BDAT, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_DTA, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_XPORT, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_POR, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BCAT +}; +typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension; + +/* "_readstat_parser.pxd":30 + * FILE_EXT_SAS7BCAT * * ctypedef enum py_file_format: # <<<<<<<<<<<<<< * FILE_FORMAT_SAS @@ -927,7 +1461,7 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_t_10pyreadstat_16_readstat_parser_py_file_format; -/* "_readstat_parser.pxd":28 +/* "_readstat_parser.pxd":35 * FILE_FORMAT_STATA * * ctypedef enum py_datetime_format: # <<<<<<<<<<<<<< @@ -942,7 +1476,7 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format; -/* "_readstat_parser.pxd":34 +/* "_readstat_parser.pxd":41 * DATE_FORMAT_TIME * * ctypedef enum py_variable_format: # <<<<<<<<<<<<<< @@ -957,8 +1491,8 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format; -/* "pyreadstat/_readstat_writer.pxd":58 - * ssize_t _write(int fd, const void *buf, size_t nbyte) +/* "pyreadstat/_readstat_writer.pxd":56 + * ssize_t write(int fd, const void *buf, size_t nbyte) * * ctypedef enum dst_file_format: # <<<<<<<<<<<<<< * FILE_FORMAT_SAS7BDAT @@ -974,7 +1508,7 @@ enum __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format; -/* "pyreadstat/_readstat_writer.pxd":66 +/* "pyreadstat/_readstat_writer.pxd":64 * FILE_FORMAT_POR * * ctypedef enum pywriter_variable_type: # <<<<<<<<<<<<<< @@ -994,7 +1528,7 @@ enum __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type { }; typedef enum __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type; -/* "_readstat_parser.pxd":42 +/* "_readstat_parser.pxd":49 * # Definitions of extension types * * cdef class data_container: # <<<<<<<<<<<<<< @@ -1040,6 +1574,7 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { int no_datetime_conversion; }; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1048,11 +1583,11 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1062,28 +1597,40 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1094,6 +1641,10 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1105,18 +1656,72 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ @@ -1143,18 +1748,18 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ +#define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} +} while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) @@ -1171,18 +1776,28 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1191,31 +1806,17 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif +#endif +#endif /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); /* IncludeStringH.proto */ #include @@ -1233,49 +1834,11 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); /* UnpackUnboundCMethod.proto */ typedef struct { @@ -1317,6 +1880,10 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) #endif +/* PyObject_Str.proto */ +#define __Pyx_PyObject_Str(obj)\ + (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); @@ -1359,9 +1926,12 @@ 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); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif @@ -1433,9 +2003,14 @@ static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); static long __Pyx__PyObject_Ord(PyObject* c); /* PyIntCompare.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); +static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); -/* None.proto */ +/* RaiseUnboundLocalError.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); /* ListCompAppend.proto */ @@ -1462,7 +2037,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1477,14 +2052,6 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) @@ -1510,22 +2077,42 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_0 +#define __PYX_HAVE_RT_ImportType_proto_3_0_0 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_0 { + __Pyx_ImportType_CheckSize_Error_3_0_0 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_0 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_0 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size); #endif /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ImportDottedModuleRelFirst.proto */ +static PyObject *__Pyx_ImportDottedModuleRelFirst(PyObject *name, PyObject *parts_tuple); + /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1534,6 +2121,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1547,13 +2135,14 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif @@ -1581,20 +2170,37 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type __Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ @@ -1604,23 +2210,23 @@ static int __Pyx_check_binary_version(void); static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); +static int __Pyx_ImportVoidPtr_3_0_0(PyObject *module, const char *name, void **p, const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ -/* Module declarations from 'libc.stddef' */ +/* Module declarations from "libc.stddef" */ -/* Module declarations from 'pyreadstat.readstat_api' */ +/* Module declarations from "pyreadstat.readstat_api" */ -/* Module declarations from 'libc.math' */ +/* Module declarations from "libc.math" */ -/* Module declarations from 'pyreadstat._readstat_parser' */ -static PyTypeObject *__pyx_ptype_10pyreadstat_16_readstat_parser_data_container = 0; +/* Module declarations from "pyreadstat._readstat_parser" */ static PyObject **__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types = 0; #define __pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types (*__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types) static PyObject **__pyx_vp_10pyreadstat_16_readstat_parser_sas_date_formats = 0; @@ -1655,7 +2261,7 @@ static PyObject **__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin = 0; #define __pyx_v_10pyreadstat_16_readstat_parser_stata_origin (*__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin) static void (*__pyx_f_10pyreadstat_16_readstat_parser_check_exit_status)(readstat_error_t); /*proto*/ -/* Module declarations from 'pyreadstat._readstat_writer' */ +/* Module declarations from "pyreadstat._readstat_writer" */ static PyObject *__pyx_v_10pyreadstat_16_readstat_writer_int_types = 0; static PyObject *__pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types = 0; static PyObject *__pyx_v_10pyreadstat_16_readstat_writer_float_types = 0; @@ -1685,26 +2291,33 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(readstat_variable_t *, PyObject *, PyObject *); /*proto*/ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(readstat_variable_t *, int, PyObject *); /*proto*/ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readstat_variable_t *, PyObject *, PyObject *); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "pyreadstat._readstat_writer" extern int __pyx_module_is_main_pyreadstat___readstat_writer; int __pyx_module_is_main_pyreadstat___readstat_writer = 0; -/* Implementation of 'pyreadstat._readstat_writer' */ +/* Implementation of "pyreadstat._readstat_writer" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_chr; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_zip; static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_UnicodeError; +/* #### Code section: string_decls ### */ static const char __pyx_k_x[] = "x"; static const char __pyx_k__2[] = " "; +static const char __pyx_k__4[] = "*"; +static const char __pyx_k__5[] = "."; static const char __pyx_k_hi[] = "hi"; static const char __pyx_k_lo[] = "lo"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_nt[] = "nt"; static const char __pyx_k_os[] = "os"; static const char __pyx_k_pd[] = "pd"; -static const char __pyx_k__15[] = "_"; +static const char __pyx_k__17[] = "_"; +static const char __pyx_k__18[] = "?"; static const char __pyx_k_any[] = "any"; static const char __pyx_k_chr[] = "chr"; static const char __pyx_k_get[] = "get"; @@ -1728,6 +2341,7 @@ static const char __pyx_k_libs[] = "_libs"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "name"; static const char __pyx_k_path[] = "path"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_time[] = "time"; static const char __pyx_k_warn[] = "warn"; @@ -1801,7 +2415,9 @@ static const char __pyx_k_reset_index[] = "reset_index"; static const char __pyx_k_Float32Dtype[] = "Float32Dtype"; static const char __pyx_k_Float64Dtype[] = "Float64Dtype"; static const char __pyx_k_UnicodeError[] = "UnicodeError"; +static const char __pyx_k_initializing[] = "_initializing"; static const char __pyx_k_ReadstatError[] = "ReadstatError"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_datetime64_ms[] = "datetime64[ms]"; static const char __pyx_k_datetime64_ns[] = "datetime64[ns]"; static const char __pyx_k_datetime64_us[] = "datetime64[us]"; @@ -1851,188 +2467,876 @@ static const char __pyx_k_missing_ranges_hi_and_lo_values_2[] = "missing_ranges: static const char __pyx_k_variable_value_labels_type_of_Va_2[] = "variable_value_labels: type of Value %s in variable %s must be int"; static const char __pyx_k_variable_value_labels_type_of_Va_3[] = "variable_value_labels: type of Value %s in variable %s must be boolean or be 1 or 0"; static const char __pyx_k_variable_value_labels_type_of_Va_4[] = "variable_value_labels: type of Value %s in variable %s must match the type of the column in pandas and be of type date, datetime or time"; -static PyObject *__pyx_n_s_CategoricalDtype; -static PyObject *__pyx_kp_s_Column_labels_must_be_strings; -static PyObject *__pyx_n_s_DataFrame; -static PyObject *__pyx_n_s_Float32Dtype; -static PyObject *__pyx_n_s_Float64Dtype; -static PyObject *__pyx_n_s_Int16Dtype; -static PyObject *__pyx_n_s_Int32Dtype; -static PyObject *__pyx_n_s_Int64Dtype; -static PyObject *__pyx_n_s_Int8Dtype; -static PyObject *__pyx_kp_s_M8_ns; -static PyObject *__pyx_kp_s_Non_unique_column_names_detected; -static PyObject *__pyx_n_s_PyreadstatError; -static PyObject *__pyx_n_s_ReadstatError; -static PyObject *__pyx_n_s_Timestamp; -static PyObject *__pyx_n_s_UInt16Dtype; -static PyObject *__pyx_n_s_UInt32Dtype; -static PyObject *__pyx_n_s_UInt64Dtype; -static PyObject *__pyx_n_s_UInt8Dtype; -static PyObject *__pyx_n_s_UnicodeError; -static PyObject *__pyx_kp_s_Unknown_data_format_to_insert; -static PyObject *__pyx_kp_s_Unknown_pywriter_variable_format; -static PyObject *__pyx_n_s__15; -static PyObject *__pyx_kp_s__2; -static PyObject *__pyx_kp_s_alignment_for_variable_s_must_be; -static PyObject *__pyx_n_s_any; -static PyObject *__pyx_n_s_asarray; -static PyObject *__pyx_n_s_asm8; -static PyObject *__pyx_n_s_astype; -static PyObject *__pyx_n_s_calendar; -static PyObject *__pyx_n_s_center; -static PyObject *__pyx_kp_s_character_missing_ranges_value_g; -static PyObject *__pyx_n_s_chr; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_kp_s_column_labels_must_be_either_lis; -static PyObject *__pyx_n_s_columns; -static PyObject *__pyx_n_s_combine; -static PyObject *__pyx_n_s_copy; -static PyObject *__pyx_n_s_core; -static PyObject *__pyx_n_s_date; -static PyObject *__pyx_n_s_datetime; -static PyObject *__pyx_n_s_datetime64; -static PyObject *__pyx_kp_s_datetime64_ms; -static PyObject *__pyx_kp_s_datetime64_ns; -static PyObject *__pyx_kp_s_datetime64_us; -static PyObject *__pyx_n_s_days; -static PyObject *__pyx_kp_s_dictionaries_in_missing_ranges_m; -static PyObject *__pyx_n_s_drop; -static PyObject *__pyx_n_s_dropna; -static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_dtypes; -static PyObject *__pyx_n_s_encode; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_expanduser; -static PyObject *__pyx_kp_s_file_path_could_not_be_encoded_w; -static PyObject *__pyx_kp_s_first_argument_must_be_a_pandas; -static PyObject *__pyx_n_s_float; -static PyObject *__pyx_n_s_float32; -static PyObject *__pyx_n_s_float64; -static PyObject *__pyx_n_s_fsdecode; -static PyObject *__pyx_n_s_fsencode; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_getfilesystemencoding; -static PyObject *__pyx_n_s_hi; -static PyObject *__pyx_n_s_iloc; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_int16; -static PyObject *__pyx_n_s_int32; -static PyObject *__pyx_n_s_int64; -static PyObject *__pyx_n_s_int8; -static PyObject *__pyx_n_s_is_datetime64_any_dtype; -static PyObject *__pyx_n_s_is_datetime64_ns_dtype; -static PyObject *__pyx_n_s_isalpha; -static PyObject *__pyx_n_s_isin; -static PyObject *__pyx_n_s_isna; -static PyObject *__pyx_n_s_items; -static PyObject *__pyx_n_s_keys; -static PyObject *__pyx_n_s_left; -static PyObject *__pyx_kp_s_length_of_column_labels_must_be; -static PyObject *__pyx_n_s_libs; -static PyObject *__pyx_n_s_lo; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_kp_s_measure_for_variable_s_must_be_e; -static PyObject *__pyx_n_s_min; -static PyObject *__pyx_kp_s_missing_ranges_hi_and_lo_values; -static PyObject *__pyx_kp_s_missing_ranges_hi_and_lo_values_2; -static PyObject *__pyx_kp_s_missing_ranges_max_1_discrete_nu; -static PyObject *__pyx_kp_s_missing_ranges_max_1_range_value; -static PyObject *__pyx_kp_s_missing_ranges_max_3_discrete_nu; -static PyObject *__pyx_kp_s_missing_ranges_max_3_string_valu; -static PyObject *__pyx_kp_s_missing_ranges_string_values_len; -static PyObject *__pyx_kp_s_missing_ranges_values_in_diction; -static PyObject *__pyx_kp_s_missing_ranges_values_must_be_bo; -static PyObject *__pyx_kp_s_missing_user_values_not_allowed; -static PyObject *__pyx_kp_s_missing_user_values_supports_val; -static PyObject *__pyx_kp_s_missing_user_values_values_in_di; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_name_2; -static PyObject *__pyx_n_s_nominal; -static PyObject *__pyx_n_s_np; -static PyObject *__pyx_n_s_nt; -static PyObject *__pyx_kp_s_numeric_missing_ranges_value_giv; -static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_n_s_object; -static PyObject *__pyx_n_s_ordinal; -static PyObject *__pyx_n_s_os; -static PyObject *__pyx_n_s_pandas; -static PyObject *__pyx_n_s_pandas_api_types; -static PyObject *__pyx_n_s_path; -static PyObject *__pyx_kp_s_path_must_be_either_str_or_bytes; -static PyObject *__pyx_n_s_pd; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_readstat_parser; -static PyObject *__pyx_n_s_replace; -static PyObject *__pyx_n_s_reset_index; -static PyObject *__pyx_n_s_right; -static PyObject *__pyx_n_s_round; -static PyObject *__pyx_n_s_scale; -static PyObject *__pyx_n_s_string; -static PyObject *__pyx_n_s_surrogateescape; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_time; -static PyObject *__pyx_n_s_timegm; -static PyObject *__pyx_n_s_timestamps; -static PyObject *__pyx_n_s_timetuple; -static PyObject *__pyx_n_s_timezone; -static PyObject *__pyx_n_s_timezone_2; -static PyObject *__pyx_n_s_tolist; -static PyObject *__pyx_n_s_total_seconds; -static PyObject *__pyx_n_s_tslibs; -static PyObject *__pyx_n_s_tzinfo; -static PyObject *__pyx_n_s_uint16; -static PyObject *__pyx_n_s_uint32; -static PyObject *__pyx_n_s_uint64; -static PyObject *__pyx_n_s_uint8; -static PyObject *__pyx_n_s_union; -static PyObject *__pyx_n_s_unknown; -static PyObject *__pyx_kp_s_unknown_file_format; -static PyObject *__pyx_n_s_upper; -static PyObject *__pyx_n_s_utc; -static PyObject *__pyx_kp_s_utf_8; -static PyObject *__pyx_n_s_values; -static PyObject *__pyx_kp_s_variable_name_s_contains_a_space; -static PyObject *__pyx_kp_s_variable_name_s_is_of_type_s_and; -static PyObject *__pyx_kp_s_variable_name_s_starts_with_an_i; -static PyObject *__pyx_kp_s_variable_value_labels_type_of_La; -static PyObject *__pyx_kp_s_variable_value_labels_type_of_Va; -static PyObject *__pyx_kp_s_variable_value_labels_type_of_Va_2; -static PyObject *__pyx_kp_s_variable_value_labels_type_of_Va_3; -static PyObject *__pyx_kp_s_variable_value_labels_type_of_Va_4; -static PyObject *__pyx_kp_s_variable_value_labels_value_for; -static PyObject *__pyx_n_s_warn; -static PyObject *__pyx_n_s_warnings; -static PyObject *__pyx_n_s_x; -static PyObject *__pyx_n_s_zip; -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PySet_Type_union = {0, &__pyx_n_s_union, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PyString_Type_encode = {0, &__pyx_n_s_encode, 0, 0, 0}; -static PyObject *__pyx_float_1e9; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_65; -static PyObject *__pyx_int_97; -static PyObject *__pyx_int_1970; -static PyObject *__pyx_slice_; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -/* Late includes */ - -/* "pyreadstat/_readstat_writer.pyx":65 +/* #### Code section: decls ### */ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PySet_Type_union = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyString_Type_encode = {0, 0, 0, 0, 0}; +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_10pyreadstat_16_readstat_parser_data_container; + #if CYTHON_USE_MODULE_STATE + #endif + PyObject *__pyx_n_s_CategoricalDtype; + PyObject *__pyx_kp_s_Column_labels_must_be_strings; + PyObject *__pyx_n_s_DataFrame; + PyObject *__pyx_n_s_Float32Dtype; + PyObject *__pyx_n_s_Float64Dtype; + PyObject *__pyx_n_s_Int16Dtype; + PyObject *__pyx_n_s_Int32Dtype; + PyObject *__pyx_n_s_Int64Dtype; + PyObject *__pyx_n_s_Int8Dtype; + PyObject *__pyx_kp_s_M8_ns; + PyObject *__pyx_kp_s_Non_unique_column_names_detected; + PyObject *__pyx_n_s_PyreadstatError; + PyObject *__pyx_n_s_ReadstatError; + PyObject *__pyx_n_s_Timestamp; + PyObject *__pyx_n_s_UInt16Dtype; + PyObject *__pyx_n_s_UInt32Dtype; + PyObject *__pyx_n_s_UInt64Dtype; + PyObject *__pyx_n_s_UInt8Dtype; + PyObject *__pyx_n_s_UnicodeError; + PyObject *__pyx_kp_s_Unknown_data_format_to_insert; + PyObject *__pyx_kp_s_Unknown_pywriter_variable_format; + PyObject *__pyx_n_s__17; + PyObject *__pyx_n_s__18; + PyObject *__pyx_kp_s__2; + PyObject *__pyx_n_s__4; + PyObject *__pyx_kp_u__5; + PyObject *__pyx_kp_s_alignment_for_variable_s_must_be; + PyObject *__pyx_n_s_any; + PyObject *__pyx_n_s_asarray; + PyObject *__pyx_n_s_asm8; + PyObject *__pyx_n_s_astype; + PyObject *__pyx_n_s_calendar; + PyObject *__pyx_n_s_center; + PyObject *__pyx_kp_s_character_missing_ranges_value_g; + PyObject *__pyx_n_s_chr; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_kp_s_column_labels_must_be_either_lis; + PyObject *__pyx_n_s_columns; + PyObject *__pyx_n_s_combine; + PyObject *__pyx_n_s_copy; + PyObject *__pyx_n_s_core; + PyObject *__pyx_n_s_date; + PyObject *__pyx_n_s_datetime; + PyObject *__pyx_n_s_datetime64; + PyObject *__pyx_kp_s_datetime64_ms; + PyObject *__pyx_kp_s_datetime64_ns; + PyObject *__pyx_kp_s_datetime64_us; + PyObject *__pyx_n_s_days; + PyObject *__pyx_kp_s_dictionaries_in_missing_ranges_m; + PyObject *__pyx_n_s_drop; + PyObject *__pyx_n_s_dropna; + PyObject *__pyx_n_s_dtype; + PyObject *__pyx_n_s_dtypes; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_expanduser; + PyObject *__pyx_kp_s_file_path_could_not_be_encoded_w; + PyObject *__pyx_kp_s_first_argument_must_be_a_pandas; + PyObject *__pyx_n_s_float; + PyObject *__pyx_n_s_float32; + PyObject *__pyx_n_s_float64; + PyObject *__pyx_n_s_fsdecode; + PyObject *__pyx_n_s_fsencode; + PyObject *__pyx_n_s_get; + PyObject *__pyx_n_s_getfilesystemencoding; + PyObject *__pyx_n_s_hi; + PyObject *__pyx_n_s_iloc; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int16; + PyObject *__pyx_n_s_int32; + PyObject *__pyx_n_s_int64; + PyObject *__pyx_n_s_int8; + PyObject *__pyx_n_s_is_datetime64_any_dtype; + PyObject *__pyx_n_s_is_datetime64_ns_dtype; + PyObject *__pyx_n_s_isalpha; + PyObject *__pyx_n_s_isin; + PyObject *__pyx_n_s_isna; + PyObject *__pyx_n_s_items; + PyObject *__pyx_n_s_keys; + PyObject *__pyx_n_s_left; + PyObject *__pyx_kp_s_length_of_column_labels_must_be; + PyObject *__pyx_n_s_libs; + PyObject *__pyx_n_s_lo; + PyObject *__pyx_n_s_main; + PyObject *__pyx_kp_s_measure_for_variable_s_must_be_e; + PyObject *__pyx_n_s_min; + PyObject *__pyx_kp_s_missing_ranges_hi_and_lo_values; + PyObject *__pyx_kp_s_missing_ranges_hi_and_lo_values_2; + PyObject *__pyx_kp_s_missing_ranges_max_1_discrete_nu; + PyObject *__pyx_kp_s_missing_ranges_max_1_range_value; + PyObject *__pyx_kp_s_missing_ranges_max_3_discrete_nu; + PyObject *__pyx_kp_s_missing_ranges_max_3_string_valu; + PyObject *__pyx_kp_s_missing_ranges_string_values_len; + PyObject *__pyx_kp_s_missing_ranges_values_in_diction; + PyObject *__pyx_kp_s_missing_ranges_values_must_be_bo; + PyObject *__pyx_kp_s_missing_user_values_not_allowed; + PyObject *__pyx_kp_s_missing_user_values_supports_val; + PyObject *__pyx_kp_s_missing_user_values_values_in_di; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_name_2; + PyObject *__pyx_n_s_nominal; + PyObject *__pyx_n_s_np; + PyObject *__pyx_n_s_nt; + PyObject *__pyx_kp_s_numeric_missing_ranges_value_giv; + PyObject *__pyx_n_s_numpy; + PyObject *__pyx_n_s_object; + PyObject *__pyx_n_s_ordinal; + PyObject *__pyx_n_s_os; + PyObject *__pyx_n_s_pandas; + PyObject *__pyx_n_s_pandas_api_types; + PyObject *__pyx_n_s_path; + PyObject *__pyx_kp_s_path_must_be_either_str_or_bytes; + PyObject *__pyx_n_s_pd; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_readstat_parser; + PyObject *__pyx_n_s_replace; + PyObject *__pyx_n_s_reset_index; + PyObject *__pyx_n_s_right; + PyObject *__pyx_n_s_round; + PyObject *__pyx_n_s_scale; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_string; + PyObject *__pyx_n_s_surrogateescape; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_time; + PyObject *__pyx_n_s_timegm; + PyObject *__pyx_n_s_timestamps; + PyObject *__pyx_n_s_timetuple; + PyObject *__pyx_n_s_timezone; + PyObject *__pyx_n_s_timezone_2; + PyObject *__pyx_n_s_tolist; + PyObject *__pyx_n_s_total_seconds; + PyObject *__pyx_n_s_tslibs; + PyObject *__pyx_n_s_tzinfo; + PyObject *__pyx_n_s_uint16; + PyObject *__pyx_n_s_uint32; + PyObject *__pyx_n_s_uint64; + PyObject *__pyx_n_s_uint8; + PyObject *__pyx_n_s_union; + PyObject *__pyx_n_s_unknown; + PyObject *__pyx_kp_s_unknown_file_format; + PyObject *__pyx_n_s_upper; + PyObject *__pyx_n_s_utc; + PyObject *__pyx_kp_s_utf_8; + PyObject *__pyx_n_s_values; + PyObject *__pyx_kp_s_variable_name_s_contains_a_space; + PyObject *__pyx_kp_s_variable_name_s_is_of_type_s_and; + PyObject *__pyx_kp_s_variable_name_s_starts_with_an_i; + PyObject *__pyx_kp_s_variable_value_labels_type_of_La; + PyObject *__pyx_kp_s_variable_value_labels_type_of_Va; + PyObject *__pyx_kp_s_variable_value_labels_type_of_Va_2; + PyObject *__pyx_kp_s_variable_value_labels_type_of_Va_3; + PyObject *__pyx_kp_s_variable_value_labels_type_of_Va_4; + PyObject *__pyx_kp_s_variable_value_labels_value_for; + PyObject *__pyx_n_s_warn; + PyObject *__pyx_n_s_warnings; + PyObject *__pyx_n_s_x; + PyObject *__pyx_n_s_zip; + PyObject *__pyx_float_1e9; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_65; + PyObject *__pyx_int_97; + PyObject *__pyx_int_1970; + PyObject *__pyx_slice_; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__7; + PyObject *__pyx_tuple__8; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__14; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__16; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container); + Py_CLEAR(clear_module_state->__pyx_n_s_CategoricalDtype); + Py_CLEAR(clear_module_state->__pyx_kp_s_Column_labels_must_be_strings); + Py_CLEAR(clear_module_state->__pyx_n_s_DataFrame); + Py_CLEAR(clear_module_state->__pyx_n_s_Float32Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_Float64Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_Int16Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_Int32Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_Int64Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_Int8Dtype); + Py_CLEAR(clear_module_state->__pyx_kp_s_M8_ns); + Py_CLEAR(clear_module_state->__pyx_kp_s_Non_unique_column_names_detected); + Py_CLEAR(clear_module_state->__pyx_n_s_PyreadstatError); + Py_CLEAR(clear_module_state->__pyx_n_s_ReadstatError); + Py_CLEAR(clear_module_state->__pyx_n_s_Timestamp); + Py_CLEAR(clear_module_state->__pyx_n_s_UInt16Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_UInt32Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_UInt64Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_UInt8Dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_UnicodeError); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unknown_data_format_to_insert); + Py_CLEAR(clear_module_state->__pyx_kp_s_Unknown_pywriter_variable_format); + Py_CLEAR(clear_module_state->__pyx_n_s__17); + Py_CLEAR(clear_module_state->__pyx_n_s__18); + Py_CLEAR(clear_module_state->__pyx_kp_s__2); + Py_CLEAR(clear_module_state->__pyx_n_s__4); + Py_CLEAR(clear_module_state->__pyx_kp_u__5); + Py_CLEAR(clear_module_state->__pyx_kp_s_alignment_for_variable_s_must_be); + Py_CLEAR(clear_module_state->__pyx_n_s_any); + Py_CLEAR(clear_module_state->__pyx_n_s_asarray); + Py_CLEAR(clear_module_state->__pyx_n_s_asm8); + Py_CLEAR(clear_module_state->__pyx_n_s_astype); + Py_CLEAR(clear_module_state->__pyx_n_s_calendar); + Py_CLEAR(clear_module_state->__pyx_n_s_center); + Py_CLEAR(clear_module_state->__pyx_kp_s_character_missing_ranges_value_g); + Py_CLEAR(clear_module_state->__pyx_n_s_chr); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_kp_s_column_labels_must_be_either_lis); + Py_CLEAR(clear_module_state->__pyx_n_s_columns); + Py_CLEAR(clear_module_state->__pyx_n_s_combine); + Py_CLEAR(clear_module_state->__pyx_n_s_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_core); + Py_CLEAR(clear_module_state->__pyx_n_s_date); + Py_CLEAR(clear_module_state->__pyx_n_s_datetime); + Py_CLEAR(clear_module_state->__pyx_n_s_datetime64); + Py_CLEAR(clear_module_state->__pyx_kp_s_datetime64_ms); + Py_CLEAR(clear_module_state->__pyx_kp_s_datetime64_ns); + Py_CLEAR(clear_module_state->__pyx_kp_s_datetime64_us); + Py_CLEAR(clear_module_state->__pyx_n_s_days); + Py_CLEAR(clear_module_state->__pyx_kp_s_dictionaries_in_missing_ranges_m); + Py_CLEAR(clear_module_state->__pyx_n_s_drop); + Py_CLEAR(clear_module_state->__pyx_n_s_dropna); + Py_CLEAR(clear_module_state->__pyx_n_s_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_dtypes); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_expanduser); + Py_CLEAR(clear_module_state->__pyx_kp_s_file_path_could_not_be_encoded_w); + Py_CLEAR(clear_module_state->__pyx_kp_s_first_argument_must_be_a_pandas); + Py_CLEAR(clear_module_state->__pyx_n_s_float); + Py_CLEAR(clear_module_state->__pyx_n_s_float32); + Py_CLEAR(clear_module_state->__pyx_n_s_float64); + Py_CLEAR(clear_module_state->__pyx_n_s_fsdecode); + Py_CLEAR(clear_module_state->__pyx_n_s_fsencode); + Py_CLEAR(clear_module_state->__pyx_n_s_get); + Py_CLEAR(clear_module_state->__pyx_n_s_getfilesystemencoding); + Py_CLEAR(clear_module_state->__pyx_n_s_hi); + Py_CLEAR(clear_module_state->__pyx_n_s_iloc); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int16); + Py_CLEAR(clear_module_state->__pyx_n_s_int32); + Py_CLEAR(clear_module_state->__pyx_n_s_int64); + Py_CLEAR(clear_module_state->__pyx_n_s_int8); + Py_CLEAR(clear_module_state->__pyx_n_s_is_datetime64_any_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_is_datetime64_ns_dtype); + Py_CLEAR(clear_module_state->__pyx_n_s_isalpha); + Py_CLEAR(clear_module_state->__pyx_n_s_isin); + Py_CLEAR(clear_module_state->__pyx_n_s_isna); + Py_CLEAR(clear_module_state->__pyx_n_s_items); + Py_CLEAR(clear_module_state->__pyx_n_s_keys); + Py_CLEAR(clear_module_state->__pyx_n_s_left); + Py_CLEAR(clear_module_state->__pyx_kp_s_length_of_column_labels_must_be); + Py_CLEAR(clear_module_state->__pyx_n_s_libs); + Py_CLEAR(clear_module_state->__pyx_n_s_lo); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_kp_s_measure_for_variable_s_must_be_e); + Py_CLEAR(clear_module_state->__pyx_n_s_min); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_hi_and_lo_values); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_hi_and_lo_values_2); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_max_1_discrete_nu); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_max_1_range_value); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_max_3_discrete_nu); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_max_3_string_valu); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_string_values_len); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_values_in_diction); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_ranges_values_must_be_bo); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_user_values_not_allowed); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_user_values_supports_val); + Py_CLEAR(clear_module_state->__pyx_kp_s_missing_user_values_values_in_di); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_name_2); + Py_CLEAR(clear_module_state->__pyx_n_s_nominal); + Py_CLEAR(clear_module_state->__pyx_n_s_np); + Py_CLEAR(clear_module_state->__pyx_n_s_nt); + Py_CLEAR(clear_module_state->__pyx_kp_s_numeric_missing_ranges_value_giv); + Py_CLEAR(clear_module_state->__pyx_n_s_numpy); + Py_CLEAR(clear_module_state->__pyx_n_s_object); + Py_CLEAR(clear_module_state->__pyx_n_s_ordinal); + Py_CLEAR(clear_module_state->__pyx_n_s_os); + Py_CLEAR(clear_module_state->__pyx_n_s_pandas); + Py_CLEAR(clear_module_state->__pyx_n_s_pandas_api_types); + Py_CLEAR(clear_module_state->__pyx_n_s_path); + Py_CLEAR(clear_module_state->__pyx_kp_s_path_must_be_either_str_or_bytes); + Py_CLEAR(clear_module_state->__pyx_n_s_pd); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_readstat_parser); + Py_CLEAR(clear_module_state->__pyx_n_s_replace); + Py_CLEAR(clear_module_state->__pyx_n_s_reset_index); + Py_CLEAR(clear_module_state->__pyx_n_s_right); + Py_CLEAR(clear_module_state->__pyx_n_s_round); + Py_CLEAR(clear_module_state->__pyx_n_s_scale); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_string); + Py_CLEAR(clear_module_state->__pyx_n_s_surrogateescape); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_time); + Py_CLEAR(clear_module_state->__pyx_n_s_timegm); + Py_CLEAR(clear_module_state->__pyx_n_s_timestamps); + Py_CLEAR(clear_module_state->__pyx_n_s_timetuple); + Py_CLEAR(clear_module_state->__pyx_n_s_timezone); + Py_CLEAR(clear_module_state->__pyx_n_s_timezone_2); + Py_CLEAR(clear_module_state->__pyx_n_s_tolist); + Py_CLEAR(clear_module_state->__pyx_n_s_total_seconds); + Py_CLEAR(clear_module_state->__pyx_n_s_tslibs); + Py_CLEAR(clear_module_state->__pyx_n_s_tzinfo); + Py_CLEAR(clear_module_state->__pyx_n_s_uint16); + Py_CLEAR(clear_module_state->__pyx_n_s_uint32); + Py_CLEAR(clear_module_state->__pyx_n_s_uint64); + Py_CLEAR(clear_module_state->__pyx_n_s_uint8); + Py_CLEAR(clear_module_state->__pyx_n_s_union); + Py_CLEAR(clear_module_state->__pyx_n_s_unknown); + Py_CLEAR(clear_module_state->__pyx_kp_s_unknown_file_format); + Py_CLEAR(clear_module_state->__pyx_n_s_upper); + Py_CLEAR(clear_module_state->__pyx_n_s_utc); + Py_CLEAR(clear_module_state->__pyx_kp_s_utf_8); + Py_CLEAR(clear_module_state->__pyx_n_s_values); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_name_s_contains_a_space); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_name_s_is_of_type_s_and); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_name_s_starts_with_an_i); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_value_labels_type_of_La); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_value_labels_type_of_Va); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_value_labels_type_of_Va_2); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_value_labels_type_of_Va_3); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_value_labels_type_of_Va_4); + Py_CLEAR(clear_module_state->__pyx_kp_s_variable_value_labels_value_for); + Py_CLEAR(clear_module_state->__pyx_n_s_warn); + Py_CLEAR(clear_module_state->__pyx_n_s_warnings); + Py_CLEAR(clear_module_state->__pyx_n_s_x); + Py_CLEAR(clear_module_state->__pyx_n_s_zip); + Py_CLEAR(clear_module_state->__pyx_float_1e9); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_65); + Py_CLEAR(clear_module_state->__pyx_int_97); + Py_CLEAR(clear_module_state->__pyx_int_1970); + Py_CLEAR(clear_module_state->__pyx_slice_); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__7); + Py_CLEAR(clear_module_state->__pyx_tuple__8); + Py_CLEAR(clear_module_state->__pyx_tuple__9); + Py_CLEAR(clear_module_state->__pyx_tuple__10); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__12); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__14); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__16); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container); + Py_VISIT(traverse_module_state->__pyx_n_s_CategoricalDtype); + Py_VISIT(traverse_module_state->__pyx_kp_s_Column_labels_must_be_strings); + Py_VISIT(traverse_module_state->__pyx_n_s_DataFrame); + Py_VISIT(traverse_module_state->__pyx_n_s_Float32Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_Float64Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_Int16Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_Int32Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_Int64Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_Int8Dtype); + Py_VISIT(traverse_module_state->__pyx_kp_s_M8_ns); + Py_VISIT(traverse_module_state->__pyx_kp_s_Non_unique_column_names_detected); + Py_VISIT(traverse_module_state->__pyx_n_s_PyreadstatError); + Py_VISIT(traverse_module_state->__pyx_n_s_ReadstatError); + Py_VISIT(traverse_module_state->__pyx_n_s_Timestamp); + Py_VISIT(traverse_module_state->__pyx_n_s_UInt16Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_UInt32Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_UInt64Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_UInt8Dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_UnicodeError); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unknown_data_format_to_insert); + Py_VISIT(traverse_module_state->__pyx_kp_s_Unknown_pywriter_variable_format); + Py_VISIT(traverse_module_state->__pyx_n_s__17); + Py_VISIT(traverse_module_state->__pyx_n_s__18); + Py_VISIT(traverse_module_state->__pyx_kp_s__2); + Py_VISIT(traverse_module_state->__pyx_n_s__4); + Py_VISIT(traverse_module_state->__pyx_kp_u__5); + Py_VISIT(traverse_module_state->__pyx_kp_s_alignment_for_variable_s_must_be); + Py_VISIT(traverse_module_state->__pyx_n_s_any); + Py_VISIT(traverse_module_state->__pyx_n_s_asarray); + Py_VISIT(traverse_module_state->__pyx_n_s_asm8); + Py_VISIT(traverse_module_state->__pyx_n_s_astype); + Py_VISIT(traverse_module_state->__pyx_n_s_calendar); + Py_VISIT(traverse_module_state->__pyx_n_s_center); + Py_VISIT(traverse_module_state->__pyx_kp_s_character_missing_ranges_value_g); + Py_VISIT(traverse_module_state->__pyx_n_s_chr); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_kp_s_column_labels_must_be_either_lis); + Py_VISIT(traverse_module_state->__pyx_n_s_columns); + Py_VISIT(traverse_module_state->__pyx_n_s_combine); + Py_VISIT(traverse_module_state->__pyx_n_s_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_core); + Py_VISIT(traverse_module_state->__pyx_n_s_date); + Py_VISIT(traverse_module_state->__pyx_n_s_datetime); + Py_VISIT(traverse_module_state->__pyx_n_s_datetime64); + Py_VISIT(traverse_module_state->__pyx_kp_s_datetime64_ms); + Py_VISIT(traverse_module_state->__pyx_kp_s_datetime64_ns); + Py_VISIT(traverse_module_state->__pyx_kp_s_datetime64_us); + Py_VISIT(traverse_module_state->__pyx_n_s_days); + Py_VISIT(traverse_module_state->__pyx_kp_s_dictionaries_in_missing_ranges_m); + Py_VISIT(traverse_module_state->__pyx_n_s_drop); + Py_VISIT(traverse_module_state->__pyx_n_s_dropna); + Py_VISIT(traverse_module_state->__pyx_n_s_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_dtypes); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_expanduser); + Py_VISIT(traverse_module_state->__pyx_kp_s_file_path_could_not_be_encoded_w); + Py_VISIT(traverse_module_state->__pyx_kp_s_first_argument_must_be_a_pandas); + Py_VISIT(traverse_module_state->__pyx_n_s_float); + Py_VISIT(traverse_module_state->__pyx_n_s_float32); + Py_VISIT(traverse_module_state->__pyx_n_s_float64); + Py_VISIT(traverse_module_state->__pyx_n_s_fsdecode); + Py_VISIT(traverse_module_state->__pyx_n_s_fsencode); + Py_VISIT(traverse_module_state->__pyx_n_s_get); + Py_VISIT(traverse_module_state->__pyx_n_s_getfilesystemencoding); + Py_VISIT(traverse_module_state->__pyx_n_s_hi); + Py_VISIT(traverse_module_state->__pyx_n_s_iloc); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int16); + Py_VISIT(traverse_module_state->__pyx_n_s_int32); + Py_VISIT(traverse_module_state->__pyx_n_s_int64); + Py_VISIT(traverse_module_state->__pyx_n_s_int8); + Py_VISIT(traverse_module_state->__pyx_n_s_is_datetime64_any_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_is_datetime64_ns_dtype); + Py_VISIT(traverse_module_state->__pyx_n_s_isalpha); + Py_VISIT(traverse_module_state->__pyx_n_s_isin); + Py_VISIT(traverse_module_state->__pyx_n_s_isna); + Py_VISIT(traverse_module_state->__pyx_n_s_items); + Py_VISIT(traverse_module_state->__pyx_n_s_keys); + Py_VISIT(traverse_module_state->__pyx_n_s_left); + Py_VISIT(traverse_module_state->__pyx_kp_s_length_of_column_labels_must_be); + Py_VISIT(traverse_module_state->__pyx_n_s_libs); + Py_VISIT(traverse_module_state->__pyx_n_s_lo); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_kp_s_measure_for_variable_s_must_be_e); + Py_VISIT(traverse_module_state->__pyx_n_s_min); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_hi_and_lo_values); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_hi_and_lo_values_2); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_max_1_discrete_nu); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_max_1_range_value); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_max_3_discrete_nu); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_max_3_string_valu); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_string_values_len); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_values_in_diction); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_ranges_values_must_be_bo); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_user_values_not_allowed); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_user_values_supports_val); + Py_VISIT(traverse_module_state->__pyx_kp_s_missing_user_values_values_in_di); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_name_2); + Py_VISIT(traverse_module_state->__pyx_n_s_nominal); + Py_VISIT(traverse_module_state->__pyx_n_s_np); + Py_VISIT(traverse_module_state->__pyx_n_s_nt); + Py_VISIT(traverse_module_state->__pyx_kp_s_numeric_missing_ranges_value_giv); + Py_VISIT(traverse_module_state->__pyx_n_s_numpy); + Py_VISIT(traverse_module_state->__pyx_n_s_object); + Py_VISIT(traverse_module_state->__pyx_n_s_ordinal); + Py_VISIT(traverse_module_state->__pyx_n_s_os); + Py_VISIT(traverse_module_state->__pyx_n_s_pandas); + Py_VISIT(traverse_module_state->__pyx_n_s_pandas_api_types); + Py_VISIT(traverse_module_state->__pyx_n_s_path); + Py_VISIT(traverse_module_state->__pyx_kp_s_path_must_be_either_str_or_bytes); + Py_VISIT(traverse_module_state->__pyx_n_s_pd); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_readstat_parser); + Py_VISIT(traverse_module_state->__pyx_n_s_replace); + Py_VISIT(traverse_module_state->__pyx_n_s_reset_index); + Py_VISIT(traverse_module_state->__pyx_n_s_right); + Py_VISIT(traverse_module_state->__pyx_n_s_round); + Py_VISIT(traverse_module_state->__pyx_n_s_scale); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_string); + Py_VISIT(traverse_module_state->__pyx_n_s_surrogateescape); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_time); + Py_VISIT(traverse_module_state->__pyx_n_s_timegm); + Py_VISIT(traverse_module_state->__pyx_n_s_timestamps); + Py_VISIT(traverse_module_state->__pyx_n_s_timetuple); + Py_VISIT(traverse_module_state->__pyx_n_s_timezone); + Py_VISIT(traverse_module_state->__pyx_n_s_timezone_2); + Py_VISIT(traverse_module_state->__pyx_n_s_tolist); + Py_VISIT(traverse_module_state->__pyx_n_s_total_seconds); + Py_VISIT(traverse_module_state->__pyx_n_s_tslibs); + Py_VISIT(traverse_module_state->__pyx_n_s_tzinfo); + Py_VISIT(traverse_module_state->__pyx_n_s_uint16); + Py_VISIT(traverse_module_state->__pyx_n_s_uint32); + Py_VISIT(traverse_module_state->__pyx_n_s_uint64); + Py_VISIT(traverse_module_state->__pyx_n_s_uint8); + Py_VISIT(traverse_module_state->__pyx_n_s_union); + Py_VISIT(traverse_module_state->__pyx_n_s_unknown); + Py_VISIT(traverse_module_state->__pyx_kp_s_unknown_file_format); + Py_VISIT(traverse_module_state->__pyx_n_s_upper); + Py_VISIT(traverse_module_state->__pyx_n_s_utc); + Py_VISIT(traverse_module_state->__pyx_kp_s_utf_8); + Py_VISIT(traverse_module_state->__pyx_n_s_values); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_name_s_contains_a_space); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_name_s_is_of_type_s_and); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_name_s_starts_with_an_i); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_value_labels_type_of_La); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_value_labels_type_of_Va); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_value_labels_type_of_Va_2); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_value_labels_type_of_Va_3); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_value_labels_type_of_Va_4); + Py_VISIT(traverse_module_state->__pyx_kp_s_variable_value_labels_value_for); + Py_VISIT(traverse_module_state->__pyx_n_s_warn); + Py_VISIT(traverse_module_state->__pyx_n_s_warnings); + Py_VISIT(traverse_module_state->__pyx_n_s_x); + Py_VISIT(traverse_module_state->__pyx_n_s_zip); + Py_VISIT(traverse_module_state->__pyx_float_1e9); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_65); + Py_VISIT(traverse_module_state->__pyx_int_97); + Py_VISIT(traverse_module_state->__pyx_int_1970); + Py_VISIT(traverse_module_state->__pyx_slice_); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__7); + Py_VISIT(traverse_module_state->__pyx_tuple__8); + Py_VISIT(traverse_module_state->__pyx_tuple__9); + Py_VISIT(traverse_module_state->__pyx_tuple__10); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__12); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__14); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__16); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_10pyreadstat_16_readstat_parser_data_container __pyx_mstate_global->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_n_s_CategoricalDtype __pyx_mstate_global->__pyx_n_s_CategoricalDtype +#define __pyx_kp_s_Column_labels_must_be_strings __pyx_mstate_global->__pyx_kp_s_Column_labels_must_be_strings +#define __pyx_n_s_DataFrame __pyx_mstate_global->__pyx_n_s_DataFrame +#define __pyx_n_s_Float32Dtype __pyx_mstate_global->__pyx_n_s_Float32Dtype +#define __pyx_n_s_Float64Dtype __pyx_mstate_global->__pyx_n_s_Float64Dtype +#define __pyx_n_s_Int16Dtype __pyx_mstate_global->__pyx_n_s_Int16Dtype +#define __pyx_n_s_Int32Dtype __pyx_mstate_global->__pyx_n_s_Int32Dtype +#define __pyx_n_s_Int64Dtype __pyx_mstate_global->__pyx_n_s_Int64Dtype +#define __pyx_n_s_Int8Dtype __pyx_mstate_global->__pyx_n_s_Int8Dtype +#define __pyx_kp_s_M8_ns __pyx_mstate_global->__pyx_kp_s_M8_ns +#define __pyx_kp_s_Non_unique_column_names_detected __pyx_mstate_global->__pyx_kp_s_Non_unique_column_names_detected +#define __pyx_n_s_PyreadstatError __pyx_mstate_global->__pyx_n_s_PyreadstatError +#define __pyx_n_s_ReadstatError __pyx_mstate_global->__pyx_n_s_ReadstatError +#define __pyx_n_s_Timestamp __pyx_mstate_global->__pyx_n_s_Timestamp +#define __pyx_n_s_UInt16Dtype __pyx_mstate_global->__pyx_n_s_UInt16Dtype +#define __pyx_n_s_UInt32Dtype __pyx_mstate_global->__pyx_n_s_UInt32Dtype +#define __pyx_n_s_UInt64Dtype __pyx_mstate_global->__pyx_n_s_UInt64Dtype +#define __pyx_n_s_UInt8Dtype __pyx_mstate_global->__pyx_n_s_UInt8Dtype +#define __pyx_n_s_UnicodeError __pyx_mstate_global->__pyx_n_s_UnicodeError +#define __pyx_kp_s_Unknown_data_format_to_insert __pyx_mstate_global->__pyx_kp_s_Unknown_data_format_to_insert +#define __pyx_kp_s_Unknown_pywriter_variable_format __pyx_mstate_global->__pyx_kp_s_Unknown_pywriter_variable_format +#define __pyx_n_s__17 __pyx_mstate_global->__pyx_n_s__17 +#define __pyx_n_s__18 __pyx_mstate_global->__pyx_n_s__18 +#define __pyx_kp_s__2 __pyx_mstate_global->__pyx_kp_s__2 +#define __pyx_n_s__4 __pyx_mstate_global->__pyx_n_s__4 +#define __pyx_kp_u__5 __pyx_mstate_global->__pyx_kp_u__5 +#define __pyx_kp_s_alignment_for_variable_s_must_be __pyx_mstate_global->__pyx_kp_s_alignment_for_variable_s_must_be +#define __pyx_n_s_any __pyx_mstate_global->__pyx_n_s_any +#define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray +#define __pyx_n_s_asm8 __pyx_mstate_global->__pyx_n_s_asm8 +#define __pyx_n_s_astype __pyx_mstate_global->__pyx_n_s_astype +#define __pyx_n_s_calendar __pyx_mstate_global->__pyx_n_s_calendar +#define __pyx_n_s_center __pyx_mstate_global->__pyx_n_s_center +#define __pyx_kp_s_character_missing_ranges_value_g __pyx_mstate_global->__pyx_kp_s_character_missing_ranges_value_g +#define __pyx_n_s_chr __pyx_mstate_global->__pyx_n_s_chr +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_kp_s_column_labels_must_be_either_lis __pyx_mstate_global->__pyx_kp_s_column_labels_must_be_either_lis +#define __pyx_n_s_columns __pyx_mstate_global->__pyx_n_s_columns +#define __pyx_n_s_combine __pyx_mstate_global->__pyx_n_s_combine +#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy +#define __pyx_n_s_core __pyx_mstate_global->__pyx_n_s_core +#define __pyx_n_s_date __pyx_mstate_global->__pyx_n_s_date +#define __pyx_n_s_datetime __pyx_mstate_global->__pyx_n_s_datetime +#define __pyx_n_s_datetime64 __pyx_mstate_global->__pyx_n_s_datetime64 +#define __pyx_kp_s_datetime64_ms __pyx_mstate_global->__pyx_kp_s_datetime64_ms +#define __pyx_kp_s_datetime64_ns __pyx_mstate_global->__pyx_kp_s_datetime64_ns +#define __pyx_kp_s_datetime64_us __pyx_mstate_global->__pyx_kp_s_datetime64_us +#define __pyx_n_s_days __pyx_mstate_global->__pyx_n_s_days +#define __pyx_kp_s_dictionaries_in_missing_ranges_m __pyx_mstate_global->__pyx_kp_s_dictionaries_in_missing_ranges_m +#define __pyx_n_s_drop __pyx_mstate_global->__pyx_n_s_drop +#define __pyx_n_s_dropna __pyx_mstate_global->__pyx_n_s_dropna +#define __pyx_n_s_dtype __pyx_mstate_global->__pyx_n_s_dtype +#define __pyx_n_s_dtypes __pyx_mstate_global->__pyx_n_s_dtypes +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_expanduser __pyx_mstate_global->__pyx_n_s_expanduser +#define __pyx_kp_s_file_path_could_not_be_encoded_w __pyx_mstate_global->__pyx_kp_s_file_path_could_not_be_encoded_w +#define __pyx_kp_s_first_argument_must_be_a_pandas __pyx_mstate_global->__pyx_kp_s_first_argument_must_be_a_pandas +#define __pyx_n_s_float __pyx_mstate_global->__pyx_n_s_float +#define __pyx_n_s_float32 __pyx_mstate_global->__pyx_n_s_float32 +#define __pyx_n_s_float64 __pyx_mstate_global->__pyx_n_s_float64 +#define __pyx_n_s_fsdecode __pyx_mstate_global->__pyx_n_s_fsdecode +#define __pyx_n_s_fsencode __pyx_mstate_global->__pyx_n_s_fsencode +#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get +#define __pyx_n_s_getfilesystemencoding __pyx_mstate_global->__pyx_n_s_getfilesystemencoding +#define __pyx_n_s_hi __pyx_mstate_global->__pyx_n_s_hi +#define __pyx_n_s_iloc __pyx_mstate_global->__pyx_n_s_iloc +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int16 __pyx_mstate_global->__pyx_n_s_int16 +#define __pyx_n_s_int32 __pyx_mstate_global->__pyx_n_s_int32 +#define __pyx_n_s_int64 __pyx_mstate_global->__pyx_n_s_int64 +#define __pyx_n_s_int8 __pyx_mstate_global->__pyx_n_s_int8 +#define __pyx_n_s_is_datetime64_any_dtype __pyx_mstate_global->__pyx_n_s_is_datetime64_any_dtype +#define __pyx_n_s_is_datetime64_ns_dtype __pyx_mstate_global->__pyx_n_s_is_datetime64_ns_dtype +#define __pyx_n_s_isalpha __pyx_mstate_global->__pyx_n_s_isalpha +#define __pyx_n_s_isin __pyx_mstate_global->__pyx_n_s_isin +#define __pyx_n_s_isna __pyx_mstate_global->__pyx_n_s_isna +#define __pyx_n_s_items __pyx_mstate_global->__pyx_n_s_items +#define __pyx_n_s_keys __pyx_mstate_global->__pyx_n_s_keys +#define __pyx_n_s_left __pyx_mstate_global->__pyx_n_s_left +#define __pyx_kp_s_length_of_column_labels_must_be __pyx_mstate_global->__pyx_kp_s_length_of_column_labels_must_be +#define __pyx_n_s_libs __pyx_mstate_global->__pyx_n_s_libs +#define __pyx_n_s_lo __pyx_mstate_global->__pyx_n_s_lo +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_kp_s_measure_for_variable_s_must_be_e __pyx_mstate_global->__pyx_kp_s_measure_for_variable_s_must_be_e +#define __pyx_n_s_min __pyx_mstate_global->__pyx_n_s_min +#define __pyx_kp_s_missing_ranges_hi_and_lo_values __pyx_mstate_global->__pyx_kp_s_missing_ranges_hi_and_lo_values +#define __pyx_kp_s_missing_ranges_hi_and_lo_values_2 __pyx_mstate_global->__pyx_kp_s_missing_ranges_hi_and_lo_values_2 +#define __pyx_kp_s_missing_ranges_max_1_discrete_nu __pyx_mstate_global->__pyx_kp_s_missing_ranges_max_1_discrete_nu +#define __pyx_kp_s_missing_ranges_max_1_range_value __pyx_mstate_global->__pyx_kp_s_missing_ranges_max_1_range_value +#define __pyx_kp_s_missing_ranges_max_3_discrete_nu __pyx_mstate_global->__pyx_kp_s_missing_ranges_max_3_discrete_nu +#define __pyx_kp_s_missing_ranges_max_3_string_valu __pyx_mstate_global->__pyx_kp_s_missing_ranges_max_3_string_valu +#define __pyx_kp_s_missing_ranges_string_values_len __pyx_mstate_global->__pyx_kp_s_missing_ranges_string_values_len +#define __pyx_kp_s_missing_ranges_values_in_diction __pyx_mstate_global->__pyx_kp_s_missing_ranges_values_in_diction +#define __pyx_kp_s_missing_ranges_values_must_be_bo __pyx_mstate_global->__pyx_kp_s_missing_ranges_values_must_be_bo +#define __pyx_kp_s_missing_user_values_not_allowed __pyx_mstate_global->__pyx_kp_s_missing_user_values_not_allowed +#define __pyx_kp_s_missing_user_values_supports_val __pyx_mstate_global->__pyx_kp_s_missing_user_values_supports_val +#define __pyx_kp_s_missing_user_values_values_in_di __pyx_mstate_global->__pyx_kp_s_missing_user_values_values_in_di +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2 +#define __pyx_n_s_nominal __pyx_mstate_global->__pyx_n_s_nominal +#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np +#define __pyx_n_s_nt __pyx_mstate_global->__pyx_n_s_nt +#define __pyx_kp_s_numeric_missing_ranges_value_giv __pyx_mstate_global->__pyx_kp_s_numeric_missing_ranges_value_giv +#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy +#define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object +#define __pyx_n_s_ordinal __pyx_mstate_global->__pyx_n_s_ordinal +#define __pyx_n_s_os __pyx_mstate_global->__pyx_n_s_os +#define __pyx_n_s_pandas __pyx_mstate_global->__pyx_n_s_pandas +#define __pyx_n_s_pandas_api_types __pyx_mstate_global->__pyx_n_s_pandas_api_types +#define __pyx_n_s_path __pyx_mstate_global->__pyx_n_s_path +#define __pyx_kp_s_path_must_be_either_str_or_bytes __pyx_mstate_global->__pyx_kp_s_path_must_be_either_str_or_bytes +#define __pyx_n_s_pd __pyx_mstate_global->__pyx_n_s_pd +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_readstat_parser __pyx_mstate_global->__pyx_n_s_readstat_parser +#define __pyx_n_s_replace __pyx_mstate_global->__pyx_n_s_replace +#define __pyx_n_s_reset_index __pyx_mstate_global->__pyx_n_s_reset_index +#define __pyx_n_s_right __pyx_mstate_global->__pyx_n_s_right +#define __pyx_n_s_round __pyx_mstate_global->__pyx_n_s_round +#define __pyx_n_s_scale __pyx_mstate_global->__pyx_n_s_scale +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_string __pyx_mstate_global->__pyx_n_s_string +#define __pyx_n_s_surrogateescape __pyx_mstate_global->__pyx_n_s_surrogateescape +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_time __pyx_mstate_global->__pyx_n_s_time +#define __pyx_n_s_timegm __pyx_mstate_global->__pyx_n_s_timegm +#define __pyx_n_s_timestamps __pyx_mstate_global->__pyx_n_s_timestamps +#define __pyx_n_s_timetuple __pyx_mstate_global->__pyx_n_s_timetuple +#define __pyx_n_s_timezone __pyx_mstate_global->__pyx_n_s_timezone +#define __pyx_n_s_timezone_2 __pyx_mstate_global->__pyx_n_s_timezone_2 +#define __pyx_n_s_tolist __pyx_mstate_global->__pyx_n_s_tolist +#define __pyx_n_s_total_seconds __pyx_mstate_global->__pyx_n_s_total_seconds +#define __pyx_n_s_tslibs __pyx_mstate_global->__pyx_n_s_tslibs +#define __pyx_n_s_tzinfo __pyx_mstate_global->__pyx_n_s_tzinfo +#define __pyx_n_s_uint16 __pyx_mstate_global->__pyx_n_s_uint16 +#define __pyx_n_s_uint32 __pyx_mstate_global->__pyx_n_s_uint32 +#define __pyx_n_s_uint64 __pyx_mstate_global->__pyx_n_s_uint64 +#define __pyx_n_s_uint8 __pyx_mstate_global->__pyx_n_s_uint8 +#define __pyx_n_s_union __pyx_mstate_global->__pyx_n_s_union +#define __pyx_n_s_unknown __pyx_mstate_global->__pyx_n_s_unknown +#define __pyx_kp_s_unknown_file_format __pyx_mstate_global->__pyx_kp_s_unknown_file_format +#define __pyx_n_s_upper __pyx_mstate_global->__pyx_n_s_upper +#define __pyx_n_s_utc __pyx_mstate_global->__pyx_n_s_utc +#define __pyx_kp_s_utf_8 __pyx_mstate_global->__pyx_kp_s_utf_8 +#define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values +#define __pyx_kp_s_variable_name_s_contains_a_space __pyx_mstate_global->__pyx_kp_s_variable_name_s_contains_a_space +#define __pyx_kp_s_variable_name_s_is_of_type_s_and __pyx_mstate_global->__pyx_kp_s_variable_name_s_is_of_type_s_and +#define __pyx_kp_s_variable_name_s_starts_with_an_i __pyx_mstate_global->__pyx_kp_s_variable_name_s_starts_with_an_i +#define __pyx_kp_s_variable_value_labels_type_of_La __pyx_mstate_global->__pyx_kp_s_variable_value_labels_type_of_La +#define __pyx_kp_s_variable_value_labels_type_of_Va __pyx_mstate_global->__pyx_kp_s_variable_value_labels_type_of_Va +#define __pyx_kp_s_variable_value_labels_type_of_Va_2 __pyx_mstate_global->__pyx_kp_s_variable_value_labels_type_of_Va_2 +#define __pyx_kp_s_variable_value_labels_type_of_Va_3 __pyx_mstate_global->__pyx_kp_s_variable_value_labels_type_of_Va_3 +#define __pyx_kp_s_variable_value_labels_type_of_Va_4 __pyx_mstate_global->__pyx_kp_s_variable_value_labels_type_of_Va_4 +#define __pyx_kp_s_variable_value_labels_value_for __pyx_mstate_global->__pyx_kp_s_variable_value_labels_value_for +#define __pyx_n_s_warn __pyx_mstate_global->__pyx_n_s_warn +#define __pyx_n_s_warnings __pyx_mstate_global->__pyx_n_s_warnings +#define __pyx_n_s_x __pyx_mstate_global->__pyx_n_s_x +#define __pyx_n_s_zip __pyx_mstate_global->__pyx_n_s_zip +#define __pyx_float_1e9 __pyx_mstate_global->__pyx_float_1e9 +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_65 __pyx_mstate_global->__pyx_int_65 +#define __pyx_int_97 __pyx_mstate_global->__pyx_int_97 +#define __pyx_int_1970 __pyx_mstate_global->__pyx_int_1970 +#define __pyx_slice_ __pyx_mstate_global->__pyx_slice_ +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 +#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 +#define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9 +#define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__14 __pyx_mstate_global->__pyx_tuple__14 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16 +/* #### Code section: module_code ### */ + +/* "pyreadstat/_readstat_writer.pyx":62 * * * cdef double convert_datetimelike_to_number(dst_file_format file_format, pywriter_variable_type curtype, object curval) except *: # <<<<<<<<<<<<<< @@ -2056,15 +3360,15 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - double __pyx_t_9; - int __pyx_t_10; + int __pyx_t_9; + double __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_datetimelike_to_number", 0); __Pyx_INCREF(__pyx_v_curval); - /* "pyreadstat/_readstat_writer.pyx":72 + /* "pyreadstat/_readstat_writer.pyx":69 * cdef double offset_days, tstamp * * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -2075,7 +3379,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAV: case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR: - /* "pyreadstat/_readstat_writer.pyx":73 + /* "pyreadstat/_readstat_writer.pyx":70 * * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: * offset_days = spss_offset_days # <<<<<<<<<<<<<< @@ -2084,7 +3388,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_offset_days = __pyx_v_10pyreadstat_16_readstat_writer_spss_offset_days; - /* "pyreadstat/_readstat_writer.pyx":74 + /* "pyreadstat/_readstat_writer.pyx":71 * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: * offset_days = spss_offset_days * offset_secs = spss_offset_secs # <<<<<<<<<<<<<< @@ -2093,7 +3397,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_offset_secs = __pyx_v_10pyreadstat_16_readstat_writer_spss_offset_secs; - /* "pyreadstat/_readstat_writer.pyx":72 + /* "pyreadstat/_readstat_writer.pyx":69 * cdef double offset_days, tstamp * * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -2103,7 +3407,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu break; default: - /* "pyreadstat/_readstat_writer.pyx":76 + /* "pyreadstat/_readstat_writer.pyx":73 * offset_secs = spss_offset_secs * else: * offset_days = sas_offset_days # <<<<<<<<<<<<<< @@ -2112,7 +3416,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_offset_days = __pyx_v_10pyreadstat_16_readstat_writer_sas_offset_days; - /* "pyreadstat/_readstat_writer.pyx":77 + /* "pyreadstat/_readstat_writer.pyx":74 * else: * offset_days = sas_offset_days * offset_secs = sas_offset_secs # <<<<<<<<<<<<<< @@ -2123,7 +3427,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu break; } - /* "pyreadstat/_readstat_writer.pyx":79 + /* "pyreadstat/_readstat_writer.pyx":76 * offset_secs = sas_offset_secs * * if curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< @@ -2134,46 +3438,46 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME: case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64: - /* "pyreadstat/_readstat_writer.pyx":81 + /* "pyreadstat/_readstat_writer.pyx":78 * if curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: * # get timestamp in seconds * if type(curval) == pd._libs.tslibs.timestamps.Timestamp: # <<<<<<<<<<<<<< * curval = curval.asm8 * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_libs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_libs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __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_timestamps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_timestamps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __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, 81, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":82 + /* "pyreadstat/_readstat_writer.pyx":79 * # get timestamp in seconds * if type(curval) == pd._libs.tslibs.timestamps.Timestamp: * curval = curval.asm8 # <<<<<<<<<<<<<< * * if type(curval) == datetime.datetime: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_asm8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_asm8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_curval, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":81 + /* "pyreadstat/_readstat_writer.pyx":78 * if curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: * # get timestamp in seconds * if type(curval) == pd._libs.tslibs.timestamps.Timestamp: # <<<<<<<<<<<<<< @@ -2182,55 +3486,56 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ } - /* "pyreadstat/_readstat_writer.pyx":84 + /* "pyreadstat/_readstat_writer.pyx":81 * curval = curval.asm8 * * if type(curval) == datetime.datetime: # <<<<<<<<<<<<<< * #tstamp = curval.replace(tzinfo=timezone.utc).timestamp() # works only in python 3 * tstamp = calendar.timegm(curval.replace(tzinfo=_timezone.utc).timetuple()) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __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, 84, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":86 + /* "pyreadstat/_readstat_writer.pyx":83 * if type(curval) == datetime.datetime: * #tstamp = curval.replace(tzinfo=timezone.utc).timestamp() # works only in python 3 * tstamp = calendar.timegm(curval.replace(tzinfo=_timezone.utc).timetuple()) # <<<<<<<<<<<<<< * elif type(curval) == np.datetime64: * if curval.dtype.name == "datetime64[ns]": */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_calendar); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_calendar); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_timegm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_timegm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_replace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_replace); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_timezone); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_timezone); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_utc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_utc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tzinfo, __pyx_t_8) < 0) __PYX_ERR(0, 86, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_tzinfo, __pyx_t_8) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_timetuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_timetuple); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_8)) { @@ -2238,14 +3543,19 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_9 = 1; } } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_8, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } __pyx_t_6 = NULL; + __pyx_t_9 = 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)) { @@ -2253,19 +3563,23 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_9 = 1; } } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_1}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_tstamp = __pyx_t_9; + __pyx_v_tstamp = __pyx_t_10; - /* "pyreadstat/_readstat_writer.pyx":84 + /* "pyreadstat/_readstat_writer.pyx":81 * curval = curval.asm8 * * if type(curval) == datetime.datetime: # <<<<<<<<<<<<<< @@ -2275,50 +3589,51 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu goto __pyx_L4; } - /* "pyreadstat/_readstat_writer.pyx":87 + /* "pyreadstat/_readstat_writer.pyx":84 * #tstamp = curval.replace(tzinfo=timezone.utc).timestamp() # works only in python 3 * tstamp = calendar.timegm(curval.replace(tzinfo=_timezone.utc).timetuple()) * elif type(curval) == np.datetime64: # <<<<<<<<<<<<<< * if curval.dtype.name == "datetime64[ns]": * tstamp = round(curval.astype(float)/1e9) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":88 + /* "pyreadstat/_readstat_writer.pyx":85 * tstamp = calendar.timegm(curval.replace(tzinfo=_timezone.utc).timetuple()) * elif type(curval) == np.datetime64: * if curval.dtype.name == "datetime64[ns]": # <<<<<<<<<<<<<< * tstamp = round(curval.astype(float)/1e9) * elif curval.dtype.name == "datetime64[us]": */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_datetime64_ns, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_datetime64_ns, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":89 + /* "pyreadstat/_readstat_writer.pyx":86 * elif type(curval) == np.datetime64: * if curval.dtype.name == "datetime64[ns]": * tstamp = round(curval.astype(float)/1e9) # <<<<<<<<<<<<<< * elif curval.dtype.name == "datetime64[us]": * tstamp = round(curval.astype(float)/1e6) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { @@ -2326,18 +3641,22 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_9 = 1; } } - __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, ((PyObject *)(&PyFloat_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)(&PyFloat_Type))); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)(&PyFloat_Type))}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_tstamp = round((((double)__pyx_t_9) / 1e9)); + __pyx_v_tstamp = round((((double)__pyx_t_10) / 1e9)); - /* "pyreadstat/_readstat_writer.pyx":88 + /* "pyreadstat/_readstat_writer.pyx":85 * tstamp = calendar.timegm(curval.replace(tzinfo=_timezone.utc).timetuple()) * elif type(curval) == np.datetime64: * if curval.dtype.name == "datetime64[ns]": # <<<<<<<<<<<<<< @@ -2347,32 +3666,33 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu goto __pyx_L5; } - /* "pyreadstat/_readstat_writer.pyx":90 + /* "pyreadstat/_readstat_writer.pyx":87 * if curval.dtype.name == "datetime64[ns]": * tstamp = round(curval.astype(float)/1e9) * elif curval.dtype.name == "datetime64[us]": # <<<<<<<<<<<<<< * tstamp = round(curval.astype(float)/1e6) * elif curval.dtype.name == "datetime64[ms]": */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s_datetime64_us, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s_datetime64_us, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":91 + /* "pyreadstat/_readstat_writer.pyx":88 * tstamp = round(curval.astype(float)/1e9) * elif curval.dtype.name == "datetime64[us]": * tstamp = round(curval.astype(float)/1e6) # <<<<<<<<<<<<<< * elif curval.dtype.name == "datetime64[ms]": * tstamp = round(curval.astype(float)/1e3) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = NULL; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { @@ -2380,18 +3700,22 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_9 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, ((PyObject *)(&PyFloat_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)(&PyFloat_Type))); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)(&PyFloat_Type))}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_tstamp = round((((double)__pyx_t_9) / 1e6)); + __pyx_v_tstamp = round((((double)__pyx_t_10) / 1e6)); - /* "pyreadstat/_readstat_writer.pyx":90 + /* "pyreadstat/_readstat_writer.pyx":87 * if curval.dtype.name == "datetime64[ns]": * tstamp = round(curval.astype(float)/1e9) * elif curval.dtype.name == "datetime64[us]": # <<<<<<<<<<<<<< @@ -2401,32 +3725,33 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu goto __pyx_L5; } - /* "pyreadstat/_readstat_writer.pyx":92 + /* "pyreadstat/_readstat_writer.pyx":89 * elif curval.dtype.name == "datetime64[us]": * tstamp = round(curval.astype(float)/1e6) * elif curval.dtype.name == "datetime64[ms]": # <<<<<<<<<<<<<< * tstamp = round(curval.astype(float)/1e3) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_datetime64_ms, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_datetime64_ms, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":93 + /* "pyreadstat/_readstat_writer.pyx":90 * tstamp = round(curval.astype(float)/1e6) * elif curval.dtype.name == "datetime64[ms]": * tstamp = round(curval.astype(float)/1e3) # <<<<<<<<<<<<<< * * tstamp += offset_secs */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_astype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { @@ -2434,18 +3759,22 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_9 = 1; } } - __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, ((PyObject *)(&PyFloat_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)(&PyFloat_Type))); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)(&PyFloat_Type))}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_tstamp = round((((double)__pyx_t_9) / 1e3)); + __pyx_v_tstamp = round((((double)__pyx_t_10) / 1e3)); - /* "pyreadstat/_readstat_writer.pyx":92 + /* "pyreadstat/_readstat_writer.pyx":89 * elif curval.dtype.name == "datetime64[us]": * tstamp = round(curval.astype(float)/1e6) * elif curval.dtype.name == "datetime64[ms]": # <<<<<<<<<<<<<< @@ -2455,7 +3784,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu } __pyx_L5:; - /* "pyreadstat/_readstat_writer.pyx":87 + /* "pyreadstat/_readstat_writer.pyx":84 * #tstamp = curval.replace(tzinfo=timezone.utc).timestamp() # works only in python 3 * tstamp = calendar.timegm(curval.replace(tzinfo=_timezone.utc).timetuple()) * elif type(curval) == np.datetime64: # <<<<<<<<<<<<<< @@ -2465,7 +3794,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu } __pyx_L4:; - /* "pyreadstat/_readstat_writer.pyx":95 + /* "pyreadstat/_readstat_writer.pyx":92 * tstamp = round(curval.astype(float)/1e3) * * tstamp += offset_secs # <<<<<<<<<<<<<< @@ -2474,17 +3803,17 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_tstamp = (__pyx_v_tstamp + __pyx_v_offset_secs); - /* "pyreadstat/_readstat_writer.pyx":96 + /* "pyreadstat/_readstat_writer.pyx":93 * * tstamp += offset_secs * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< * # stata stores in milliseconds * tstamp *= 1000 */ - __pyx_t_3 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA) != 0); + __pyx_t_3 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":98 + /* "pyreadstat/_readstat_writer.pyx":95 * if file_format == FILE_FORMAT_DTA: * # stata stores in milliseconds * tstamp *= 1000 # <<<<<<<<<<<<<< @@ -2493,7 +3822,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_tstamp = (__pyx_v_tstamp * 1000.0); - /* "pyreadstat/_readstat_writer.pyx":96 + /* "pyreadstat/_readstat_writer.pyx":93 * * tstamp += offset_secs * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -2502,7 +3831,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ } - /* "pyreadstat/_readstat_writer.pyx":79 + /* "pyreadstat/_readstat_writer.pyx":76 * offset_secs = sas_offset_secs * * if curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< @@ -2512,50 +3841,50 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE: - /* "pyreadstat/_readstat_writer.pyx":101 + /* "pyreadstat/_readstat_writer.pyx":98 * * elif curtype == PYWRITER_DATE: * if type(curval) == datetime.date: # <<<<<<<<<<<<<< * days = curval - date_0 * tstamp = days.days */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":102 + /* "pyreadstat/_readstat_writer.pyx":99 * elif curtype == PYWRITER_DATE: * if type(curval) == datetime.date: * days = curval - date_0 # <<<<<<<<<<<<<< * tstamp = days.days * tstamp += offset_days */ - __pyx_t_4 = PyNumber_Subtract(__pyx_v_curval, __pyx_v_10pyreadstat_16_readstat_writer_date_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) + __pyx_t_4 = PyNumber_Subtract(__pyx_v_curval, __pyx_v_10pyreadstat_16_readstat_writer_date_0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_days = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":103 + /* "pyreadstat/_readstat_writer.pyx":100 * if type(curval) == datetime.date: * days = curval - date_0 * tstamp = days.days # <<<<<<<<<<<<<< * tstamp += offset_days * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_days, __pyx_n_s_days); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_days, __pyx_n_s_days); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_tstamp = __pyx_t_9; + __pyx_v_tstamp = __pyx_t_10; - /* "pyreadstat/_readstat_writer.pyx":104 + /* "pyreadstat/_readstat_writer.pyx":101 * days = curval - date_0 * tstamp = days.days * tstamp += offset_days # <<<<<<<<<<<<<< @@ -2564,7 +3893,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_tstamp = (__pyx_v_tstamp + __pyx_v_offset_days); - /* "pyreadstat/_readstat_writer.pyx":105 + /* "pyreadstat/_readstat_writer.pyx":102 * tstamp = days.days * tstamp += offset_days * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -2575,7 +3904,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAV: case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR: - /* "pyreadstat/_readstat_writer.pyx":107 + /* "pyreadstat/_readstat_writer.pyx":104 * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: * # spss stores in seconds * tstamp *= 86400 # <<<<<<<<<<<<<< @@ -2584,7 +3913,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_tstamp = (__pyx_v_tstamp * 86400.0); - /* "pyreadstat/_readstat_writer.pyx":105 + /* "pyreadstat/_readstat_writer.pyx":102 * tstamp = days.days * tstamp += offset_days * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -2595,7 +3924,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu default: break; } - /* "pyreadstat/_readstat_writer.pyx":101 + /* "pyreadstat/_readstat_writer.pyx":98 * * elif curtype == PYWRITER_DATE: * if type(curval) == datetime.date: # <<<<<<<<<<<<<< @@ -2604,7 +3933,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ } - /* "pyreadstat/_readstat_writer.pyx":100 + /* "pyreadstat/_readstat_writer.pyx":97 * tstamp *= 1000 * * elif curtype == PYWRITER_DATE: # <<<<<<<<<<<<<< @@ -2614,49 +3943,49 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME: - /* "pyreadstat/_readstat_writer.pyx":110 + /* "pyreadstat/_readstat_writer.pyx":107 * * elif curtype == PYWRITER_TIME: * if type(curval) == datetime.time: # <<<<<<<<<<<<<< * tdelta = datetime.datetime.combine(datetime.date.min, curval) - datetime.datetime.min * tstamp = tdelta.total_seconds() */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_curval)), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":111 + /* "pyreadstat/_readstat_writer.pyx":108 * elif curtype == PYWRITER_TIME: * if type(curval) == datetime.time: * tdelta = datetime.datetime.combine(datetime.date.min, curval) - datetime.datetime.min # <<<<<<<<<<<<<< * tstamp = tdelta.total_seconds() * #tstamp += offset * 86400 */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __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_combine); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_combine); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_date); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_date); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; - __pyx_t_10 = 0; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_6)) { @@ -2664,69 +3993,44 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_10 = 1; + __pyx_t_9 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_curval}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_curval}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) + { + PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_curval}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 2+__pyx_t_9); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 111, __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_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_t_1); - __Pyx_INCREF(__pyx_v_curval); - __Pyx_GIVEREF(__pyx_v_curval); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_curval); - __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __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_8, __pyx_n_s_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __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_v_tdelta = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_tdelta = __pyx_t_1; + __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":112 + /* "pyreadstat/_readstat_writer.pyx":109 * if type(curval) == datetime.time: * tdelta = datetime.datetime.combine(datetime.date.min, curval) - datetime.datetime.min * tstamp = tdelta.total_seconds() # <<<<<<<<<<<<<< * #tstamp += offset * 86400 * if file_format == FILE_FORMAT_DTA: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tdelta, __pyx_n_s_total_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_tdelta, __pyx_n_s_total_seconds); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; + __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { @@ -2734,28 +4038,32 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_9 = 1; } } - __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_tstamp = __pyx_t_9; + { + PyObject *__pyx_callargs[1] = {__pyx_t_4, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_tstamp = __pyx_t_10; - /* "pyreadstat/_readstat_writer.pyx":114 + /* "pyreadstat/_readstat_writer.pyx":111 * tstamp = tdelta.total_seconds() * #tstamp += offset * 86400 * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< * # stata stores in milliseconds * tstamp *= 1000 */ - __pyx_t_3 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA) != 0); + __pyx_t_3 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":116 + /* "pyreadstat/_readstat_writer.pyx":113 * if file_format == FILE_FORMAT_DTA: * # stata stores in milliseconds * tstamp *= 1000 # <<<<<<<<<<<<<< @@ -2764,7 +4072,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ __pyx_v_tstamp = (__pyx_v_tstamp * 1000.0); - /* "pyreadstat/_readstat_writer.pyx":114 + /* "pyreadstat/_readstat_writer.pyx":111 * tstamp = tdelta.total_seconds() * #tstamp += offset * 86400 * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -2773,7 +4081,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ } - /* "pyreadstat/_readstat_writer.pyx":110 + /* "pyreadstat/_readstat_writer.pyx":107 * * elif curtype == PYWRITER_TIME: * if type(curval) == datetime.time: # <<<<<<<<<<<<<< @@ -2782,7 +4090,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu */ } - /* "pyreadstat/_readstat_writer.pyx":109 + /* "pyreadstat/_readstat_writer.pyx":106 * tstamp *= 86400 * * elif curtype == PYWRITER_TIME: # <<<<<<<<<<<<<< @@ -2793,7 +4101,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu default: break; } - /* "pyreadstat/_readstat_writer.pyx":118 + /* "pyreadstat/_readstat_writer.pyx":115 * tstamp *= 1000 * * return tstamp # <<<<<<<<<<<<<< @@ -2803,7 +4111,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu __pyx_r = __pyx_v_tstamp; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":65 + /* "pyreadstat/_readstat_writer.pyx":62 * * * cdef double convert_datetimelike_to_number(dst_file_format file_format, pywriter_variable_type curtype, object curval) except *: # <<<<<<<<<<<<<< @@ -2830,7 +4138,7 @@ static double __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_nu return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":120 +/* "pyreadstat/_readstat_writer.pyx":117 * return tstamp * * cdef char * get_datetimelike_format_for_readstat(dst_file_format file_format, pywriter_variable_type curtype): # <<<<<<<<<<<<<< @@ -2845,12 +4153,13 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for 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("get_datetimelike_format_for_readstat", 0); - /* "pyreadstat/_readstat_writer.pyx":125 + /* "pyreadstat/_readstat_writer.pyx":122 * """ * * if curtype == PYWRITER_DATE: # <<<<<<<<<<<<<< @@ -2860,17 +4169,17 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for switch (__pyx_v_curtype) { case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE: - /* "pyreadstat/_readstat_writer.pyx":126 + /* "pyreadstat/_readstat_writer.pyx":123 * * if curtype == PYWRITER_DATE: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< * return "%td" * #elif file_format == FILE_FORMAT_SAV: */ - __pyx_t_1 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA) != 0); + __pyx_t_1 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA); if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":127 + /* "pyreadstat/_readstat_writer.pyx":124 * if curtype == PYWRITER_DATE: * if file_format == FILE_FORMAT_DTA: * return "%td" # <<<<<<<<<<<<<< @@ -2880,7 +4189,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for __pyx_r = ((char *)"%td"); goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":126 + /* "pyreadstat/_readstat_writer.pyx":123 * * if curtype == PYWRITER_DATE: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -2889,7 +4198,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for */ } - /* "pyreadstat/_readstat_writer.pyx":131 + /* "pyreadstat/_readstat_writer.pyx":128 * # return "DATE11" * else: * return "DATE" # <<<<<<<<<<<<<< @@ -2901,7 +4210,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for goto __pyx_L0; } - /* "pyreadstat/_readstat_writer.pyx":125 + /* "pyreadstat/_readstat_writer.pyx":122 * """ * * if curtype == PYWRITER_DATE: # <<<<<<<<<<<<<< @@ -2911,7 +4220,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME: - /* "pyreadstat/_readstat_writer.pyx":132 + /* "pyreadstat/_readstat_writer.pyx":129 * else: * return "DATE" * elif curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< @@ -2920,17 +4229,17 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for */ case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64: - /* "pyreadstat/_readstat_writer.pyx":133 + /* "pyreadstat/_readstat_writer.pyx":130 * return "DATE" * elif curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< * return "%tc" * #elif file_format == FILE_FORMAT_SAV: */ - __pyx_t_1 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA) != 0); + __pyx_t_1 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA); if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":134 + /* "pyreadstat/_readstat_writer.pyx":131 * elif curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: * if file_format == FILE_FORMAT_DTA: * return "%tc" # <<<<<<<<<<<<<< @@ -2940,7 +4249,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for __pyx_r = ((char *)"%tc"); goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":133 + /* "pyreadstat/_readstat_writer.pyx":130 * return "DATE" * elif curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -2949,7 +4258,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for */ } - /* "pyreadstat/_readstat_writer.pyx":138 + /* "pyreadstat/_readstat_writer.pyx":135 * # return "DATETIME20" * else: * return "DATETIME" # <<<<<<<<<<<<<< @@ -2961,7 +4270,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for goto __pyx_L0; } - /* "pyreadstat/_readstat_writer.pyx":132 + /* "pyreadstat/_readstat_writer.pyx":129 * else: * return "DATE" * elif curtype == PYWRITER_DATETIME or curtype == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< @@ -2971,17 +4280,17 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME: - /* "pyreadstat/_readstat_writer.pyx":140 + /* "pyreadstat/_readstat_writer.pyx":137 * return "DATETIME" * elif curtype == PYWRITER_TIME: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< * return "%tcHH:MM:SS" * else: */ - __pyx_t_1 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA) != 0); + __pyx_t_1 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA); if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":141 + /* "pyreadstat/_readstat_writer.pyx":138 * elif curtype == PYWRITER_TIME: * if file_format == FILE_FORMAT_DTA: * return "%tcHH:MM:SS" # <<<<<<<<<<<<<< @@ -2991,7 +4300,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for __pyx_r = ((char *)"%tcHH:MM:SS"); goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":140 + /* "pyreadstat/_readstat_writer.pyx":137 * return "DATETIME" * elif curtype == PYWRITER_TIME: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -3000,7 +4309,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for */ } - /* "pyreadstat/_readstat_writer.pyx":143 + /* "pyreadstat/_readstat_writer.pyx":140 * return "%tcHH:MM:SS" * else: * return "TIME" # <<<<<<<<<<<<<< @@ -3012,7 +4321,7 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for goto __pyx_L0; } - /* "pyreadstat/_readstat_writer.pyx":139 + /* "pyreadstat/_readstat_writer.pyx":136 * else: * return "DATETIME" * elif curtype == PYWRITER_TIME: # <<<<<<<<<<<<<< @@ -3022,16 +4331,17 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for break; default: - /* "pyreadstat/_readstat_writer.pyx":145 + /* "pyreadstat/_readstat_writer.pyx":142 * return "TIME" * else: * raise PyreadstatError("Unknown pywriter variable format") # <<<<<<<<<<<<<< * * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; + __pyx_t_5 = 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)) { @@ -3039,20 +4349,24 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_kp_s_Unknown_pywriter_variable_format) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Unknown_pywriter_variable_format); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_s_Unknown_pywriter_variable_format}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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, 145, __pyx_L1_error) + __PYX_ERR(0, 142, __pyx_L1_error) break; } - /* "pyreadstat/_readstat_writer.pyx":120 + /* "pyreadstat/_readstat_writer.pyx":117 * return tstamp * * cdef char * get_datetimelike_format_for_readstat(dst_file_format file_format, pywriter_variable_type curtype): # <<<<<<<<<<<<<< @@ -3065,14 +4379,14 @@ static char *__pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("pyreadstat._readstat_writer.get_datetimelike_format_for_readstat", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; + __Pyx_AddTraceback("pyreadstat._readstat_writer.get_datetimelike_format_for_readstat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":148 +/* "pyreadstat/_readstat_writer.pyx":145 * * * cdef int get_pandas_str_series_max_length(object series, dict value_labels): # <<<<<<<<<<<<<< @@ -3101,19 +4415,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_pandas_str_series_max_length", 0); - /* "pyreadstat/_readstat_writer.pyx":151 + /* "pyreadstat/_readstat_writer.pyx":148 * """ For a pandas string series get the max length of the strings. Assumes there is no NaN among the elements. * """ * values = series.values # <<<<<<<<<<<<<< * cdef str val * cdef bytes temp */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_series, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_series, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_values = __pyx_t_1; __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":154 + /* "pyreadstat/_readstat_writer.pyx":151 * cdef str val * cdef bytes temp * cdef int max_length = 0 # <<<<<<<<<<<<<< @@ -3122,7 +4436,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ __pyx_v_max_length = 0; - /* "pyreadstat/_readstat_writer.pyx":157 + /* "pyreadstat/_readstat_writer.pyx":154 * cdef int curlen * cdef list labels * for val in values: # <<<<<<<<<<<<<< @@ -3133,26 +4447,26 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len __pyx_t_1 = __pyx_v_values; __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_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __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, 157, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __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, 157, __pyx_L1_error) + __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, 154, __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, 157, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __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, 157, __pyx_L1_error) + __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, 154, __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, 157, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -3162,30 +4476,30 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 157, __pyx_L1_error) + else __PYX_ERR(0, 154, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } - if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 157, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_4))) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_val, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":158 + /* "pyreadstat/_readstat_writer.pyx":155 * cdef list labels * for val in values: * temp = val.encode("utf-8") # <<<<<<<<<<<<<< * curlen = len(temp) * if curlen > max_length: */ - __pyx_t_4 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_val, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_4 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_val, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 158, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_4))) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_temp, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":159 + /* "pyreadstat/_readstat_writer.pyx":156 * for val in values: * temp = val.encode("utf-8") * curlen = len(temp) # <<<<<<<<<<<<<< @@ -3194,22 +4508,22 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ if (unlikely(__pyx_v_temp == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 159, __pyx_L1_error) + __PYX_ERR(0, 156, __pyx_L1_error) } - __pyx_t_5 = PyBytes_GET_SIZE(__pyx_v_temp); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_5 = PyBytes_GET_SIZE(__pyx_v_temp); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 156, __pyx_L1_error) __pyx_v_curlen = __pyx_t_5; - /* "pyreadstat/_readstat_writer.pyx":160 + /* "pyreadstat/_readstat_writer.pyx":157 * temp = val.encode("utf-8") * curlen = len(temp) * if curlen > max_length: # <<<<<<<<<<<<<< * max_length = curlen * if value_labels: */ - __pyx_t_6 = ((__pyx_v_curlen > __pyx_v_max_length) != 0); + __pyx_t_6 = (__pyx_v_curlen > __pyx_v_max_length); if (__pyx_t_6) { - /* "pyreadstat/_readstat_writer.pyx":161 + /* "pyreadstat/_readstat_writer.pyx":158 * curlen = len(temp) * if curlen > max_length: * max_length = curlen # <<<<<<<<<<<<<< @@ -3218,7 +4532,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ __pyx_v_max_length = __pyx_v_curlen; - /* "pyreadstat/_readstat_writer.pyx":160 + /* "pyreadstat/_readstat_writer.pyx":157 * temp = val.encode("utf-8") * curlen = len(temp) * if curlen > max_length: # <<<<<<<<<<<<<< @@ -3227,7 +4541,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ } - /* "pyreadstat/_readstat_writer.pyx":157 + /* "pyreadstat/_readstat_writer.pyx":154 * cdef int curlen * cdef list labels * for val in values: # <<<<<<<<<<<<<< @@ -3237,17 +4551,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":162 + /* "pyreadstat/_readstat_writer.pyx":159 * if curlen > max_length: * max_length = curlen * if value_labels: # <<<<<<<<<<<<<< * labels = list(value_labels.keys()) * for lab in labels: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_value_labels); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_value_labels); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 159, __pyx_L1_error) if (__pyx_t_6) { - /* "pyreadstat/_readstat_writer.pyx":163 + /* "pyreadstat/_readstat_writer.pyx":160 * max_length = curlen * if value_labels: * labels = list(value_labels.keys()) # <<<<<<<<<<<<<< @@ -3256,17 +4570,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ if (unlikely(__pyx_v_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys"); - __PYX_ERR(0, 163, __pyx_L1_error) + __PYX_ERR(0, 160, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_value_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_value_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_4 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_labels = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":164 + /* "pyreadstat/_readstat_writer.pyx":161 * if value_labels: * labels = list(value_labels.keys()) * for lab in labels: # <<<<<<<<<<<<<< @@ -3277,38 +4591,38 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len for (;;) { if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 161, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif __Pyx_XDECREF_SET(__pyx_v_lab, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":165 + /* "pyreadstat/_readstat_writer.pyx":162 * labels = list(value_labels.keys()) * for lab in labels: * curlen = len(str(lab)) # <<<<<<<<<<<<<< * if curlen > max_length: * max_length = curlen */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_lab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Str(__pyx_v_lab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __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, 165, __pyx_L1_error) + __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_curlen = __pyx_t_5; - /* "pyreadstat/_readstat_writer.pyx":166 + /* "pyreadstat/_readstat_writer.pyx":163 * for lab in labels: * curlen = len(str(lab)) * if curlen > max_length: # <<<<<<<<<<<<<< * max_length = curlen * */ - __pyx_t_6 = ((__pyx_v_curlen > __pyx_v_max_length) != 0); + __pyx_t_6 = (__pyx_v_curlen > __pyx_v_max_length); if (__pyx_t_6) { - /* "pyreadstat/_readstat_writer.pyx":167 + /* "pyreadstat/_readstat_writer.pyx":164 * curlen = len(str(lab)) * if curlen > max_length: * max_length = curlen # <<<<<<<<<<<<<< @@ -3317,7 +4631,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ __pyx_v_max_length = __pyx_v_curlen; - /* "pyreadstat/_readstat_writer.pyx":166 + /* "pyreadstat/_readstat_writer.pyx":163 * for lab in labels: * curlen = len(str(lab)) * if curlen > max_length: # <<<<<<<<<<<<<< @@ -3326,7 +4640,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ } - /* "pyreadstat/_readstat_writer.pyx":164 + /* "pyreadstat/_readstat_writer.pyx":161 * if value_labels: * labels = list(value_labels.keys()) * for lab in labels: # <<<<<<<<<<<<<< @@ -3336,7 +4650,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":162 + /* "pyreadstat/_readstat_writer.pyx":159 * if curlen > max_length: * max_length = curlen * if value_labels: # <<<<<<<<<<<<<< @@ -3345,7 +4659,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len */ } - /* "pyreadstat/_readstat_writer.pyx":169 + /* "pyreadstat/_readstat_writer.pyx":166 * max_length = curlen * * return max_length # <<<<<<<<<<<<<< @@ -3355,7 +4669,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len __pyx_r = __pyx_v_max_length; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":148 + /* "pyreadstat/_readstat_writer.pyx":145 * * * cdef int get_pandas_str_series_max_length(object series, dict value_labels): # <<<<<<<<<<<<<< @@ -3367,8 +4681,8 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("pyreadstat._readstat_writer.get_pandas_str_series_max_length", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; + __Pyx_AddTraceback("pyreadstat._readstat_writer.get_pandas_str_series_max_length", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_values); __Pyx_XDECREF(__pyx_v_val); @@ -3379,7 +4693,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_len return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":172 +/* "pyreadstat/_readstat_writer.pyx":169 * * * cdef int check_series_all_same_types(object series, object type_to_check): # <<<<<<<<<<<<<< @@ -3402,19 +4716,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("check_series_all_same_types", 0); - /* "pyreadstat/_readstat_writer.pyx":177 + /* "pyreadstat/_readstat_writer.pyx":174 * """ * * values = series.values # <<<<<<<<<<<<<< * for val in values: * if type(val) != type_to_check: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_series, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_series, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_values = __pyx_t_1; __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":178 + /* "pyreadstat/_readstat_writer.pyx":175 * * values = series.values * for val in values: # <<<<<<<<<<<<<< @@ -3425,26 +4739,26 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P __pyx_t_1 = __pyx_v_values; __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_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __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, 178, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __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, 178, __pyx_L1_error) + __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, 175, __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, 178, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __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, 178, __pyx_L1_error) + __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, 175, __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, 178, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -3454,7 +4768,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 178, __pyx_L1_error) + else __PYX_ERR(0, 175, __pyx_L1_error) } break; } @@ -3463,19 +4777,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":179 + /* "pyreadstat/_readstat_writer.pyx":176 * values = series.values * for val in values: * if type(val) != type_to_check: # <<<<<<<<<<<<<< * return 0 * return 1 */ - __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_val)), __pyx_v_type_to_check, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_val)), __pyx_v_type_to_check, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":180 + /* "pyreadstat/_readstat_writer.pyx":177 * for val in values: * if type(val) != type_to_check: * return 0 # <<<<<<<<<<<<<< @@ -3486,7 +4800,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":179 + /* "pyreadstat/_readstat_writer.pyx":176 * values = series.values * for val in values: * if type(val) != type_to_check: # <<<<<<<<<<<<<< @@ -3495,7 +4809,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P */ } - /* "pyreadstat/_readstat_writer.pyx":178 + /* "pyreadstat/_readstat_writer.pyx":175 * * values = series.values * for val in values: # <<<<<<<<<<<<<< @@ -3505,7 +4819,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":181 + /* "pyreadstat/_readstat_writer.pyx":178 * if type(val) != type_to_check: * return 0 * return 1 # <<<<<<<<<<<<<< @@ -3515,7 +4829,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P __pyx_r = 1; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":172 + /* "pyreadstat/_readstat_writer.pyx":169 * * * cdef int check_series_all_same_types(object series, object type_to_check): # <<<<<<<<<<<<<< @@ -3527,8 +4841,8 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("pyreadstat._readstat_writer.check_series_all_same_types", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; + __Pyx_AddTraceback("pyreadstat._readstat_writer.check_series_all_same_types", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_values); __Pyx_XDECREF(__pyx_v_val); @@ -3536,7 +4850,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(P return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":184 +/* "pyreadstat/_readstat_writer.pyx":181 * * * cdef list get_pandas_column_types(object df, dict missing_user_values, dict variable_value_labels): # <<<<<<<<<<<<<< @@ -3581,22 +4895,23 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_RefNannySetupContext("get_pandas_column_types", 0); __Pyx_INCREF(__pyx_v_variable_value_labels); - /* "pyreadstat/_readstat_writer.pyx":194 + /* "pyreadstat/_readstat_writer.pyx":191 * cdef int max_length * * cdef list types = df.dtypes.values.tolist() # <<<<<<<<<<<<<< * cdef list columns = df.columns.values.tolist() * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tolist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tolist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { @@ -3604,33 +4919,38 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 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(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 194, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_3, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(0, 191, __pyx_L1_error) __pyx_v_types = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":195 + /* "pyreadstat/_readstat_writer.pyx":192 * * cdef list types = df.dtypes.values.tolist() * cdef list columns = df.columns.values.tolist() # <<<<<<<<<<<<<< * * cdef list result = list() */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tolist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tolist); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { @@ -3638,53 +4958,56 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 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(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 195, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_3, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(0, 192, __pyx_L1_error) __pyx_v_columns = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":197 + /* "pyreadstat/_readstat_writer.pyx":194 * cdef list columns = df.columns.values.tolist() * * cdef list result = list() # <<<<<<<<<<<<<< * cdef int equal, is_missing * if variable_value_labels is None: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":199 + /* "pyreadstat/_readstat_writer.pyx":196 * cdef list result = list() * cdef int equal, is_missing * if variable_value_labels is None: # <<<<<<<<<<<<<< * variable_value_labels = dict() * */ - __pyx_t_4 = (__pyx_v_variable_value_labels == ((PyObject*)Py_None)); - __pyx_t_5 = (__pyx_t_4 != 0); + __pyx_t_5 = (__pyx_v_variable_value_labels == ((PyObject*)Py_None)); if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":200 + /* "pyreadstat/_readstat_writer.pyx":197 * cdef int equal, is_missing * if variable_value_labels is None: * variable_value_labels = dict() # <<<<<<<<<<<<<< * * for indx, (col_name, col_type) in enumerate(zip(columns, types)): */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_variable_value_labels, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":199 + /* "pyreadstat/_readstat_writer.pyx":196 * cdef list result = list() * cdef int equal, is_missing * if variable_value_labels is None: # <<<<<<<<<<<<<< @@ -3693,7 +5016,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ } - /* "pyreadstat/_readstat_writer.pyx":202 + /* "pyreadstat/_readstat_writer.pyx":199 * variable_value_labels = dict() * * for indx, (col_name, col_type) in enumerate(zip(columns, types)): # <<<<<<<<<<<<<< @@ -3702,7 +5025,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ __Pyx_INCREF(__pyx_int_0); __pyx_t_1 = __pyx_int_0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_columns); __Pyx_GIVEREF(__pyx_v_columns); @@ -3710,16 +5033,16 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_v_types); __Pyx_GIVEREF(__pyx_v_types); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_types); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { @@ -3727,17 +5050,17 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 199, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 199, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } @@ -3747,7 +5070,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 202, __pyx_L1_error) + else __PYX_ERR(0, 199, __pyx_L1_error) } break; } @@ -3759,7 +5082,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 202, __pyx_L1_error) + __PYX_ERR(0, 199, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -3772,23 +5095,23 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __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, 202, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_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_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 202, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 199, __pyx_L1_error) __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L7_unpacking_done; @@ -3796,7 +5119,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 202, __pyx_L1_error) + __PYX_ERR(0, 199, __pyx_L1_error) __pyx_L7_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_col_name, __pyx_t_8); @@ -3805,13 +5128,13 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __pyx_t_9 = 0; __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_indx, __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(0, 202, __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, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":204 + /* "pyreadstat/_readstat_writer.pyx":201 * for indx, (col_name, col_type) in enumerate(zip(columns, types)): * * max_length = 0 # <<<<<<<<<<<<<< @@ -3820,16 +5143,16 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ __pyx_v_max_length = 0; - /* "pyreadstat/_readstat_writer.pyx":205 + /* "pyreadstat/_readstat_writer.pyx":202 * * max_length = 0 * curseries = df.iloc[:, indx] # <<<<<<<<<<<<<< * curuser_missing = None * if missing_user_values: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_iloc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_iloc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); @@ -3837,14 +5160,14 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_v_indx); __Pyx_GIVEREF(__pyx_v_indx); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_indx); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF_SET(__pyx_v_curseries, __pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":206 + /* "pyreadstat/_readstat_writer.pyx":203 * max_length = 0 * curseries = df.iloc[:, indx] * curuser_missing = None # <<<<<<<<<<<<<< @@ -3854,17 +5177,17 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(Py_None); __Pyx_XDECREF_SET(__pyx_v_curuser_missing, Py_None); - /* "pyreadstat/_readstat_writer.pyx":207 + /* "pyreadstat/_readstat_writer.pyx":204 * curseries = df.iloc[:, indx] * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< * curuser_missing = missing_user_values.get(col_name) * */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 204, __pyx_L1_error) if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":208 + /* "pyreadstat/_readstat_writer.pyx":205 * curuser_missing = None * if missing_user_values: * curuser_missing = missing_user_values.get(col_name) # <<<<<<<<<<<<<< @@ -3873,14 +5196,14 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ if (unlikely(__pyx_v_missing_user_values == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 208, __pyx_L1_error) + __PYX_ERR(0, 205, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF_SET(__pyx_v_curuser_missing, __pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":207 + /* "pyreadstat/_readstat_writer.pyx":204 * curseries = df.iloc[:, indx] * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< @@ -3889,45 +5212,45 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ } - /* "pyreadstat/_readstat_writer.pyx":211 + /* "pyreadstat/_readstat_writer.pyx":208 * * # recover original type for categories * if type(col_type) is pd.core.dtypes.dtypes.CategoricalDtype: # <<<<<<<<<<<<<< * col_type = np.asarray(curseries).dtype * if col_type in int_types: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_core); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_core); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dtypes); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_CategoricalDtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_CategoricalDtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_col_type)) == __pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":212 + /* "pyreadstat/_readstat_writer.pyx":209 * # recover original type for categories * if type(col_type) is pd.core.dtypes.dtypes.CategoricalDtype: * col_type = np.asarray(curseries).dtype # <<<<<<<<<<<<<< * if col_type in int_types: * result.append((PYWRITER_INTEGER, 0,0)) */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_9)) { @@ -3935,20 +5258,24 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; } } - __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_v_curseries) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_curseries); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_curseries}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 209, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_col_type, __pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":211 + /* "pyreadstat/_readstat_writer.pyx":208 * * # recover original type for categories * if type(col_type) is pd.core.dtypes.dtypes.CategoricalDtype: # <<<<<<<<<<<<<< @@ -3957,7 +5284,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ } - /* "pyreadstat/_readstat_writer.pyx":213 + /* "pyreadstat/_readstat_writer.pyx":210 * if type(col_type) is pd.core.dtypes.dtypes.CategoricalDtype: * col_type = np.asarray(curseries).dtype * if col_type in int_types: # <<<<<<<<<<<<<< @@ -3966,22 +5293,21 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_int_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 213, __pyx_L1_error) + __PYX_ERR(0, 210, __pyx_L1_error) } - __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 213, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); + __pyx_t_5 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 210, __pyx_L1_error) if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":214 + /* "pyreadstat/_readstat_writer.pyx":211 * col_type = np.asarray(curseries).dtype * if col_type in int_types: * result.append((PYWRITER_INTEGER, 0,0)) # <<<<<<<<<<<<<< * elif col_type in float_types: * if np.any(pd.isna(curseries)): */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); @@ -3992,10 +5318,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_0); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 214, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":213 + /* "pyreadstat/_readstat_writer.pyx":210 * if type(col_type) is pd.core.dtypes.dtypes.CategoricalDtype: * col_type = np.asarray(curseries).dtype * if col_type in int_types: # <<<<<<<<<<<<<< @@ -4005,7 +5331,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L10; } - /* "pyreadstat/_readstat_writer.pyx":215 + /* "pyreadstat/_readstat_writer.pyx":212 * if col_type in int_types: * result.append((PYWRITER_INTEGER, 0,0)) * elif col_type in float_types: # <<<<<<<<<<<<<< @@ -4014,30 +5340,30 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_float_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 215, __pyx_L1_error) + __PYX_ERR(0, 212, __pyx_L1_error) } - __pyx_t_5 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_float_types, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 215, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { + __pyx_t_5 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_float_types, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 212, __pyx_L1_error) + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":216 + /* "pyreadstat/_readstat_writer.pyx":213 * result.append((PYWRITER_INTEGER, 0,0)) * elif col_type in float_types: * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< * result.append((PYWRITER_DOUBLE, 0, 1)) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_any); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_any); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_isna); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_isna); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_10)) { @@ -4045,14 +5371,19 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_4 = 1; } } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_10, __pyx_v_curseries) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_curseries); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_curseries}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } __pyx_t_13 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_13)) { @@ -4060,28 +5391,32 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_8 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 216, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_3}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 213, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":217 + /* "pyreadstat/_readstat_writer.pyx":214 * elif col_type in float_types: * if np.any(pd.isna(curseries)): * result.append((PYWRITER_DOUBLE, 0, 1)) # <<<<<<<<<<<<<< * else: * result.append((PYWRITER_DOUBLE, 0, 0)) */ - __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); @@ -4092,10 +5427,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_1); __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":216 + /* "pyreadstat/_readstat_writer.pyx":213 * result.append((PYWRITER_INTEGER, 0,0)) * elif col_type in float_types: * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< @@ -4105,7 +5440,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L11; } - /* "pyreadstat/_readstat_writer.pyx":219 + /* "pyreadstat/_readstat_writer.pyx":216 * result.append((PYWRITER_DOUBLE, 0, 1)) * else: * result.append((PYWRITER_DOUBLE, 0, 0)) # <<<<<<<<<<<<<< @@ -4113,9 +5448,9 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * result.append((PYWRITER_LOGICAL, 0,0)) */ /*else*/ { - __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); @@ -4126,12 +5461,12 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_0); __pyx_t_9 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 219, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_L11:; - /* "pyreadstat/_readstat_writer.pyx":215 + /* "pyreadstat/_readstat_writer.pyx":212 * if col_type in int_types: * result.append((PYWRITER_INTEGER, 0,0)) * elif col_type in float_types: # <<<<<<<<<<<<<< @@ -4141,28 +5476,28 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L10; } - /* "pyreadstat/_readstat_writer.pyx":220 + /* "pyreadstat/_readstat_writer.pyx":217 * else: * result.append((PYWRITER_DOUBLE, 0, 0)) * elif col_type == bool: # <<<<<<<<<<<<<< * result.append((PYWRITER_LOGICAL, 0,0)) * # np.datetime64[ns] */ - __pyx_t_8 = PyObject_RichCompare(__pyx_v_col_type, ((PyObject*)&PyBool_Type), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_8 = PyObject_RichCompare(__pyx_v_col_type, ((PyObject*)&PyBool_Type), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":221 + /* "pyreadstat/_readstat_writer.pyx":218 * result.append((PYWRITER_DOUBLE, 0, 0)) * elif col_type == bool: * result.append((PYWRITER_LOGICAL, 0,0)) # <<<<<<<<<<<<<< * # np.datetime64[ns] * elif is_datetime64_ns_dtype(df[col_name]): */ - __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); @@ -4173,10 +5508,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_0); __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":220 + /* "pyreadstat/_readstat_writer.pyx":217 * else: * result.append((PYWRITER_DOUBLE, 0, 0)) * elif col_type == bool: # <<<<<<<<<<<<<< @@ -4186,18 +5521,19 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L10; } - /* "pyreadstat/_readstat_writer.pyx":223 + /* "pyreadstat/_readstat_writer.pyx":220 * result.append((PYWRITER_LOGICAL, 0,0)) * # np.datetime64[ns] * elif is_datetime64_ns_dtype(df[col_name]): # <<<<<<<<<<<<<< * if np.any(pd.isna(curseries)): * result.append((PYWRITER_DATETIME64, 0,1)) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_is_datetime64_ns_dtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_is_datetime64_ns_dtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_df, __pyx_v_col_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_df, __pyx_v_col_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_13 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_13)) { @@ -4205,36 +5541,41 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_4 = 1; } } - __pyx_t_9 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 223, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_3}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":224 + /* "pyreadstat/_readstat_writer.pyx":221 * # np.datetime64[ns] * elif is_datetime64_ns_dtype(df[col_name]): * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< * result.append((PYWRITER_DATETIME64, 0,1)) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_any); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_any); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pd); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pd); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_isna); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_isna); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = NULL; + __pyx_t_4 = 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)) { @@ -4242,14 +5583,19 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_4 = 1; } } - __pyx_t_8 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_13, __pyx_v_curseries) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_curseries); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_curseries}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } __pyx_t_10 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_10)) { @@ -4257,28 +5603,32 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; } } - __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 224, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_8}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":225 + /* "pyreadstat/_readstat_writer.pyx":222 * elif is_datetime64_ns_dtype(df[col_name]): * if np.any(pd.isna(curseries)): * result.append((PYWRITER_DATETIME64, 0,1)) # <<<<<<<<<<<<<< * else: * result.append((PYWRITER_DATETIME64, 0,0)) */ - __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); @@ -4289,10 +5639,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_1); __pyx_t_9 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 225, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":224 + /* "pyreadstat/_readstat_writer.pyx":221 * # np.datetime64[ns] * elif is_datetime64_ns_dtype(df[col_name]): * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< @@ -4302,7 +5652,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L12; } - /* "pyreadstat/_readstat_writer.pyx":227 + /* "pyreadstat/_readstat_writer.pyx":224 * result.append((PYWRITER_DATETIME64, 0,1)) * else: * result.append((PYWRITER_DATETIME64, 0,0)) # <<<<<<<<<<<<<< @@ -4310,9 +5660,9 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * if np.any(pd.isna(curseries)): */ /*else*/ { - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); @@ -4323,12 +5673,12 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_0); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __pyx_L12:; - /* "pyreadstat/_readstat_writer.pyx":223 + /* "pyreadstat/_readstat_writer.pyx":220 * result.append((PYWRITER_LOGICAL, 0,0)) * # np.datetime64[ns] * elif is_datetime64_ns_dtype(df[col_name]): # <<<<<<<<<<<<<< @@ -4338,19 +5688,20 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L10; } - /* "pyreadstat/_readstat_writer.pyx":228 + /* "pyreadstat/_readstat_writer.pyx":225 * else: * result.append((PYWRITER_DATETIME64, 0,0)) * elif col_type == np.dtype('tp_name), 0))) __PYX_ERR(0, 252, __pyx_L1_error) - __pyx_v_max_length = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_9, ((PyObject*)__pyx_t_3)); + if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_3))) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_9, ((PyObject*)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_max_length = __pyx_t_4; - /* "pyreadstat/_readstat_writer.pyx":253 + /* "pyreadstat/_readstat_writer.pyx":250 * if not equal: * max_length = get_pandas_str_series_max_length(col.astype(str), variable_value_labels.get(col_name)) * result.append((PYWRITER_OBJECT, max_length, 1)) # <<<<<<<<<<<<<< * continue * else: */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); @@ -4940,10 +6334,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_1); __pyx_t_3 = 0; __pyx_t_9 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":254 + /* "pyreadstat/_readstat_writer.pyx":251 * max_length = get_pandas_str_series_max_length(col.astype(str), variable_value_labels.get(col_name)) * result.append((PYWRITER_OBJECT, max_length, 1)) * continue # <<<<<<<<<<<<<< @@ -4952,7 +6346,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ goto __pyx_L4_continue; - /* "pyreadstat/_readstat_writer.pyx":251 + /* "pyreadstat/_readstat_writer.pyx":248 * #equal = col.apply(lambda x: type(x) == curtype) * #if not np.all(equal): * if not equal: # <<<<<<<<<<<<<< @@ -4961,7 +6355,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ } - /* "pyreadstat/_readstat_writer.pyx":246 + /* "pyreadstat/_readstat_writer.pyx":243 * col = curseries.dropna().reset_index(drop=True) * is_missing = 1 * if len(col): # <<<<<<<<<<<<<< @@ -4971,7 +6365,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L24; } - /* "pyreadstat/_readstat_writer.pyx":256 + /* "pyreadstat/_readstat_writer.pyx":253 * continue * else: * if curuser_missing: # <<<<<<<<<<<<<< @@ -4979,19 +6373,19 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * else: */ /*else*/ { - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_curuser_missing); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_curuser_missing); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 253, __pyx_L1_error) if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":257 + /* "pyreadstat/_readstat_writer.pyx":254 * else: * if curuser_missing: * result.append((PYWRITER_DOUBLE, 0, 1)) # <<<<<<<<<<<<<< * else: * result.append((PYWRITER_LOGICAL, 0, 1)) */ - __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); @@ -5002,10 +6396,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_1); __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":256 + /* "pyreadstat/_readstat_writer.pyx":253 * continue * else: * if curuser_missing: # <<<<<<<<<<<<<< @@ -5015,7 +6409,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L26; } - /* "pyreadstat/_readstat_writer.pyx":259 + /* "pyreadstat/_readstat_writer.pyx":256 * result.append((PYWRITER_DOUBLE, 0, 1)) * else: * result.append((PYWRITER_LOGICAL, 0, 1)) # <<<<<<<<<<<<<< @@ -5023,9 +6417,9 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * else: */ /*else*/ { - __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); @@ -5036,12 +6430,12 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_1); __pyx_t_9 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 259, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_L26:; - /* "pyreadstat/_readstat_writer.pyx":260 + /* "pyreadstat/_readstat_writer.pyx":257 * else: * result.append((PYWRITER_LOGICAL, 0, 1)) * continue # <<<<<<<<<<<<<< @@ -5052,7 +6446,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types } __pyx_L24:; - /* "pyreadstat/_readstat_writer.pyx":240 + /* "pyreadstat/_readstat_writer.pyx":237 * result.append((PYWRITER_DOUBLE, 0, 1)) * continue * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< @@ -5062,7 +6456,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L22; } - /* "pyreadstat/_readstat_writer.pyx":262 + /* "pyreadstat/_readstat_writer.pyx":259 * continue * else: * if col_type in int_mixed_types: # <<<<<<<<<<<<<< @@ -5072,22 +6466,21 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types /*else*/ { if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 262, __pyx_L1_error) + __PYX_ERR(0, 259, __pyx_L1_error) } - __pyx_t_5 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 262, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { + __pyx_t_5 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 259, __pyx_L1_error) + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":263 + /* "pyreadstat/_readstat_writer.pyx":260 * else: * if col_type in int_mixed_types: * result.append((PYWRITER_INTEGER, 0, 0)) # <<<<<<<<<<<<<< * continue * curtype = type(curseries.iloc[0]) */ - __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); @@ -5098,10 +6491,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_0); __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":264 + /* "pyreadstat/_readstat_writer.pyx":261 * if col_type in int_mixed_types: * result.append((PYWRITER_INTEGER, 0, 0)) * continue # <<<<<<<<<<<<<< @@ -5110,7 +6503,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ goto __pyx_L4_continue; - /* "pyreadstat/_readstat_writer.pyx":262 + /* "pyreadstat/_readstat_writer.pyx":259 * continue * else: * if col_type in int_mixed_types: # <<<<<<<<<<<<<< @@ -5119,51 +6512,53 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ } - /* "pyreadstat/_readstat_writer.pyx":265 + /* "pyreadstat/_readstat_writer.pyx":262 * result.append((PYWRITER_INTEGER, 0, 0)) * continue * curtype = type(curseries.iloc[0]) # <<<<<<<<<<<<<< * equal = check_series_all_same_types(curseries, curtype) * #equal = curseries.apply(lambda x: type(x) == curtype) */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_iloc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 265, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_iloc); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 265, __pyx_L1_error) + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_8))); __Pyx_XDECREF_SET(__pyx_v_curtype, ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_t_8)))); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":266 + /* "pyreadstat/_readstat_writer.pyx":263 * continue * curtype = type(curseries.iloc[0]) * equal = check_series_all_same_types(curseries, curtype) # <<<<<<<<<<<<<< * #equal = curseries.apply(lambda x: type(x) == curtype) * #if not np.all(equal): */ - __pyx_v_equal = __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(__pyx_v_curseries, ((PyObject *)__pyx_v_curtype)); + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_check_series_all_same_types(__pyx_v_curseries, ((PyObject *)__pyx_v_curtype)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_v_equal = __pyx_t_4; - /* "pyreadstat/_readstat_writer.pyx":269 + /* "pyreadstat/_readstat_writer.pyx":266 * #equal = curseries.apply(lambda x: type(x) == curtype) * #if not np.all(equal): * if not equal: # <<<<<<<<<<<<<< * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) * result.append((PYWRITER_OBJECT, max_length, 0)) */ - __pyx_t_4 = ((!(__pyx_v_equal != 0)) != 0); - if (__pyx_t_4) { + __pyx_t_5 = (!(__pyx_v_equal != 0)); + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":270 + /* "pyreadstat/_readstat_writer.pyx":267 * #if not np.all(equal): * if not equal: * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) # <<<<<<<<<<<<<< * result.append((PYWRITER_OBJECT, max_length, 0)) * continue */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 270, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_3 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_3)) { @@ -5171,36 +6566,41 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, ((PyObject *)(&PyString_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_9, ((PyObject *)(&PyString_Type))); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 270, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)(&PyString_Type))}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 270, __pyx_L1_error) + __PYX_ERR(0, 267, __pyx_L1_error) } - __pyx_t_9 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 270, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (!(likely(PyDict_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 270, __pyx_L1_error) - __pyx_v_max_length = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_8, ((PyObject*)__pyx_t_9)); + if (!(likely(PyDict_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_9))) __PYX_ERR(0, 267, __pyx_L1_error) + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_8, ((PyObject*)__pyx_t_9)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_max_length = __pyx_t_4; - /* "pyreadstat/_readstat_writer.pyx":271 + /* "pyreadstat/_readstat_writer.pyx":268 * if not equal: * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) * result.append((PYWRITER_OBJECT, max_length, 0)) # <<<<<<<<<<<<<< * continue * if curtype in int_types: */ - __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); @@ -5211,10 +6611,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_0); __pyx_t_9 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 271, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":272 + /* "pyreadstat/_readstat_writer.pyx":269 * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) * result.append((PYWRITER_OBJECT, max_length, 0)) * continue # <<<<<<<<<<<<<< @@ -5223,7 +6623,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ goto __pyx_L4_continue; - /* "pyreadstat/_readstat_writer.pyx":269 + /* "pyreadstat/_readstat_writer.pyx":266 * #equal = curseries.apply(lambda x: type(x) == curtype) * #if not np.all(equal): * if not equal: # <<<<<<<<<<<<<< @@ -5234,7 +6634,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types } __pyx_L22:; - /* "pyreadstat/_readstat_writer.pyx":273 + /* "pyreadstat/_readstat_writer.pyx":270 * result.append((PYWRITER_OBJECT, max_length, 0)) * continue * if curtype in int_types: # <<<<<<<<<<<<<< @@ -5243,24 +6643,23 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_int_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 273, __pyx_L1_error) + __PYX_ERR(0, 270, __pyx_L1_error) } - __pyx_t_4 = (__Pyx_PySet_ContainsTF(((PyObject *)__pyx_v_curtype), __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 273, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); + __pyx_t_5 = (__Pyx_PySet_ContainsTF(((PyObject *)__pyx_v_curtype), __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 270, __pyx_L1_error) if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":274 + /* "pyreadstat/_readstat_writer.pyx":271 * continue * if curtype in int_types: * result.append((PYWRITER_INTEGER, 0, is_missing)) # <<<<<<<<<<<<<< * elif curtype in float_types: * result.append((PYWRITER_DOUBLE, 0, is_missing)) */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); @@ -5271,10 +6670,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __pyx_t_3 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 271, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":273 + /* "pyreadstat/_readstat_writer.pyx":270 * result.append((PYWRITER_OBJECT, max_length, 0)) * continue * if curtype in int_types: # <<<<<<<<<<<<<< @@ -5284,7 +6683,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L29; } - /* "pyreadstat/_readstat_writer.pyx":275 + /* "pyreadstat/_readstat_writer.pyx":272 * if curtype in int_types: * result.append((PYWRITER_INTEGER, 0, is_missing)) * elif curtype in float_types: # <<<<<<<<<<<<<< @@ -5293,24 +6692,23 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_float_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 275, __pyx_L1_error) + __PYX_ERR(0, 272, __pyx_L1_error) } - __pyx_t_5 = (__Pyx_PySet_ContainsTF(((PyObject *)__pyx_v_curtype), __pyx_v_10pyreadstat_16_readstat_writer_float_types, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 275, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_5 != 0); - if (__pyx_t_4) { + __pyx_t_5 = (__Pyx_PySet_ContainsTF(((PyObject *)__pyx_v_curtype), __pyx_v_10pyreadstat_16_readstat_writer_float_types, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 272, __pyx_L1_error) + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":276 + /* "pyreadstat/_readstat_writer.pyx":273 * result.append((PYWRITER_INTEGER, 0, is_missing)) * elif curtype in float_types: * result.append((PYWRITER_DOUBLE, 0, is_missing)) # <<<<<<<<<<<<<< * elif curtype == bool: * result.append((PYWRITER_LOGICAL, 0, is_missing)) */ - __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); @@ -5321,10 +6719,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_8); __pyx_t_9 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":275 + /* "pyreadstat/_readstat_writer.pyx":272 * if curtype in int_types: * result.append((PYWRITER_INTEGER, 0, is_missing)) * elif curtype in float_types: # <<<<<<<<<<<<<< @@ -5334,30 +6732,30 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L29; } - /* "pyreadstat/_readstat_writer.pyx":277 + /* "pyreadstat/_readstat_writer.pyx":274 * elif curtype in float_types: * result.append((PYWRITER_DOUBLE, 0, is_missing)) * elif curtype == bool: # <<<<<<<<<<<<<< * result.append((PYWRITER_LOGICAL, 0, is_missing)) * elif curtype == str: */ - __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), ((PyObject*)&PyBool_Type), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), ((PyObject*)&PyBool_Type), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":278 + /* "pyreadstat/_readstat_writer.pyx":275 * result.append((PYWRITER_DOUBLE, 0, is_missing)) * elif curtype == bool: * result.append((PYWRITER_LOGICAL, 0, is_missing)) # <<<<<<<<<<<<<< * elif curtype == str: * if is_missing: */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); @@ -5368,10 +6766,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __pyx_t_3 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":277 + /* "pyreadstat/_readstat_writer.pyx":274 * elif curtype in float_types: * result.append((PYWRITER_DOUBLE, 0, is_missing)) * elif curtype == bool: # <<<<<<<<<<<<<< @@ -5381,38 +6779,39 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L29; } - /* "pyreadstat/_readstat_writer.pyx":279 + /* "pyreadstat/_readstat_writer.pyx":276 * elif curtype == bool: * result.append((PYWRITER_LOGICAL, 0, is_missing)) * elif curtype == str: # <<<<<<<<<<<<<< * if is_missing: * col = curseries.dropna().reset_index(drop=True) */ - __pyx_t_9 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 279, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_9 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":280 + /* "pyreadstat/_readstat_writer.pyx":277 * result.append((PYWRITER_LOGICAL, 0, is_missing)) * elif curtype == str: * if is_missing: # <<<<<<<<<<<<<< * col = curseries.dropna().reset_index(drop=True) * max_length = get_pandas_str_series_max_length(col, variable_value_labels.get(col_name)) */ - __pyx_t_4 = (__pyx_v_is_missing != 0); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_is_missing != 0); + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":281 + /* "pyreadstat/_readstat_writer.pyx":278 * elif curtype == str: * if is_missing: * col = curseries.dropna().reset_index(drop=True) # <<<<<<<<<<<<<< * max_length = get_pandas_str_series_max_length(col, variable_value_labels.get(col_name)) * else: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_dropna); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_dropna); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_3)) { @@ -5420,27 +6819,31 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_4 = 1; } } - __pyx_t_9 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_reset_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 281, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_3, }; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_reset_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_drop, Py_True) < 0) __PYX_ERR(0, 281, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_drop, Py_True) < 0) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF_SET(__pyx_v_col, __pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":282 + /* "pyreadstat/_readstat_writer.pyx":279 * if is_missing: * col = curseries.dropna().reset_index(drop=True) * max_length = get_pandas_str_series_max_length(col, variable_value_labels.get(col_name)) # <<<<<<<<<<<<<< @@ -5449,15 +6852,16 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 282, __pyx_L1_error) + __PYX_ERR(0, 279, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 282, __pyx_L1_error) - __pyx_v_max_length = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_v_col, ((PyObject*)__pyx_t_3)); + if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_3))) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_v_col, ((PyObject*)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_max_length = __pyx_t_4; - /* "pyreadstat/_readstat_writer.pyx":280 + /* "pyreadstat/_readstat_writer.pyx":277 * result.append((PYWRITER_LOGICAL, 0, is_missing)) * elif curtype == str: * if is_missing: # <<<<<<<<<<<<<< @@ -5467,7 +6871,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L30; } - /* "pyreadstat/_readstat_writer.pyx":284 + /* "pyreadstat/_readstat_writer.pyx":281 * max_length = get_pandas_str_series_max_length(col, variable_value_labels.get(col_name)) * else: * max_length = get_pandas_str_series_max_length(curseries, variable_value_labels.get(col_name)) # <<<<<<<<<<<<<< @@ -5477,30 +6881,31 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types /*else*/ { if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 284, __pyx_L1_error) + __PYX_ERR(0, 281, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 284, __pyx_L1_error) - __pyx_v_max_length = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_v_curseries, ((PyObject*)__pyx_t_3)); + if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_3))) __PYX_ERR(0, 281, __pyx_L1_error) + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_v_curseries, ((PyObject*)__pyx_t_3)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_max_length = __pyx_t_4; } __pyx_L30:; - /* "pyreadstat/_readstat_writer.pyx":285 + /* "pyreadstat/_readstat_writer.pyx":282 * else: * max_length = get_pandas_str_series_max_length(curseries, variable_value_labels.get(col_name)) * result.append((PYWRITER_CHARACTER, max_length, is_missing)) # <<<<<<<<<<<<<< * elif curtype == datetime.date: * result.append((PYWRITER_DATE, 0, is_missing)) */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); @@ -5511,10 +6916,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __pyx_t_3 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/_readstat_writer.pyx":279 + /* "pyreadstat/_readstat_writer.pyx":276 * elif curtype == bool: * result.append((PYWRITER_LOGICAL, 0, is_missing)) * elif curtype == str: # <<<<<<<<<<<<<< @@ -5524,36 +6929,36 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L29; } - /* "pyreadstat/_readstat_writer.pyx":286 + /* "pyreadstat/_readstat_writer.pyx":283 * max_length = get_pandas_str_series_max_length(curseries, variable_value_labels.get(col_name)) * result.append((PYWRITER_CHARACTER, max_length, is_missing)) * elif curtype == datetime.date: # <<<<<<<<<<<<<< * result.append((PYWRITER_DATE, 0, is_missing)) * elif curtype == datetime.datetime: */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_datetime); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_datetime); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_date); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 286, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_date); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 286, __pyx_L1_error) + __pyx_t_10 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 286, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":287 + /* "pyreadstat/_readstat_writer.pyx":284 * result.append((PYWRITER_CHARACTER, max_length, is_missing)) * elif curtype == datetime.date: * result.append((PYWRITER_DATE, 0, is_missing)) # <<<<<<<<<<<<<< * elif curtype == datetime.datetime: * result.append((PYWRITER_DATETIME, 0, is_missing)) */ - __pyx_t_10 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); @@ -5564,10 +6969,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __pyx_t_10 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":286 + /* "pyreadstat/_readstat_writer.pyx":283 * max_length = get_pandas_str_series_max_length(curseries, variable_value_labels.get(col_name)) * result.append((PYWRITER_CHARACTER, max_length, is_missing)) * elif curtype == datetime.date: # <<<<<<<<<<<<<< @@ -5577,36 +6982,36 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L29; } - /* "pyreadstat/_readstat_writer.pyx":288 + /* "pyreadstat/_readstat_writer.pyx":285 * elif curtype == datetime.date: * result.append((PYWRITER_DATE, 0, is_missing)) * elif curtype == datetime.datetime: # <<<<<<<<<<<<<< * result.append((PYWRITER_DATETIME, 0, is_missing)) * elif curtype == datetime.time: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_datetime); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_datetime); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_datetime); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_datetime); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_9 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 285, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":289 + /* "pyreadstat/_readstat_writer.pyx":286 * result.append((PYWRITER_DATE, 0, is_missing)) * elif curtype == datetime.datetime: * result.append((PYWRITER_DATETIME, 0, is_missing)) # <<<<<<<<<<<<<< * elif curtype == datetime.time: * result.append((PYWRITER_TIME, 0, is_missing)) */ - __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); @@ -5617,10 +7022,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_8); __pyx_t_9 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 289, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/_readstat_writer.pyx":288 + /* "pyreadstat/_readstat_writer.pyx":285 * elif curtype == datetime.date: * result.append((PYWRITER_DATE, 0, is_missing)) * elif curtype == datetime.datetime: # <<<<<<<<<<<<<< @@ -5630,36 +7035,36 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L29; } - /* "pyreadstat/_readstat_writer.pyx":290 + /* "pyreadstat/_readstat_writer.pyx":287 * elif curtype == datetime.datetime: * result.append((PYWRITER_DATETIME, 0, is_missing)) * elif curtype == datetime.time: # <<<<<<<<<<<<<< * result.append((PYWRITER_TIME, 0, is_missing)) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_datetime); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_datetime); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_time); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_10 = PyObject_RichCompare(((PyObject *)__pyx_v_curtype), __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 290, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":291 + /* "pyreadstat/_readstat_writer.pyx":288 * result.append((PYWRITER_DATETIME, 0, is_missing)) * elif curtype == datetime.time: * result.append((PYWRITER_TIME, 0, is_missing)) # <<<<<<<<<<<<<< * else: * curseries = curseries.astype(str) */ - __pyx_t_10 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); @@ -5670,10 +7075,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __pyx_t_10 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 291, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":290 + /* "pyreadstat/_readstat_writer.pyx":287 * elif curtype == datetime.datetime: * result.append((PYWRITER_DATETIME, 0, is_missing)) * elif curtype == datetime.time: # <<<<<<<<<<<<<< @@ -5683,7 +7088,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L29; } - /* "pyreadstat/_readstat_writer.pyx":293 + /* "pyreadstat/_readstat_writer.pyx":290 * result.append((PYWRITER_TIME, 0, is_missing)) * else: * curseries = curseries.astype(str) # <<<<<<<<<<<<<< @@ -5691,9 +7096,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * col = curseries.dropna().reset_index(drop=True) */ /*else*/ { - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_10)) { @@ -5701,36 +7107,41 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_4 = 1; } } - __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, ((PyObject *)(&PyString_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)(&PyString_Type))); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, ((PyObject *)(&PyString_Type))}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 290, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_DECREF_SET(__pyx_v_curseries, __pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":294 + /* "pyreadstat/_readstat_writer.pyx":291 * else: * curseries = curseries.astype(str) * if is_missing: # <<<<<<<<<<<<<< * col = curseries.dropna().reset_index(drop=True) * max_length = get_pandas_str_series_max_length(col.astype(str), variable_value_labels.get(col_name)) */ - __pyx_t_4 = (__pyx_v_is_missing != 0); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_is_missing != 0); + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":295 + /* "pyreadstat/_readstat_writer.pyx":292 * curseries = curseries.astype(str) * if is_missing: * col = curseries.dropna().reset_index(drop=True) # <<<<<<<<<<<<<< * max_length = get_pandas_str_series_max_length(col.astype(str), variable_value_labels.get(col_name)) * else: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_dropna); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_dropna); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_10)) { @@ -5738,36 +7149,41 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_4 = 1; } } - __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_reset_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_10, }; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_reset_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_drop, Py_True) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 295, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_drop, Py_True) < 0) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF_SET(__pyx_v_col, __pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/_readstat_writer.pyx":296 + /* "pyreadstat/_readstat_writer.pyx":293 * if is_missing: * col = curseries.dropna().reset_index(drop=True) * max_length = get_pandas_str_series_max_length(col.astype(str), variable_value_labels.get(col_name)) # <<<<<<<<<<<<<< * else: * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_col, __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_col, __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_8)) { @@ -5775,25 +7191,30 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_10 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, ((PyObject *)(&PyString_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_9, ((PyObject *)(&PyString_Type))); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, ((PyObject *)(&PyString_Type))}; + __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 296, __pyx_L1_error) + __PYX_ERR(0, 293, __pyx_L1_error) } - __pyx_t_9 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - if (!(likely(PyDict_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 296, __pyx_L1_error) - __pyx_v_max_length = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_10, ((PyObject*)__pyx_t_9)); + if (!(likely(PyDict_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_9))) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_10, ((PyObject*)__pyx_t_9)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_max_length = __pyx_t_4; - /* "pyreadstat/_readstat_writer.pyx":294 + /* "pyreadstat/_readstat_writer.pyx":291 * else: * curseries = curseries.astype(str) * if is_missing: # <<<<<<<<<<<<<< @@ -5803,7 +7224,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L31; } - /* "pyreadstat/_readstat_writer.pyx":298 + /* "pyreadstat/_readstat_writer.pyx":295 * max_length = get_pandas_str_series_max_length(col.astype(str), variable_value_labels.get(col_name)) * else: * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) # <<<<<<<<<<<<<< @@ -5811,9 +7232,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * */ /*else*/ { - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_8 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10); if (likely(__pyx_t_8)) { @@ -5821,40 +7243,45 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_4 = 1; } } - __pyx_t_9 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, ((PyObject *)(&PyString_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_10, ((PyObject *)(&PyString_Type))); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_8, ((PyObject *)(&PyString_Type))}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 298, __pyx_L1_error) + __PYX_ERR(0, 295, __pyx_L1_error) } - __pyx_t_10 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (!(likely(PyDict_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_10)->tp_name), 0))) __PYX_ERR(0, 298, __pyx_L1_error) - __pyx_v_max_length = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_9, ((PyObject*)__pyx_t_10)); + if (!(likely(PyDict_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_10))) __PYX_ERR(0, 295, __pyx_L1_error) + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_9, ((PyObject*)__pyx_t_10)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_v_max_length = __pyx_t_4; } __pyx_L31:; - /* "pyreadstat/_readstat_writer.pyx":299 + /* "pyreadstat/_readstat_writer.pyx":296 * else: * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) * result.append((PYWRITER_OBJECT, max_length, is_missing)) # <<<<<<<<<<<<<< * * else: */ - __pyx_t_10 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); @@ -5865,12 +7292,12 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 299, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L29:; - /* "pyreadstat/_readstat_writer.pyx":233 + /* "pyreadstat/_readstat_writer.pyx":230 * else: * result.append((PYWRITER_DATETIME, 0,0)) * elif col_type == object or col_type == 'string' or col_type in int_mixed_types: # <<<<<<<<<<<<<< @@ -5880,7 +7307,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L10; } - /* "pyreadstat/_readstat_writer.pyx":303 + /* "pyreadstat/_readstat_writer.pyx":300 * else: * # generic object * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) # <<<<<<<<<<<<<< @@ -5888,9 +7315,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * if np.any(pd.isna(curseries)): */ /*else*/ { - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curseries, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { @@ -5898,25 +7326,30 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_4 = 1; } } - __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, ((PyObject *)(&PyString_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)(&PyString_Type))); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, ((PyObject *)(&PyString_Type))}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 303, __pyx_L1_error) + __PYX_ERR(0, 300, __pyx_L1_error) } - __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_col_name, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 303, __pyx_L1_error) - __pyx_v_max_length = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_3, ((PyObject*)__pyx_t_8)); + if (!(likely(PyDict_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_8))) __PYX_ERR(0, 300, __pyx_L1_error) + __pyx_t_4 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_str_series_max_length(__pyx_t_3, ((PyObject*)__pyx_t_8)); if (unlikely(__pyx_t_4 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_max_length = __pyx_t_4; - /* "pyreadstat/_readstat_writer.pyx":304 + /* "pyreadstat/_readstat_writer.pyx":301 * # generic object * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) * is_missing = 0 # <<<<<<<<<<<<<< @@ -5925,24 +7358,25 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ __pyx_v_is_missing = 0; - /* "pyreadstat/_readstat_writer.pyx":305 + /* "pyreadstat/_readstat_writer.pyx":302 * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) * is_missing = 0 * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< * is_missing = 1 * result.append((PYWRITER_OBJECT, max_length, is_missing)) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_any); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 305, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_any); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_isna); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 305, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_isna); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_10)) { @@ -5950,14 +7384,19 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_4 = 1; } } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_10, __pyx_v_curseries) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_curseries); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_curseries}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } __pyx_t_13 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_13)) { @@ -5965,19 +7404,23 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_8 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 305, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_3}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":306 + /* "pyreadstat/_readstat_writer.pyx":303 * is_missing = 0 * if np.any(pd.isna(curseries)): * is_missing = 1 # <<<<<<<<<<<<<< @@ -5986,7 +7429,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ __pyx_v_is_missing = 1; - /* "pyreadstat/_readstat_writer.pyx":305 + /* "pyreadstat/_readstat_writer.pyx":302 * max_length = get_pandas_str_series_max_length(curseries.astype(str), variable_value_labels.get(col_name)) * is_missing = 0 * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< @@ -5995,20 +7438,20 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types */ } - /* "pyreadstat/_readstat_writer.pyx":307 + /* "pyreadstat/_readstat_writer.pyx":304 * if np.any(pd.isna(curseries)): * is_missing = 1 * result.append((PYWRITER_OBJECT, max_length, is_missing)) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_max_length); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_is_missing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8); @@ -6019,12 +7462,12 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_13); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_13); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __pyx_L10:; - /* "pyreadstat/_readstat_writer.pyx":202 + /* "pyreadstat/_readstat_writer.pyx":199 * variable_value_labels = dict() * * for indx, (col_name, col_type) in enumerate(zip(columns, types)): # <<<<<<<<<<<<<< @@ -6036,7 +7479,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":308 + /* "pyreadstat/_readstat_writer.pyx":305 * is_missing = 1 * result.append((PYWRITER_OBJECT, max_length, is_missing)) * return result # <<<<<<<<<<<<<< @@ -6048,7 +7491,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":184 + /* "pyreadstat/_readstat_writer.pyx":181 * * * cdef list get_pandas_column_types(object df, dict missing_user_values, dict variable_value_labels): # <<<<<<<<<<<<<< @@ -6077,14 +7520,14 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_XDECREF(__pyx_v_curseries); __Pyx_XDECREF(__pyx_v_curuser_missing); __Pyx_XDECREF(__pyx_v_col); - __Pyx_XDECREF(__pyx_v_curtype); + __Pyx_XDECREF((PyObject *)__pyx_v_curtype); __Pyx_XDECREF(__pyx_v_variable_value_labels); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":310 +/* "pyreadstat/_readstat_writer.pyx":307 * return result * * cdef readstat_label_set_t *set_value_label(readstat_writer_t *writer, dict value_labels, str labelset_name, # <<<<<<<<<<<<<< @@ -6127,7 +7570,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_value_label", 0); - /* "pyreadstat/_readstat_writer.pyx":321 + /* "pyreadstat/_readstat_writer.pyx":318 * cdef double double_val * * curtype = pandas_to_readstat_types[curpytype] # <<<<<<<<<<<<<< @@ -6136,31 +7579,31 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 321, __pyx_L1_error) + __PYX_ERR(0, 318, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curpytype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curpytype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_3 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_curtype = __pyx_t_3; - /* "pyreadstat/_readstat_writer.pyx":322 + /* "pyreadstat/_readstat_writer.pyx":319 * * curtype = pandas_to_readstat_types[curpytype] * label_set = readstat_add_label_set(writer, curtype, labelset_name.encode("utf-8")) # <<<<<<<<<<<<<< * * for value, label in value_labels.items(): */ - __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_labelset_name, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_labelset_name, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) __pyx_v_label_set = readstat_add_label_set(__pyx_v_writer, __pyx_v_curtype, __pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":324 + /* "pyreadstat/_readstat_writer.pyx":321 * label_set = readstat_add_label_set(writer, curtype, labelset_name.encode("utf-8")) * * for value, label in value_labels.items(): # <<<<<<<<<<<<<< @@ -6169,17 +7612,17 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ if (unlikely(__pyx_v_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 324, __pyx_L1_error) + __PYX_ERR(0, 321, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -6187,17 +7630,17 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 321, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 321, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -6207,7 +7650,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 324, __pyx_L1_error) + else __PYX_ERR(0, 321, __pyx_L1_error) } break; } @@ -6219,7 +7662,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 324, __pyx_L1_error) + __PYX_ERR(0, 321, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -6232,23 +7675,23 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); #else - __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; + __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 324, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 321, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L6_unpacking_done; @@ -6256,7 +7699,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 324, __pyx_L1_error) + __PYX_ERR(0, 321, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); @@ -6264,28 +7707,28 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_XDECREF_SET(__pyx_v_label, __pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":326 + /* "pyreadstat/_readstat_writer.pyx":323 * for value, label in value_labels.items(): * * if type(label) != str: # <<<<<<<<<<<<<< * msg = "variable_value_labels: type of Label %s in variable %s must be string" % (str(label), variable_name) * raise PyreadstatError(msg) */ - __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_label)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error) - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_label)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":327 + /* "pyreadstat/_readstat_writer.pyx":324 * * if type(label) != str: * msg = "variable_value_labels: type of Label %s in variable %s must be string" % (str(label), variable_name) # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_v_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); @@ -6293,22 +7736,23 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_GIVEREF(__pyx_v_variable_name); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_variable_name); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_La, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_La, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_msg = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":328 + /* "pyreadstat/_readstat_writer.pyx":325 * if type(label) != str: * msg = "variable_value_labels: type of Label %s in variable %s must be string" % (str(label), variable_name) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * if user_missing_tags and value in user_missing_tags: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6316,18 +7760,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 328, __pyx_L1_error) + __PYX_ERR(0, 325, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":326 + /* "pyreadstat/_readstat_writer.pyx":323 * for value, label in value_labels.items(): * * if type(label) != str: # <<<<<<<<<<<<<< @@ -6336,26 +7784,25 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":330 + /* "pyreadstat/_readstat_writer.pyx":327 * raise PyreadstatError(msg) * * if user_missing_tags and value in user_missing_tags: # <<<<<<<<<<<<<< * if curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: * msg = "missing_user_values not allowed for character variable %s" % variable_name */ - __pyx_t_12 = (__pyx_v_user_missing_tags != Py_None)&&(PyList_GET_SIZE(__pyx_v_user_missing_tags) != 0); - if (__pyx_t_12) { + __pyx_t_13 = (__pyx_v_user_missing_tags != Py_None)&&(PyList_GET_SIZE(__pyx_v_user_missing_tags) != 0); + if (__pyx_t_13) { } else { - __pyx_t_11 = __pyx_t_12; + __pyx_t_11 = __pyx_t_13; goto __pyx_L9_bool_binop_done; } - __pyx_t_12 = (__Pyx_PySequence_ContainsTF(__pyx_v_value, __pyx_v_user_missing_tags, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 330, __pyx_L1_error) - __pyx_t_13 = (__pyx_t_12 != 0); + __pyx_t_13 = (__Pyx_PySequence_ContainsTF(__pyx_v_value, __pyx_v_user_missing_tags, Py_EQ)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 327, __pyx_L1_error) __pyx_t_11 = __pyx_t_13; __pyx_L9_bool_binop_done:; if (__pyx_t_11) { - /* "pyreadstat/_readstat_writer.pyx":331 + /* "pyreadstat/_readstat_writer.pyx":328 * * if user_missing_tags and value in user_missing_tags: * if curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -6366,28 +7813,29 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER: case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT: - /* "pyreadstat/_readstat_writer.pyx":332 + /* "pyreadstat/_readstat_writer.pyx":329 * if user_missing_tags and value in user_missing_tags: * if curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: * msg = "missing_user_values not allowed for character variable %s" % variable_name # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * */ - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_missing_user_values_not_allowed, __pyx_v_variable_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_missing_user_values_not_allowed, __pyx_v_variable_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_msg = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":333 + /* "pyreadstat/_readstat_writer.pyx":330 * if curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: * msg = "missing_user_values not allowed for character variable %s" % variable_name * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * readstat_label_tagged_value(label_set, ord(value), label.encode("utf-8")) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6395,18 +7843,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 333, __pyx_L1_error) + __PYX_ERR(0, 330, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":331 + /* "pyreadstat/_readstat_writer.pyx":328 * * if user_missing_tags and value in user_missing_tags: * if curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -6417,17 +7869,18 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l default: break; } - /* "pyreadstat/_readstat_writer.pyx":335 + /* "pyreadstat/_readstat_writer.pyx":332 * raise PyreadstatError(msg) * * readstat_label_tagged_value(label_set, ord(value), label.encode("utf-8")) # <<<<<<<<<<<<<< * continue * */ - __pyx_t_14 = __Pyx_PyObject_Ord(__pyx_v_value); if (unlikely(__pyx_t_14 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 335, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 335, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_Ord(__pyx_v_value); if (unlikely(__pyx_t_14 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 332, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6435,18 +7888,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 335, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_utf_8}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L1_error) readstat_label_tagged_value(__pyx_v_label_set, __pyx_t_14, __pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":336 + /* "pyreadstat/_readstat_writer.pyx":333 * * readstat_label_tagged_value(label_set, ord(value), label.encode("utf-8")) * continue # <<<<<<<<<<<<<< @@ -6455,7 +7912,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ goto __pyx_L3_continue; - /* "pyreadstat/_readstat_writer.pyx":330 + /* "pyreadstat/_readstat_writer.pyx":327 * raise PyreadstatError(msg) * * if user_missing_tags and value in user_missing_tags: # <<<<<<<<<<<<<< @@ -6464,7 +7921,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":339 + /* "pyreadstat/_readstat_writer.pyx":336 * * * if curpytype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< @@ -6474,7 +7931,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l switch (__pyx_v_curpytype) { case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE: - /* "pyreadstat/_readstat_writer.pyx":340 + /* "pyreadstat/_readstat_writer.pyx":337 * * if curpytype == PYWRITER_DOUBLE: * if type(value) not in numeric_types: # <<<<<<<<<<<<<< @@ -6483,22 +7940,21 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 340, __pyx_L1_error) + __PYX_ERR(0, 337, __pyx_L1_error) } - __pyx_t_11 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_NE)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 340, __pyx_L1_error) - __pyx_t_13 = (__pyx_t_11 != 0); - if (unlikely(__pyx_t_13)) { + __pyx_t_11 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 337, __pyx_L1_error) + if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":341 + /* "pyreadstat/_readstat_writer.pyx":338 * if curpytype == PYWRITER_DOUBLE: * if type(value) not in numeric_types: * msg = "variable_value_labels: type of Value %s in variable %s must be numeric" % (str(value), variable_name) # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * readstat_label_double_value(label_set, value, label.encode("utf-8")) */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); @@ -6506,22 +7962,23 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_GIVEREF(__pyx_v_variable_name); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_variable_name); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_msg = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":342 + /* "pyreadstat/_readstat_writer.pyx":339 * if type(value) not in numeric_types: * msg = "variable_value_labels: type of Value %s in variable %s must be numeric" % (str(value), variable_name) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * readstat_label_double_value(label_set, value, label.encode("utf-8")) * */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6529,18 +7986,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 342, __pyx_L1_error) + __PYX_ERR(0, 339, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":340 + /* "pyreadstat/_readstat_writer.pyx":337 * * if curpytype == PYWRITER_DOUBLE: * if type(value) not in numeric_types: # <<<<<<<<<<<<<< @@ -6549,17 +8010,18 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":343 + /* "pyreadstat/_readstat_writer.pyx":340 * msg = "variable_value_labels: type of Value %s in variable %s must be numeric" % (str(value), variable_name) * raise PyreadstatError(msg) * readstat_label_double_value(label_set, value, label.encode("utf-8")) # <<<<<<<<<<<<<< * * elif curpytype == PYWRITER_INTEGER: */ - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6567,18 +8029,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 343, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_utf_8}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 340, __pyx_L1_error) readstat_label_double_value(__pyx_v_label_set, __pyx_t_16, __pyx_t_17); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":339 + /* "pyreadstat/_readstat_writer.pyx":336 * * * if curpytype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< @@ -6588,7 +8054,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER: - /* "pyreadstat/_readstat_writer.pyx":346 + /* "pyreadstat/_readstat_writer.pyx":343 * * elif curpytype == PYWRITER_INTEGER: * if type(value) not in int_types: # <<<<<<<<<<<<<< @@ -6597,22 +8063,21 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_int_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 346, __pyx_L1_error) + __PYX_ERR(0, 343, __pyx_L1_error) } - __pyx_t_13 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_NE)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 346, __pyx_L1_error) - __pyx_t_11 = (__pyx_t_13 != 0); + __pyx_t_11 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 343, __pyx_L1_error) if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":347 + /* "pyreadstat/_readstat_writer.pyx":344 * elif curpytype == PYWRITER_INTEGER: * if type(value) not in int_types: * msg = "variable_value_labels: type of Value %s in variable %s must be int" % (str(value), variable_name) # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * readstat_label_int32_value(label_set, value, label.encode("utf-8")) */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); @@ -6620,22 +8085,23 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_GIVEREF(__pyx_v_variable_name); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_variable_name); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va_2, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va_2, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_msg = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":348 + /* "pyreadstat/_readstat_writer.pyx":345 * if type(value) not in int_types: * msg = "variable_value_labels: type of Value %s in variable %s must be int" % (str(value), variable_name) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * readstat_label_int32_value(label_set, value, label.encode("utf-8")) * */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6643,18 +8109,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 348, __pyx_L1_error) + __PYX_ERR(0, 345, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":346 + /* "pyreadstat/_readstat_writer.pyx":343 * * elif curpytype == PYWRITER_INTEGER: * if type(value) not in int_types: # <<<<<<<<<<<<<< @@ -6663,17 +8133,18 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":349 + /* "pyreadstat/_readstat_writer.pyx":346 * msg = "variable_value_labels: type of Value %s in variable %s must be int" % (str(value), variable_name) * raise PyreadstatError(msg) * readstat_label_int32_value(label_set, value, label.encode("utf-8")) # <<<<<<<<<<<<<< * * elif curpytype == PYWRITER_LOGICAL: */ - __pyx_t_18 = __Pyx_PyInt_As_int32_t(__pyx_v_value); if (unlikely((__pyx_t_18 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyInt_As_int32_t(__pyx_v_value); if (unlikely((__pyx_t_18 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6681,18 +8152,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_utf_8}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error) readstat_label_int32_value(__pyx_v_label_set, __pyx_t_18, __pyx_t_19); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":345 + /* "pyreadstat/_readstat_writer.pyx":342 * readstat_label_double_value(label_set, value, label.encode("utf-8")) * * elif curpytype == PYWRITER_INTEGER: # <<<<<<<<<<<<<< @@ -6702,48 +8177,42 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL: - /* "pyreadstat/_readstat_writer.pyx":352 + /* "pyreadstat/_readstat_writer.pyx":349 * * elif curpytype == PYWRITER_LOGICAL: * if type(value) != bool and (value != 0 and value != 1): # <<<<<<<<<<<<<< * msg = "variable_value_labels: type of Value %s in variable %s must be boolean or be 1 or 0" % (str(value), variable_name) * raise PyreadstatError(msg) */ - __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_value)), ((PyObject*)&PyBool_Type), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 352, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_value)), ((PyObject*)&PyBool_Type), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_13) { } else { __pyx_t_11 = __pyx_t_13; goto __pyx_L14_bool_binop_done; } - __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_v_value, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_13 = (__Pyx_PyInt_BoolNeObjC(__pyx_v_value, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 349, __pyx_L1_error) if (__pyx_t_13) { } else { __pyx_t_11 = __pyx_t_13; goto __pyx_L14_bool_binop_done; } - __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_v_value, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 352, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_13 = (__Pyx_PyInt_BoolNeObjC(__pyx_v_value, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 349, __pyx_L1_error) __pyx_t_11 = __pyx_t_13; __pyx_L14_bool_binop_done:; if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":353 + /* "pyreadstat/_readstat_writer.pyx":350 * elif curpytype == PYWRITER_LOGICAL: * if type(value) != bool and (value != 0 and value != 1): * msg = "variable_value_labels: type of Value %s in variable %s must be boolean or be 1 or 0" % (str(value), variable_name) # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * readstat_label_int32_value(label_set, int(value), label.encode("utf-8")) */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); @@ -6751,22 +8220,23 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_GIVEREF(__pyx_v_variable_name); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_variable_name); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va_3, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va_3, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_msg = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":354 + /* "pyreadstat/_readstat_writer.pyx":351 * if type(value) != bool and (value != 0 and value != 1): * msg = "variable_value_labels: type of Value %s in variable %s must be boolean or be 1 or 0" % (str(value), variable_name) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * readstat_label_int32_value(label_set, int(value), label.encode("utf-8")) * */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6774,18 +8244,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 354, __pyx_L1_error) + __PYX_ERR(0, 351, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":352 + /* "pyreadstat/_readstat_writer.pyx":349 * * elif curpytype == PYWRITER_LOGICAL: * if type(value) != bool and (value != 0 and value != 1): # <<<<<<<<<<<<<< @@ -6794,20 +8268,21 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":355 + /* "pyreadstat/_readstat_writer.pyx":352 * msg = "variable_value_labels: type of Value %s in variable %s must be boolean or be 1 or 0" % (str(value), variable_name) * raise PyreadstatError(msg) * readstat_label_int32_value(label_set, int(value), label.encode("utf-8")) # <<<<<<<<<<<<<< * * elif curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: */ - __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_18 = __Pyx_PyInt_As_int32_t(__pyx_t_2); if (unlikely((__pyx_t_18 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyInt_As_int32_t(__pyx_t_2); if (unlikely((__pyx_t_18 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 355, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6815,18 +8290,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_utf_8}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) readstat_label_int32_value(__pyx_v_label_set, __pyx_t_18, __pyx_t_19); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":351 + /* "pyreadstat/_readstat_writer.pyx":348 * readstat_label_int32_value(label_set, value, label.encode("utf-8")) * * elif curpytype == PYWRITER_LOGICAL: # <<<<<<<<<<<<<< @@ -6836,7 +8315,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER: - /* "pyreadstat/_readstat_writer.pyx":357 + /* "pyreadstat/_readstat_writer.pyx":354 * readstat_label_int32_value(label_set, int(value), label.encode("utf-8")) * * elif curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -6845,28 +8324,29 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT: - /* "pyreadstat/_readstat_writer.pyx":358 + /* "pyreadstat/_readstat_writer.pyx":355 * * elif curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: * value = str(value) # <<<<<<<<<<<<<< * readstat_label_string_value(label_set, value.encode("utf-8"), label.encode("utf-8")) * */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":359 + /* "pyreadstat/_readstat_writer.pyx":356 * elif curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: * value = str(value) * readstat_label_string_value(label_set, value.encode("utf-8"), label.encode("utf-8")) # <<<<<<<<<<<<<< * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64): */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { @@ -6874,17 +8354,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_20 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_20) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 359, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_utf_8}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_t_20 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_20) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = NULL; + __pyx_t_12 = 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)) { @@ -6892,19 +8377,23 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_12 = 1; } } - __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_21 = __Pyx_PyObject_AsString(__pyx_t_8); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_s_utf_8}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_t_21 = __Pyx_PyObject_AsString(__pyx_t_8); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error) readstat_label_string_value(__pyx_v_label_set, __pyx_t_20, __pyx_t_21); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":357 + /* "pyreadstat/_readstat_writer.pyx":354 * readstat_label_int32_value(label_set, int(value), label.encode("utf-8")) * * elif curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -6914,7 +8403,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l break; case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE: - /* "pyreadstat/_readstat_writer.pyx":361 + /* "pyreadstat/_readstat_writer.pyx":358 * readstat_label_string_value(label_set, value.encode("utf-8"), label.encode("utf-8")) * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64): # <<<<<<<<<<<<<< @@ -6925,7 +8414,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME: case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64: - /* "pyreadstat/_readstat_writer.pyx":362 + /* "pyreadstat/_readstat_writer.pyx":359 * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64): * if type(value) not in nat_types: # <<<<<<<<<<<<<< @@ -6934,22 +8423,21 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_nat_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 362, __pyx_L1_error) + __PYX_ERR(0, 359, __pyx_L1_error) } - __pyx_t_11 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_v_10pyreadstat_16_readstat_writer_nat_types, Py_NE)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 362, __pyx_L1_error) - __pyx_t_13 = (__pyx_t_11 != 0); - if (unlikely(__pyx_t_13)) { + __pyx_t_11 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_v_10pyreadstat_16_readstat_writer_nat_types, Py_NE)); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 359, __pyx_L1_error) + if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":363 + /* "pyreadstat/_readstat_writer.pyx":360 * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64): * if type(value) not in nat_types: * msg = "variable_value_labels: type of Value %s in variable %s must match the type of the column in pandas and be of type date, datetime or time" % (str(value), variable_name) # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * double_val = convert_datetimelike_to_number(file_format, curpytype, value) */ - __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Str(__pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); @@ -6957,22 +8445,23 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_GIVEREF(__pyx_v_variable_name); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_variable_name); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va_4, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 363, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_type_of_Va_4, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_msg = __pyx_t_8; __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":364 + /* "pyreadstat/_readstat_writer.pyx":361 * if type(value) not in nat_types: * msg = "variable_value_labels: type of Value %s in variable %s must match the type of the column in pandas and be of type date, datetime or time" % (str(value), variable_name) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * double_val = convert_datetimelike_to_number(file_format, curpytype, value) * readstat_label_double_value(label_set, double_val, label.encode("utf-8")) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { @@ -6980,18 +8469,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_12 = 1; } } - __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_msg}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 364, __pyx_L1_error) + __PYX_ERR(0, 361, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":362 + /* "pyreadstat/_readstat_writer.pyx":359 * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64): * if type(value) not in nat_types: # <<<<<<<<<<<<<< @@ -7000,26 +8493,27 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":365 + /* "pyreadstat/_readstat_writer.pyx":362 * msg = "variable_value_labels: type of Value %s in variable %s must match the type of the column in pandas and be of type date, datetime or time" % (str(value), variable_name) * raise PyreadstatError(msg) * double_val = convert_datetimelike_to_number(file_format, curpytype, value) # <<<<<<<<<<<<<< * readstat_label_double_value(label_set, double_val, label.encode("utf-8")) * */ - __pyx_t_16 = __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_number(__pyx_v_file_format, __pyx_v_curpytype, __pyx_v_value); if (unlikely(__pyx_t_16 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_t_16 = __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_number(__pyx_v_file_format, __pyx_v_curpytype, __pyx_v_value); if (unlikely(__pyx_t_16 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error) __pyx_v_double_val = __pyx_t_16; - /* "pyreadstat/_readstat_writer.pyx":366 + /* "pyreadstat/_readstat_writer.pyx":363 * raise PyreadstatError(msg) * double_val = convert_datetimelike_to_number(file_format, curpytype, value) * readstat_label_double_value(label_set, double_val, label.encode("utf-8")) # <<<<<<<<<<<<<< * * return label_set */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; + __pyx_t_12 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { @@ -7027,18 +8521,22 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_12 = 1; } } - __pyx_t_8 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_8); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 366, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_kp_s_utf_8}; + __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_8); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 363, __pyx_L1_error) readstat_label_double_value(__pyx_v_label_set, __pyx_v_double_val, __pyx_t_17); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":361 + /* "pyreadstat/_readstat_writer.pyx":358 * readstat_label_string_value(label_set, value.encode("utf-8"), label.encode("utf-8")) * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64): # <<<<<<<<<<<<<< @@ -7049,7 +8547,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l default: break; } - /* "pyreadstat/_readstat_writer.pyx":324 + /* "pyreadstat/_readstat_writer.pyx":321 * label_set = readstat_add_label_set(writer, curtype, labelset_name.encode("utf-8")) * * for value, label in value_labels.items(): # <<<<<<<<<<<<<< @@ -7060,7 +8558,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":368 + /* "pyreadstat/_readstat_writer.pyx":365 * readstat_label_double_value(label_set, double_val, label.encode("utf-8")) * * return label_set # <<<<<<<<<<<<<< @@ -7070,7 +8568,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __pyx_r = __pyx_v_label_set; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":310 + /* "pyreadstat/_readstat_writer.pyx":307 * return result * * cdef readstat_label_set_t *set_value_label(readstat_writer_t *writer, dict value_labels, str labelset_name, # <<<<<<<<<<<<<< @@ -7095,7 +8593,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":370 +/* "pyreadstat/_readstat_writer.pyx":367 * return label_set * * cdef void add_missing_ranges(list cur_ranges, readstat_variable_t *variable, pywriter_variable_type vartype, str variablename) except *: # <<<<<<<<<<<<<< @@ -7116,9 +8614,9 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_7; int __pyx_t_8; double __pyx_t_9; double __pyx_t_10; @@ -7129,7 +8627,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_missing_ranges", 0); - /* "pyreadstat/_readstat_writer.pyx":376 + /* "pyreadstat/_readstat_writer.pyx":373 * """ * * cdef int range_values = 0 # <<<<<<<<<<<<<< @@ -7138,7 +8636,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_range_values = 0; - /* "pyreadstat/_readstat_writer.pyx":377 + /* "pyreadstat/_readstat_writer.pyx":374 * * cdef int range_values = 0 * cdef int discrete_values = 0 # <<<<<<<<<<<<<< @@ -7147,7 +8645,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_values = 0; - /* "pyreadstat/_readstat_writer.pyx":378 + /* "pyreadstat/_readstat_writer.pyx":375 * cdef int range_values = 0 * cdef int discrete_values = 0 * cdef int discrete_strings = 0 # <<<<<<<<<<<<<< @@ -7156,7 +8654,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_strings = 0; - /* "pyreadstat/_readstat_writer.pyx":380 + /* "pyreadstat/_readstat_writer.pyx":377 * cdef int discrete_strings = 0 * * for cur_range in cur_ranges: # <<<<<<<<<<<<<< @@ -7165,21 +8663,21 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ if (unlikely(__pyx_v_cur_ranges == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 380, __pyx_L1_error) + __PYX_ERR(0, 377, __pyx_L1_error) } __pyx_t_1 = __pyx_v_cur_ranges; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= 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_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 377, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_cur_range, __pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":381 + /* "pyreadstat/_readstat_writer.pyx":378 * * for cur_range in cur_ranges: * if isinstance(cur_range, dict): # <<<<<<<<<<<<<< @@ -7187,84 +8685,91 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject * lo = cur_range.get("lo") */ __pyx_t_4 = PyDict_Check(__pyx_v_cur_range); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":382 + /* "pyreadstat/_readstat_writer.pyx":379 * for cur_range in cur_ranges: * if isinstance(cur_range, dict): * hi = cur_range.get("hi") # <<<<<<<<<<<<<< * lo = cur_range.get("lo") * if hi is None or lo is None: */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 382, __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_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_hi) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_hi); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_hi}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_XDECREF_SET(__pyx_v_hi, __pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":383 + /* "pyreadstat/_readstat_writer.pyx":380 * if isinstance(cur_range, dict): * hi = cur_range.get("hi") * lo = cur_range.get("lo") # <<<<<<<<<<<<<< * if hi is None or lo is None: * msg = "dictionaries in missing_ranges must have the keys hi and lo" */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 383, __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_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_n_s_lo) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_n_s_lo); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_lo}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_XDECREF_SET(__pyx_v_lo, __pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":384 + /* "pyreadstat/_readstat_writer.pyx":381 * hi = cur_range.get("hi") * lo = cur_range.get("lo") * if hi is None or lo is None: # <<<<<<<<<<<<<< * msg = "dictionaries in missing_ranges must have the keys hi and lo" * raise PyreadstatError(msg) */ - __pyx_t_4 = (__pyx_v_hi == Py_None); - __pyx_t_8 = (__pyx_t_4 != 0); + __pyx_t_8 = (__pyx_v_hi == Py_None); if (!__pyx_t_8) { } else { - __pyx_t_5 = __pyx_t_8; + __pyx_t_4 = __pyx_t_8; goto __pyx_L7_bool_binop_done; } __pyx_t_8 = (__pyx_v_lo == Py_None); - __pyx_t_4 = (__pyx_t_8 != 0); - __pyx_t_5 = __pyx_t_4; + __pyx_t_4 = __pyx_t_8; __pyx_L7_bool_binop_done:; - if (unlikely(__pyx_t_5)) { + if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":385 + /* "pyreadstat/_readstat_writer.pyx":382 * lo = cur_range.get("lo") * if hi is None or lo is None: * msg = "dictionaries in missing_ranges must have the keys hi and lo" # <<<<<<<<<<<<<< @@ -7274,35 +8779,40 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_dictionaries_in_missing_ranges_m); __pyx_v_msg = __pyx_kp_s_dictionaries_in_missing_ranges_m; - /* "pyreadstat/_readstat_writer.pyx":386 + /* "pyreadstat/_readstat_writer.pyx":383 * if hi is None or lo is None: * msg = "dictionaries in missing_ranges must have the keys hi and lo" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * if type(hi) in numeric_types and type(lo) in numeric_types: * if vartype not in pywriter_numeric_types: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __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, 386, __pyx_L1_error) + __PYX_ERR(0, 383, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":384 + /* "pyreadstat/_readstat_writer.pyx":381 * hi = cur_range.get("hi") * lo = cur_range.get("lo") * if hi is None or lo is None: # <<<<<<<<<<<<<< @@ -7311,7 +8821,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":387 + /* "pyreadstat/_readstat_writer.pyx":384 * msg = "dictionaries in missing_ranges must have the keys hi and lo" * raise PyreadstatError(msg) * if type(hi) in numeric_types and type(lo) in numeric_types: # <<<<<<<<<<<<<< @@ -7320,84 +8830,86 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 387, __pyx_L1_error) + __PYX_ERR(0, 384, __pyx_L1_error) } - __pyx_t_4 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_hi)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 387, __pyx_L1_error) - __pyx_t_8 = (__pyx_t_4 != 0); + __pyx_t_8 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_hi)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 384, __pyx_L1_error) if (__pyx_t_8) { } else { - __pyx_t_5 = __pyx_t_8; + __pyx_t_4 = __pyx_t_8; goto __pyx_L10_bool_binop_done; } if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 387, __pyx_L1_error) + __PYX_ERR(0, 384, __pyx_L1_error) } - __pyx_t_8 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_lo)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 387, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_8 != 0); - __pyx_t_5 = __pyx_t_4; + __pyx_t_8 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_lo)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_4 = __pyx_t_8; __pyx_L10_bool_binop_done:; - if (__pyx_t_5) { + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":388 + /* "pyreadstat/_readstat_writer.pyx":385 * raise PyreadstatError(msg) * if type(hi) in numeric_types and type(lo) in numeric_types: * if vartype not in pywriter_numeric_types: # <<<<<<<<<<<<<< * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename * raise PyreadstatError(msg) */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_vartype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_vartype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 388, __pyx_L1_error) + __PYX_ERR(0, 385, __pyx_L1_error) } - __pyx_t_5 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 388, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":389 + /* "pyreadstat/_readstat_writer.pyx":386 * if type(hi) in numeric_types and type(lo) in numeric_types: * if vartype not in pywriter_numeric_types: * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * if hi == lo: */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_numeric_missing_ranges_value_giv, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_numeric_missing_ranges_value_giv, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_msg = __pyx_t_3; __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":390 + /* "pyreadstat/_readstat_writer.pyx":387 * if vartype not in pywriter_numeric_types: * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * if hi == lo: * check_exit_status(readstat_variable_add_missing_double_value(variable, hi)) */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 387, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __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, 390, __pyx_L1_error) + __PYX_ERR(0, 387, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":388 + /* "pyreadstat/_readstat_writer.pyx":385 * raise PyreadstatError(msg) * if type(hi) in numeric_types and type(lo) in numeric_types: * if vartype not in pywriter_numeric_types: # <<<<<<<<<<<<<< @@ -7406,29 +8918,29 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":391 + /* "pyreadstat/_readstat_writer.pyx":388 * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename * raise PyreadstatError(msg) * if hi == lo: # <<<<<<<<<<<<<< * check_exit_status(readstat_variable_add_missing_double_value(variable, hi)) * discrete_values += 1 */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_hi, __pyx_v_lo, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_hi, __pyx_v_lo, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 388, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":392 + /* "pyreadstat/_readstat_writer.pyx":389 * raise PyreadstatError(msg) * if hi == lo: * check_exit_status(readstat_variable_add_missing_double_value(variable, hi)) # <<<<<<<<<<<<<< * discrete_values += 1 * else: */ - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_hi); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_double_value(__pyx_v_variable, __pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_hi); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_double_value(__pyx_v_variable, __pyx_t_9)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":393 + /* "pyreadstat/_readstat_writer.pyx":390 * if hi == lo: * check_exit_status(readstat_variable_add_missing_double_value(variable, hi)) * discrete_values += 1 # <<<<<<<<<<<<<< @@ -7437,7 +8949,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_values = (__pyx_v_discrete_values + 1); - /* "pyreadstat/_readstat_writer.pyx":391 + /* "pyreadstat/_readstat_writer.pyx":388 * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename * raise PyreadstatError(msg) * if hi == lo: # <<<<<<<<<<<<<< @@ -7447,7 +8959,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L13; } - /* "pyreadstat/_readstat_writer.pyx":395 + /* "pyreadstat/_readstat_writer.pyx":392 * discrete_values += 1 * else: * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) # <<<<<<<<<<<<<< @@ -7455,11 +8967,11 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject * elif type(hi) == str and type(lo) == str: */ /*else*/ { - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_lo); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L1_error) - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_hi); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L1_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_double_range(__pyx_v_variable, __pyx_t_9, __pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_lo); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_hi); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_double_range(__pyx_v_variable, __pyx_t_9, __pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":396 + /* "pyreadstat/_readstat_writer.pyx":393 * else: * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) * range_values += 1 # <<<<<<<<<<<<<< @@ -7470,7 +8982,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __pyx_L13:; - /* "pyreadstat/_readstat_writer.pyx":387 + /* "pyreadstat/_readstat_writer.pyx":384 * msg = "dictionaries in missing_ranges must have the keys hi and lo" * raise PyreadstatError(msg) * if type(hi) in numeric_types and type(lo) in numeric_types: # <<<<<<<<<<<<<< @@ -7480,29 +8992,29 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L9; } - /* "pyreadstat/_readstat_writer.pyx":397 + /* "pyreadstat/_readstat_writer.pyx":394 * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) * range_values += 1 * elif type(hi) == str and type(lo) == str: # <<<<<<<<<<<<<< * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: * msg = "character missing_ranges value given for non character variable %s" %variablename */ - __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_hi)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_hi)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_5) { + if (__pyx_t_8) { } else { - __pyx_t_4 = __pyx_t_5; + __pyx_t_4 = __pyx_t_8; goto __pyx_L14_bool_binop_done; } - __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_lo)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 397, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_lo)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_t_5; + __pyx_t_4 = __pyx_t_8; __pyx_L14_bool_binop_done:; if (likely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":398 + /* "pyreadstat/_readstat_writer.pyx":395 * range_values += 1 * elif type(hi) == str and type(lo) == str: * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -7520,47 +9032,52 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":399 + /* "pyreadstat/_readstat_writer.pyx":396 * elif type(hi) == str and type(lo) == str: * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: * msg = "character missing_ranges value given for non character variable %s" %variablename # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * if hi == lo: */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_character_missing_ranges_value_g, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_character_missing_ranges_value_g, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_msg = __pyx_t_3; __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":400 + /* "pyreadstat/_readstat_writer.pyx":397 * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: * msg = "character missing_ranges value given for non character variable %s" %variablename * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * if hi == lo: * if len(hi) > 8: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 397, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __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, 400, __pyx_L1_error) + __PYX_ERR(0, 397, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":398 + /* "pyreadstat/_readstat_writer.pyx":395 * range_values += 1 * elif type(hi) == str and type(lo) == str: * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -7569,30 +9086,30 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":401 + /* "pyreadstat/_readstat_writer.pyx":398 * msg = "character missing_ranges value given for non character variable %s" %variablename * raise PyreadstatError(msg) * if hi == lo: # <<<<<<<<<<<<<< * if len(hi) > 8: * msg = "missing_ranges: string values length must not be larger than 8" */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_hi, __pyx_v_lo, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 401, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_hi, __pyx_v_lo, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":402 + /* "pyreadstat/_readstat_writer.pyx":399 * raise PyreadstatError(msg) * if hi == lo: * if len(hi) > 8: # <<<<<<<<<<<<<< * msg = "missing_ranges: string values length must not be larger than 8" * raise PyreadstatError(msg) */ - __pyx_t_11 = PyObject_Length(__pyx_v_hi); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 402, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_11 > 8) != 0); + __pyx_t_11 = PyObject_Length(__pyx_v_hi); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_11 > 8); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":403 + /* "pyreadstat/_readstat_writer.pyx":400 * if hi == lo: * if len(hi) > 8: * msg = "missing_ranges: string values length must not be larger than 8" # <<<<<<<<<<<<<< @@ -7602,35 +9119,40 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_string_values_len); __pyx_v_msg = __pyx_kp_s_missing_ranges_string_values_len; - /* "pyreadstat/_readstat_writer.pyx":404 + /* "pyreadstat/_readstat_writer.pyx":401 * if len(hi) > 8: * msg = "missing_ranges: string values length must not be larger than 8" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * check_exit_status(readstat_variable_add_missing_string_value(variable, hi))#.encode("utf-8"))) * discrete_strings += 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __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, 404, __pyx_L1_error) + __PYX_ERR(0, 401, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":402 + /* "pyreadstat/_readstat_writer.pyx":399 * raise PyreadstatError(msg) * if hi == lo: * if len(hi) > 8: # <<<<<<<<<<<<<< @@ -7639,17 +9161,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":405 + /* "pyreadstat/_readstat_writer.pyx":402 * msg = "missing_ranges: string values length must not be larger than 8" * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_string_value(variable, hi))#.encode("utf-8"))) # <<<<<<<<<<<<<< * discrete_strings += 1 * else: */ - __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_hi); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L1_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_string_value(__pyx_v_variable, __pyx_t_12)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_hi); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 402, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_string_value(__pyx_v_variable, __pyx_t_12)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 402, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":406 + /* "pyreadstat/_readstat_writer.pyx":403 * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_string_value(variable, hi))#.encode("utf-8"))) * discrete_strings += 1 # <<<<<<<<<<<<<< @@ -7658,7 +9180,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_strings = (__pyx_v_discrete_strings + 1); - /* "pyreadstat/_readstat_writer.pyx":401 + /* "pyreadstat/_readstat_writer.pyx":398 * msg = "character missing_ranges value given for non character variable %s" %variablename * raise PyreadstatError(msg) * if hi == lo: # <<<<<<<<<<<<<< @@ -7668,7 +9190,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L17; } - /* "pyreadstat/_readstat_writer.pyx":409 + /* "pyreadstat/_readstat_writer.pyx":406 * else: * #check_exit_status(readstat_variable_add_missing_string_range(variable, lo, hi)) * msg = "missing_ranges: hi and lo values must be both the same for string type" # <<<<<<<<<<<<<< @@ -7679,37 +9201,42 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_hi_and_lo_values); __pyx_v_msg = __pyx_kp_s_missing_ranges_hi_and_lo_values; - /* "pyreadstat/_readstat_writer.pyx":410 + /* "pyreadstat/_readstat_writer.pyx":407 * #check_exit_status(readstat_variable_add_missing_string_range(variable, lo, hi)) * msg = "missing_ranges: hi and lo values must be both the same for string type" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * else: * msg = "missing_ranges: hi and lo values must be both either of numeric or string type" */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 410, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 407, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __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, 410, __pyx_L1_error) + __PYX_ERR(0, 407, __pyx_L1_error) } __pyx_L17:; - /* "pyreadstat/_readstat_writer.pyx":397 + /* "pyreadstat/_readstat_writer.pyx":394 * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) * range_values += 1 * elif type(hi) == str and type(lo) == str: # <<<<<<<<<<<<<< @@ -7719,7 +9246,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L9; } - /* "pyreadstat/_readstat_writer.pyx":412 + /* "pyreadstat/_readstat_writer.pyx":409 * raise PyreadstatError(msg) * else: * msg = "missing_ranges: hi and lo values must be both either of numeric or string type" # <<<<<<<<<<<<<< @@ -7730,37 +9257,42 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_hi_and_lo_values_2); __pyx_v_msg = __pyx_kp_s_missing_ranges_hi_and_lo_values_2; - /* "pyreadstat/_readstat_writer.pyx":413 + /* "pyreadstat/_readstat_writer.pyx":410 * else: * msg = "missing_ranges: hi and lo values must be both either of numeric or string type" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * else: * if type(cur_range) in numeric_types: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 410, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __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, 413, __pyx_L1_error) + __PYX_ERR(0, 410, __pyx_L1_error) } __pyx_L9:; - /* "pyreadstat/_readstat_writer.pyx":381 + /* "pyreadstat/_readstat_writer.pyx":378 * * for cur_range in cur_ranges: * if isinstance(cur_range, dict): # <<<<<<<<<<<<<< @@ -7770,7 +9302,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L5; } - /* "pyreadstat/_readstat_writer.pyx":415 + /* "pyreadstat/_readstat_writer.pyx":412 * raise PyreadstatError(msg) * else: * if type(cur_range) in numeric_types: # <<<<<<<<<<<<<< @@ -7780,71 +9312,74 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject /*else*/ { if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 415, __pyx_L1_error) + __PYX_ERR(0, 412, __pyx_L1_error) } - __pyx_t_4 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_cur_range)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 415, __pyx_L1_error) - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { + __pyx_t_4 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_cur_range)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 412, __pyx_L1_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":416 + /* "pyreadstat/_readstat_writer.pyx":413 * else: * if type(cur_range) in numeric_types: * if vartype not in pywriter_numeric_types: # <<<<<<<<<<<<<< * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename * raise PyreadstatError(msg) */ - __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_vartype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_vartype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 416, __pyx_L1_error) + __PYX_ERR(0, 413, __pyx_L1_error) } - __pyx_t_5 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_t_3, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":417 + /* "pyreadstat/_readstat_writer.pyx":414 * if type(cur_range) in numeric_types: * if vartype not in pywriter_numeric_types: * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_numeric_missing_ranges_value_giv, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_numeric_missing_ranges_value_giv, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_msg = __pyx_t_3; __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":418 + /* "pyreadstat/_readstat_writer.pyx":415 * if vartype not in pywriter_numeric_types: * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) * discrete_values += 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 415, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 415, __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, 418, __pyx_L1_error) + __PYX_ERR(0, 415, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":416 + /* "pyreadstat/_readstat_writer.pyx":413 * else: * if type(cur_range) in numeric_types: * if vartype not in pywriter_numeric_types: # <<<<<<<<<<<<<< @@ -7853,17 +9388,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":419 + /* "pyreadstat/_readstat_writer.pyx":416 * msg = "numeric missing_ranges value given for non numeric variable %s" %variablename * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) # <<<<<<<<<<<<<< * discrete_values += 1 * elif type(cur_range) == str: */ - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_cur_range); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 419, __pyx_L1_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_double_value(__pyx_v_variable, __pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_cur_range); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_double_value(__pyx_v_variable, __pyx_t_10)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 416, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":420 + /* "pyreadstat/_readstat_writer.pyx":417 * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) * discrete_values += 1 # <<<<<<<<<<<<<< @@ -7872,7 +9407,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_values = (__pyx_v_discrete_values + 1); - /* "pyreadstat/_readstat_writer.pyx":415 + /* "pyreadstat/_readstat_writer.pyx":412 * raise PyreadstatError(msg) * else: * if type(cur_range) in numeric_types: # <<<<<<<<<<<<<< @@ -7882,19 +9417,19 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L19; } - /* "pyreadstat/_readstat_writer.pyx":421 + /* "pyreadstat/_readstat_writer.pyx":418 * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) * discrete_values += 1 * elif type(cur_range) == str: # <<<<<<<<<<<<<< * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: * msg = "character missing_ranges value given for non character variable %s" %variablename */ - __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_cur_range)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 421, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_cur_range)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":422 + /* "pyreadstat/_readstat_writer.pyx":419 * discrete_values += 1 * elif type(cur_range) == str: * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -7912,47 +9447,52 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":423 + /* "pyreadstat/_readstat_writer.pyx":420 * elif type(cur_range) == str: * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: * msg = "character missing_ranges value given for non character variable %s" %variablename # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * if len(cur_range) > 8: */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_character_missing_ranges_value_g, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_character_missing_ranges_value_g, __pyx_v_variablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_msg = __pyx_t_3; __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":424 + /* "pyreadstat/_readstat_writer.pyx":421 * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: * msg = "character missing_ranges value given for non character variable %s" %variablename * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * if len(cur_range) > 8: * msg = "missing_ranges: string values length must not be larger than 8" */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 421, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __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, 424, __pyx_L1_error) + __PYX_ERR(0, 421, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":422 + /* "pyreadstat/_readstat_writer.pyx":419 * discrete_values += 1 * elif type(cur_range) == str: * if vartype != PYWRITER_CHARACTER and vartype != PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -7961,18 +9501,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":425 + /* "pyreadstat/_readstat_writer.pyx":422 * msg = "character missing_ranges value given for non character variable %s" %variablename * raise PyreadstatError(msg) * if len(cur_range) > 8: # <<<<<<<<<<<<<< * msg = "missing_ranges: string values length must not be larger than 8" * raise PyreadstatError(msg) */ - __pyx_t_11 = PyObject_Length(__pyx_v_cur_range); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 425, __pyx_L1_error) - __pyx_t_4 = ((__pyx_t_11 > 8) != 0); + __pyx_t_11 = PyObject_Length(__pyx_v_cur_range); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_11 > 8); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":426 + /* "pyreadstat/_readstat_writer.pyx":423 * raise PyreadstatError(msg) * if len(cur_range) > 8: * msg = "missing_ranges: string values length must not be larger than 8" # <<<<<<<<<<<<<< @@ -7982,35 +9522,40 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_string_values_len); __pyx_v_msg = __pyx_kp_s_missing_ranges_string_values_len; - /* "pyreadstat/_readstat_writer.pyx":427 + /* "pyreadstat/_readstat_writer.pyx":424 * if len(cur_range) > 8: * msg = "missing_ranges: string values length must not be larger than 8" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * check_exit_status(readstat_variable_add_missing_string_value(variable, cur_range))#.encode("utf-8"))) * discrete_strings += 1 */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 424, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __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, 427, __pyx_L1_error) + __PYX_ERR(0, 424, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":425 + /* "pyreadstat/_readstat_writer.pyx":422 * msg = "character missing_ranges value given for non character variable %s" %variablename * raise PyreadstatError(msg) * if len(cur_range) > 8: # <<<<<<<<<<<<<< @@ -8019,17 +9564,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":428 + /* "pyreadstat/_readstat_writer.pyx":425 * msg = "missing_ranges: string values length must not be larger than 8" * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_string_value(variable, cur_range))#.encode("utf-8"))) # <<<<<<<<<<<<<< * discrete_strings += 1 * else: */ - __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_cur_range); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_string_value(__pyx_v_variable, __pyx_t_12)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_cur_range); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_variable_add_missing_string_value(__pyx_v_variable, __pyx_t_12)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 425, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":429 + /* "pyreadstat/_readstat_writer.pyx":426 * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_string_value(variable, cur_range))#.encode("utf-8"))) * discrete_strings += 1 # <<<<<<<<<<<<<< @@ -8038,7 +9583,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_strings = (__pyx_v_discrete_strings + 1); - /* "pyreadstat/_readstat_writer.pyx":421 + /* "pyreadstat/_readstat_writer.pyx":418 * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) * discrete_values += 1 * elif type(cur_range) == str: # <<<<<<<<<<<<<< @@ -8048,7 +9593,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L19; } - /* "pyreadstat/_readstat_writer.pyx":431 + /* "pyreadstat/_readstat_writer.pyx":428 * discrete_strings += 1 * else: * msg = "missing_ranges: values must be both either of numeric or string type" # <<<<<<<<<<<<<< @@ -8059,49 +9604,54 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_values_must_be_bo); __pyx_v_msg = __pyx_kp_s_missing_ranges_values_must_be_bo; - /* "pyreadstat/_readstat_writer.pyx":432 + /* "pyreadstat/_readstat_writer.pyx":429 * else: * msg = "missing_ranges: values must be both either of numeric or string type" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * if discrete_strings > 3: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 429, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __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); + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __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, 432, __pyx_L1_error) + __PYX_ERR(0, 429, __pyx_L1_error) } __pyx_L19:; } __pyx_L5:; - /* "pyreadstat/_readstat_writer.pyx":434 + /* "pyreadstat/_readstat_writer.pyx":431 * raise PyreadstatError(msg) * * if discrete_strings > 3: # <<<<<<<<<<<<<< * msg = "missing_ranges: max 3 string values per variable allowed" * raise PyreadstatError(msg) */ - __pyx_t_4 = ((__pyx_v_discrete_strings > 3) != 0); + __pyx_t_4 = (__pyx_v_discrete_strings > 3); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":435 + /* "pyreadstat/_readstat_writer.pyx":432 * * if discrete_strings > 3: * msg = "missing_ranges: max 3 string values per variable allowed" # <<<<<<<<<<<<<< @@ -8111,35 +9661,40 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_max_3_string_valu); __pyx_v_msg = __pyx_kp_s_missing_ranges_max_3_string_valu; - /* "pyreadstat/_readstat_writer.pyx":436 + /* "pyreadstat/_readstat_writer.pyx":433 * if discrete_strings > 3: * msg = "missing_ranges: max 3 string values per variable allowed" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * if range_values: * if range_values > 1: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 433, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 433, __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, 436, __pyx_L1_error) + __PYX_ERR(0, 433, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":434 + /* "pyreadstat/_readstat_writer.pyx":431 * raise PyreadstatError(msg) * * if discrete_strings > 3: # <<<<<<<<<<<<<< @@ -8148,7 +9703,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":437 + /* "pyreadstat/_readstat_writer.pyx":434 * msg = "missing_ranges: max 3 string values per variable allowed" * raise PyreadstatError(msg) * if range_values: # <<<<<<<<<<<<<< @@ -8158,17 +9713,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_t_4 = (__pyx_v_range_values != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":438 + /* "pyreadstat/_readstat_writer.pyx":435 * raise PyreadstatError(msg) * if range_values: * if range_values > 1: # <<<<<<<<<<<<<< * msg = "missing_ranges: max 1 range value per variable allowed" * raise PyreadstatError(msg) */ - __pyx_t_4 = ((__pyx_v_range_values > 1) != 0); + __pyx_t_4 = (__pyx_v_range_values > 1); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":439 + /* "pyreadstat/_readstat_writer.pyx":436 * if range_values: * if range_values > 1: * msg = "missing_ranges: max 1 range value per variable allowed" # <<<<<<<<<<<<<< @@ -8178,35 +9733,40 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_max_1_range_value); __pyx_v_msg = __pyx_kp_s_missing_ranges_max_1_range_value; - /* "pyreadstat/_readstat_writer.pyx":440 + /* "pyreadstat/_readstat_writer.pyx":437 * if range_values > 1: * msg = "missing_ranges: max 1 range value per variable allowed" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * if discrete_values > 1: * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __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, 440, __pyx_L1_error) + __PYX_ERR(0, 437, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":438 + /* "pyreadstat/_readstat_writer.pyx":435 * raise PyreadstatError(msg) * if range_values: * if range_values > 1: # <<<<<<<<<<<<<< @@ -8215,17 +9775,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":441 + /* "pyreadstat/_readstat_writer.pyx":438 * msg = "missing_ranges: max 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values > 1: # <<<<<<<<<<<<<< * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" * raise PyreadstatError(msg) */ - __pyx_t_4 = ((__pyx_v_discrete_values > 1) != 0); + __pyx_t_4 = (__pyx_v_discrete_values > 1); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":442 + /* "pyreadstat/_readstat_writer.pyx":439 * raise PyreadstatError(msg) * if discrete_values > 1: * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" # <<<<<<<<<<<<<< @@ -8235,35 +9795,40 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_max_1_discrete_nu); __pyx_v_msg = __pyx_kp_s_missing_ranges_max_1_discrete_nu; - /* "pyreadstat/_readstat_writer.pyx":443 + /* "pyreadstat/_readstat_writer.pyx":440 * if discrete_values > 1: * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * if discrete_values >3: * msg = "missing_ranges: max 3 discrete numeric values per variable allowed" */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __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, 443, __pyx_L1_error) + __PYX_ERR(0, 440, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":441 + /* "pyreadstat/_readstat_writer.pyx":438 * msg = "missing_ranges: max 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values > 1: # <<<<<<<<<<<<<< @@ -8272,7 +9837,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":437 + /* "pyreadstat/_readstat_writer.pyx":434 * msg = "missing_ranges: max 3 string values per variable allowed" * raise PyreadstatError(msg) * if range_values: # <<<<<<<<<<<<<< @@ -8281,17 +9846,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":444 + /* "pyreadstat/_readstat_writer.pyx":441 * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values >3: # <<<<<<<<<<<<<< * msg = "missing_ranges: max 3 discrete numeric values per variable allowed" * raise PyreadstatError(msg) */ - __pyx_t_4 = ((__pyx_v_discrete_values > 3) != 0); + __pyx_t_4 = (__pyx_v_discrete_values > 3); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":445 + /* "pyreadstat/_readstat_writer.pyx":442 * raise PyreadstatError(msg) * if discrete_values >3: * msg = "missing_ranges: max 3 discrete numeric values per variable allowed" # <<<<<<<<<<<<<< @@ -8301,35 +9866,40 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_INCREF(__pyx_kp_s_missing_ranges_max_3_discrete_nu); __pyx_v_msg = __pyx_kp_s_missing_ranges_max_3_discrete_nu; - /* "pyreadstat/_readstat_writer.pyx":446 + /* "pyreadstat/_readstat_writer.pyx":443 * if discrete_values >3: * msg = "missing_ranges: max 3 discrete numeric values per variable allowed" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * cdef void set_variable_alignment(readstat_variable_t *variable, str alignment_str, str var_name) except *: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __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_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; } } - __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 443, __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, 446, __pyx_L1_error) + __PYX_ERR(0, 443, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":444 + /* "pyreadstat/_readstat_writer.pyx":441 * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values >3: # <<<<<<<<<<<<<< @@ -8338,7 +9908,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":380 + /* "pyreadstat/_readstat_writer.pyx":377 * cdef int discrete_strings = 0 * * for cur_range in cur_ranges: # <<<<<<<<<<<<<< @@ -8348,7 +9918,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":370 + /* "pyreadstat/_readstat_writer.pyx":367 * return label_set * * cdef void add_missing_ranges(list cur_ranges, readstat_variable_t *variable, pywriter_variable_type vartype, str variablename) except *: # <<<<<<<<<<<<<< @@ -8361,8 +9931,8 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("pyreadstat._readstat_writer.add_missing_ranges", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_cur_range); @@ -8372,7 +9942,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":448 +/* "pyreadstat/_readstat_writer.pyx":445 * raise PyreadstatError(msg) * * cdef void set_variable_alignment(readstat_variable_t *variable, str alignment_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -8385,27 +9955,26 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads PyObject *__pyx_v_msg = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_variable_alignment", 0); - /* "pyreadstat/_readstat_writer.pyx":455 + /* "pyreadstat/_readstat_writer.pyx":452 * cdef readstat_alignment_t alignment * * if alignment_str == "right": # <<<<<<<<<<<<<< * alignment = READSTAT_ALIGNMENT_RIGHT * elif alignment_str == "left": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_right, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 455, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_right, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 452, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":456 + /* "pyreadstat/_readstat_writer.pyx":453 * * if alignment_str == "right": * alignment = READSTAT_ALIGNMENT_RIGHT # <<<<<<<<<<<<<< @@ -8414,7 +9983,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_RIGHT; - /* "pyreadstat/_readstat_writer.pyx":455 + /* "pyreadstat/_readstat_writer.pyx":452 * cdef readstat_alignment_t alignment * * if alignment_str == "right": # <<<<<<<<<<<<<< @@ -8424,18 +9993,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":457 + /* "pyreadstat/_readstat_writer.pyx":454 * if alignment_str == "right": * alignment = READSTAT_ALIGNMENT_RIGHT * elif alignment_str == "left": # <<<<<<<<<<<<<< * alignment = READSTAT_ALIGNMENT_LEFT * elif alignment_str == "center": */ - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_left, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_left, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 454, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":458 + /* "pyreadstat/_readstat_writer.pyx":455 * alignment = READSTAT_ALIGNMENT_RIGHT * elif alignment_str == "left": * alignment = READSTAT_ALIGNMENT_LEFT # <<<<<<<<<<<<<< @@ -8444,7 +10012,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_LEFT; - /* "pyreadstat/_readstat_writer.pyx":457 + /* "pyreadstat/_readstat_writer.pyx":454 * if alignment_str == "right": * alignment = READSTAT_ALIGNMENT_RIGHT * elif alignment_str == "left": # <<<<<<<<<<<<<< @@ -8454,18 +10022,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":459 + /* "pyreadstat/_readstat_writer.pyx":456 * elif alignment_str == "left": * alignment = READSTAT_ALIGNMENT_LEFT * elif alignment_str == "center": # <<<<<<<<<<<<<< * alignment = READSTAT_ALIGNMENT_CENTER * elif alignment_str == "unknown": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_center, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 459, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_center, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 456, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":460 + /* "pyreadstat/_readstat_writer.pyx":457 * alignment = READSTAT_ALIGNMENT_LEFT * elif alignment_str == "center": * alignment = READSTAT_ALIGNMENT_CENTER # <<<<<<<<<<<<<< @@ -8474,7 +10041,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_CENTER; - /* "pyreadstat/_readstat_writer.pyx":459 + /* "pyreadstat/_readstat_writer.pyx":456 * elif alignment_str == "left": * alignment = READSTAT_ALIGNMENT_LEFT * elif alignment_str == "center": # <<<<<<<<<<<<<< @@ -8484,18 +10051,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":461 + /* "pyreadstat/_readstat_writer.pyx":458 * elif alignment_str == "center": * alignment = READSTAT_ALIGNMENT_CENTER * elif alignment_str == "unknown": # <<<<<<<<<<<<<< * alignment = READSTAT_ALIGNMENT_UNKNOWN * else: */ - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_unknown, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_alignment_str, __pyx_n_s_unknown, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 458, __pyx_L1_error) if (likely(__pyx_t_1)) { - /* "pyreadstat/_readstat_writer.pyx":462 + /* "pyreadstat/_readstat_writer.pyx":459 * alignment = READSTAT_ALIGNMENT_CENTER * elif alignment_str == "unknown": * alignment = READSTAT_ALIGNMENT_UNKNOWN # <<<<<<<<<<<<<< @@ -8504,7 +10070,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_UNKNOWN; - /* "pyreadstat/_readstat_writer.pyx":461 + /* "pyreadstat/_readstat_writer.pyx":458 * elif alignment_str == "center": * alignment = READSTAT_ALIGNMENT_CENTER * elif alignment_str == "unknown": # <<<<<<<<<<<<<< @@ -8514,7 +10080,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":464 + /* "pyreadstat/_readstat_writer.pyx":461 * alignment = READSTAT_ALIGNMENT_UNKNOWN * else: * msg = "alignment for variable %s must be either right, center, left or unknown got %s instead" % (var_name, alignment_str) # <<<<<<<<<<<<<< @@ -8522,51 +10088,56 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads * */ /*else*/ { - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_var_name); __Pyx_GIVEREF(__pyx_v_var_name); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_var_name); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_var_name); __Pyx_INCREF(__pyx_v_alignment_str); __Pyx_GIVEREF(__pyx_v_alignment_str); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_alignment_str); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_alignment_for_variable_s_must_be, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 464, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_msg = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_alignment_str); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_alignment_for_variable_s_must_be, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_msg = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":465 + /* "pyreadstat/_readstat_writer.pyx":462 * else: * msg = "alignment for variable %s must be either right, center, left or unknown got %s instead" % (var_name, alignment_str) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * readstat_variable_set_alignment(variable, alignment) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __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, 465, __pyx_L1_error) + __PYX_ERR(0, 462, __pyx_L1_error) } __pyx_L3:; - /* "pyreadstat/_readstat_writer.pyx":467 + /* "pyreadstat/_readstat_writer.pyx":464 * raise PyreadstatError(msg) * * readstat_variable_set_alignment(variable, alignment) # <<<<<<<<<<<<<< @@ -8575,7 +10146,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ readstat_variable_set_alignment(__pyx_v_variable, __pyx_v_alignment); - /* "pyreadstat/_readstat_writer.pyx":448 + /* "pyreadstat/_readstat_writer.pyx":445 * raise PyreadstatError(msg) * * cdef void set_variable_alignment(readstat_variable_t *variable, str alignment_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -8586,16 +10157,16 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads /* function exit code */ 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_AddTraceback("pyreadstat._readstat_writer.set_variable_alignment", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_msg); __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":469 +/* "pyreadstat/_readstat_writer.pyx":466 * readstat_variable_set_alignment(variable, alignment) * * cdef void set_variable_display_width(readstat_variable_t *variable, int display_width, str var_name) except *: # <<<<<<<<<<<<<< @@ -8607,7 +10178,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(r __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_variable_display_width", 0); - /* "pyreadstat/_readstat_writer.pyx":474 + /* "pyreadstat/_readstat_writer.pyx":471 * """ * * readstat_variable_set_display_width(variable, display_width) # <<<<<<<<<<<<<< @@ -8616,7 +10187,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(r */ readstat_variable_set_display_width(__pyx_v_variable, __pyx_v_display_width); - /* "pyreadstat/_readstat_writer.pyx":469 + /* "pyreadstat/_readstat_writer.pyx":466 * readstat_variable_set_alignment(variable, alignment) * * cdef void set_variable_display_width(readstat_variable_t *variable, int display_width, str var_name) except *: # <<<<<<<<<<<<<< @@ -8628,7 +10199,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(r __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":476 +/* "pyreadstat/_readstat_writer.pyx":473 * readstat_variable_set_display_width(variable, display_width) * * cdef void set_variable_measure(readstat_variable_t *variable, str measure_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -8641,27 +10212,26 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta PyObject *__pyx_v_msg = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_variable_measure", 0); - /* "pyreadstat/_readstat_writer.pyx":483 + /* "pyreadstat/_readstat_writer.pyx":480 * cdef readstat_measure_t measure * * if measure_str == "nominal": # <<<<<<<<<<<<<< * measure = READSTAT_MEASURE_NOMINAL * elif measure_str == "ordinal": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_nominal, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 483, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_nominal, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 480, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":484 + /* "pyreadstat/_readstat_writer.pyx":481 * * if measure_str == "nominal": * measure = READSTAT_MEASURE_NOMINAL # <<<<<<<<<<<<<< @@ -8670,7 +10240,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_NOMINAL; - /* "pyreadstat/_readstat_writer.pyx":483 + /* "pyreadstat/_readstat_writer.pyx":480 * cdef readstat_measure_t measure * * if measure_str == "nominal": # <<<<<<<<<<<<<< @@ -8680,18 +10250,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":485 + /* "pyreadstat/_readstat_writer.pyx":482 * if measure_str == "nominal": * measure = READSTAT_MEASURE_NOMINAL * elif measure_str == "ordinal": # <<<<<<<<<<<<<< * measure = READSTAT_MEASURE_ORDINAL * elif measure_str == "scale": */ - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_ordinal, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 485, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_ordinal, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 482, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":486 + /* "pyreadstat/_readstat_writer.pyx":483 * measure = READSTAT_MEASURE_NOMINAL * elif measure_str == "ordinal": * measure = READSTAT_MEASURE_ORDINAL # <<<<<<<<<<<<<< @@ -8700,7 +10269,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_ORDINAL; - /* "pyreadstat/_readstat_writer.pyx":485 + /* "pyreadstat/_readstat_writer.pyx":482 * if measure_str == "nominal": * measure = READSTAT_MEASURE_NOMINAL * elif measure_str == "ordinal": # <<<<<<<<<<<<<< @@ -8710,18 +10279,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":487 + /* "pyreadstat/_readstat_writer.pyx":484 * elif measure_str == "ordinal": * measure = READSTAT_MEASURE_ORDINAL * elif measure_str == "scale": # <<<<<<<<<<<<<< * measure = READSTAT_MEASURE_SCALE * elif measure_str == "unknown": */ - __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_scale, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 487, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_scale, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 484, __pyx_L1_error) + if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":488 + /* "pyreadstat/_readstat_writer.pyx":485 * measure = READSTAT_MEASURE_ORDINAL * elif measure_str == "scale": * measure = READSTAT_MEASURE_SCALE # <<<<<<<<<<<<<< @@ -8730,7 +10298,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_SCALE; - /* "pyreadstat/_readstat_writer.pyx":487 + /* "pyreadstat/_readstat_writer.pyx":484 * elif measure_str == "ordinal": * measure = READSTAT_MEASURE_ORDINAL * elif measure_str == "scale": # <<<<<<<<<<<<<< @@ -8740,18 +10308,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":489 + /* "pyreadstat/_readstat_writer.pyx":486 * elif measure_str == "scale": * measure = READSTAT_MEASURE_SCALE * elif measure_str == "unknown": # <<<<<<<<<<<<<< * measure = READSTAT_MEASURE_UNKNOWN * else: */ - __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_unknown, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 489, __pyx_L1_error) - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_measure_str, __pyx_n_s_unknown, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 486, __pyx_L1_error) if (likely(__pyx_t_1)) { - /* "pyreadstat/_readstat_writer.pyx":490 + /* "pyreadstat/_readstat_writer.pyx":487 * measure = READSTAT_MEASURE_SCALE * elif measure_str == "unknown": * measure = READSTAT_MEASURE_UNKNOWN # <<<<<<<<<<<<<< @@ -8760,7 +10327,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_UNKNOWN; - /* "pyreadstat/_readstat_writer.pyx":489 + /* "pyreadstat/_readstat_writer.pyx":486 * elif measure_str == "scale": * measure = READSTAT_MEASURE_SCALE * elif measure_str == "unknown": # <<<<<<<<<<<<<< @@ -8770,7 +10337,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":492 + /* "pyreadstat/_readstat_writer.pyx":489 * measure = READSTAT_MEASURE_UNKNOWN * else: * msg = "measure for variable %s must be either nominal, ordinal, scale or unknown got %s instead" % (var_name, measure_str) # <<<<<<<<<<<<<< @@ -8778,51 +10345,56 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta * */ /*else*/ { - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_var_name); __Pyx_GIVEREF(__pyx_v_var_name); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_var_name); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_var_name); __Pyx_INCREF(__pyx_v_measure_str); __Pyx_GIVEREF(__pyx_v_measure_str); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_measure_str); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_measure_for_variable_s_must_be_e, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_msg = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_measure_str); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_measure_for_variable_s_must_be_e, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_msg = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":493 + /* "pyreadstat/_readstat_writer.pyx":490 * else: * msg = "measure for variable %s must be either nominal, ordinal, scale or unknown got %s instead" % (var_name, measure_str) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * readstat_variable_set_measure(variable, measure); */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 493, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_msg}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __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, 493, __pyx_L1_error) + __PYX_ERR(0, 490, __pyx_L1_error) } __pyx_L3:; - /* "pyreadstat/_readstat_writer.pyx":495 + /* "pyreadstat/_readstat_writer.pyx":492 * raise PyreadstatError(msg) * * readstat_variable_set_measure(variable, measure); # <<<<<<<<<<<<<< @@ -8831,7 +10403,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ readstat_variable_set_measure(__pyx_v_variable, __pyx_v_measure); - /* "pyreadstat/_readstat_writer.pyx":476 + /* "pyreadstat/_readstat_writer.pyx":473 * readstat_variable_set_display_width(variable, display_width) * * cdef void set_variable_measure(readstat_variable_t *variable, str measure_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -8842,19 +10414,19 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta /* function exit code */ 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_AddTraceback("pyreadstat._readstat_writer.set_variable_measure", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_msg); __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":498 +/* "pyreadstat/_readstat_writer.pyx":495 * * - * cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx): # <<<<<<<<<<<<<< + * cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx) noexcept: # <<<<<<<<<<<<<< * """ * for the writer an explicit function to write must be defined */ @@ -8863,42 +10435,90 @@ static Py_ssize_t __pyx_f_10pyreadstat_16_readstat_writer_write_bytes(void const int __pyx_v_fd; Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_bytes", 0); - /* "pyreadstat/_readstat_writer.pyx":503 + /* "pyreadstat/_readstat_writer.pyx":500 * """ * cdef int fd * fd = (ctx)[0] # <<<<<<<<<<<<<< - * IF UNAME_SYSNAME == 'Windows': + * if os.name=='nt': * return _write(fd, data, _len) */ __pyx_v_fd = (((int *)__pyx_v_ctx)[0]); - /* "pyreadstat/_readstat_writer.pyx":507 + /* "pyreadstat/_readstat_writer.pyx":501 + * cdef int fd + * fd = (ctx)[0] + * if os.name=='nt': # <<<<<<<<<<<<<< + * return _write(fd, data, _len) + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_nt, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 501, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "pyreadstat/_readstat_writer.pyx":502 + * fd = (ctx)[0] + * if os.name=='nt': + * return _write(fd, data, _len) # <<<<<<<<<<<<<< + * else: + * return write(fd, data, _len) + */ + __pyx_r = _write(__pyx_v_fd, __pyx_v_data, __pyx_v__len); + goto __pyx_L0; + + /* "pyreadstat/_readstat_writer.pyx":501 + * cdef int fd + * fd = (ctx)[0] + * if os.name=='nt': # <<<<<<<<<<<<<< + * return _write(fd, data, _len) + * else: + */ + } + + /* "pyreadstat/_readstat_writer.pyx":504 * return _write(fd, data, _len) - * ELSE: + * else: * return write(fd, data, _len) # <<<<<<<<<<<<<< * * cdef void _check_exit_status(readstat_error_t retcode) except *: */ - __pyx_r = write(__pyx_v_fd, __pyx_v_data, __pyx_v__len); - goto __pyx_L0; + /*else*/ { + __pyx_r = write(__pyx_v_fd, __pyx_v_data, __pyx_v__len); + goto __pyx_L0; + } - /* "pyreadstat/_readstat_writer.pyx":498 + /* "pyreadstat/_readstat_writer.pyx":495 * * - * cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx): # <<<<<<<<<<<<<< + * cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx) noexcept: # <<<<<<<<<<<<<< * """ * for the writer an explicit function to write must be defined */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("pyreadstat._readstat_writer.write_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":509 +/* "pyreadstat/_readstat_writer.pyx":506 * return write(fd, data, _len) * * cdef void _check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< @@ -8914,22 +10534,23 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ 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("_check_exit_status", 0); - /* "pyreadstat/_readstat_writer.pyx":516 + /* "pyreadstat/_readstat_writer.pyx":513 * cdef char * err_readstat * cdef str err_message * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< * err_readstat = readstat_error_message(retcode) * err_message = err_readstat */ - __pyx_t_1 = ((__pyx_v_retcode != READSTAT_OK) != 0); + __pyx_t_1 = (__pyx_v_retcode != READSTAT_OK); if (unlikely(__pyx_t_1)) { - /* "pyreadstat/_readstat_writer.pyx":517 + /* "pyreadstat/_readstat_writer.pyx":514 * cdef str err_message * if retcode != READSTAT_OK: * err_readstat = readstat_error_message(retcode) # <<<<<<<<<<<<<< @@ -8938,14 +10559,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ */ __pyx_v_err_readstat = readstat_error_message(__pyx_v_retcode); - /* "pyreadstat/_readstat_writer.pyx":518 + /* "pyreadstat/_readstat_writer.pyx":515 * if retcode != READSTAT_OK: * err_readstat = readstat_error_message(retcode) * err_message = err_readstat # <<<<<<<<<<<<<< * raise ReadstatError(err_message) * */ - __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_err_readstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_err_readstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); @@ -8953,16 +10574,17 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ __pyx_v_err_message = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":519 + /* "pyreadstat/_readstat_writer.pyx":516 * err_readstat = readstat_error_message(retcode) * err_message = err_readstat * raise ReadstatError(err_message) # <<<<<<<<<<<<<< * * cdef int open_file(bytes filename_path): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ReadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ReadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; + __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { @@ -8970,18 +10592,22 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v_err_message) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_err_message); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_err_message}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 519, __pyx_L1_error) + __PYX_ERR(0, 516, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":516 + /* "pyreadstat/_readstat_writer.pyx":513 * cdef char * err_readstat * cdef str err_message * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< @@ -8990,7 +10616,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ */ } - /* "pyreadstat/_readstat_writer.pyx":509 + /* "pyreadstat/_readstat_writer.pyx":506 * return write(fd, data, _len) * * cdef void _check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< @@ -9010,7 +10636,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":521 +/* "pyreadstat/_readstat_writer.pyx":518 * raise ReadstatError(err_message) * * cdef int open_file(bytes filename_path): # <<<<<<<<<<<<<< @@ -9031,42 +10657,44 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f PyObject *__pyx_t_2 = NULL; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - wchar_t *__pyx_t_5; - char *__pyx_t_6; + int __pyx_t_5; + wchar_t *__pyx_t_6; + char *__pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("open_file", 0); - /* "pyreadstat/_readstat_writer.pyx":532 - * IF PY_MAJOR_VERSION >2: + /* "pyreadstat/_readstat_writer.pyx":527 + * cdef char *path * - * if os.name == "nt": # <<<<<<<<<<<<<< - * filename_str = os.fsdecode(filename_path) - * u16_path = PyUnicode_AsWideCharString(filename_str, &length) + * if os.name == "nt": # <<<<<<<<<<<<<< + * filename_str = os.fsdecode(filename_path) + * u16_path = PyUnicode_AsWideCharString(filename_str, &length) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_nt, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_nt, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":533 + /* "pyreadstat/_readstat_writer.pyx":528 * - * if os.name == "nt": - * filename_str = os.fsdecode(filename_path) # <<<<<<<<<<<<<< - * u16_path = PyUnicode_AsWideCharString(filename_str, &length) - * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC + * if os.name == "nt": + * filename_str = os.fsdecode(filename_path) # <<<<<<<<<<<<<< + * u16_path = PyUnicode_AsWideCharString(filename_str, &length) + * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fsdecode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 533, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fsdecode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; + __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_1)) { @@ -9074,91 +10702,95 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_5 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_filename_path); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_filename_str = __pyx_t_2; - __pyx_t_2 = 0; - - /* "pyreadstat/_readstat_writer.pyx":534 - * if os.name == "nt": - * filename_str = os.fsdecode(filename_path) - * u16_path = PyUnicode_AsWideCharString(filename_str, &length) # <<<<<<<<<<<<<< - * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC - * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) - */ - __pyx_t_5 = PyUnicode_AsWideCharString(__pyx_v_filename_str, (&__pyx_v_length)); if (unlikely(__pyx_t_5 == ((wchar_t *)NULL))) __PYX_ERR(0, 534, __pyx_L1_error) - __pyx_v_u16_path = __pyx_t_5; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_filename_path}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __pyx_v_filename_str = __pyx_t_2; + __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":535 - * filename_str = os.fsdecode(filename_path) - * u16_path = PyUnicode_AsWideCharString(filename_str, &length) - * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC # <<<<<<<<<<<<<< - * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) - * else: + /* "pyreadstat/_readstat_writer.pyx":529 + * if os.name == "nt": + * filename_str = os.fsdecode(filename_path) + * u16_path = PyUnicode_AsWideCharString(filename_str, &length) # <<<<<<<<<<<<<< + * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC + * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) + */ + __pyx_t_6 = PyUnicode_AsWideCharString(__pyx_v_filename_str, (&__pyx_v_length)); if (unlikely(__pyx_t_6 == ((wchar_t *)NULL))) __PYX_ERR(0, 529, __pyx_L1_error) + __pyx_v_u16_path = __pyx_t_6; + + /* "pyreadstat/_readstat_writer.pyx":530 + * filename_str = os.fsdecode(filename_path) + * u16_path = PyUnicode_AsWideCharString(filename_str, &length) + * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC # <<<<<<<<<<<<<< + * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) + * else: */ __pyx_v_flags = (((_O_WRONLY | _O_CREAT) | _O_BINARY) | _O_TRUNC); - /* "pyreadstat/_readstat_writer.pyx":536 - * u16_path = PyUnicode_AsWideCharString(filename_str, &length) - * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC - * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) # <<<<<<<<<<<<<< - * else: - * #filename_bytes = filename_path.encode("utf-8") + /* "pyreadstat/_readstat_writer.pyx":531 + * u16_path = PyUnicode_AsWideCharString(filename_str, &length) + * flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC + * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) # <<<<<<<<<<<<<< + * else: + * #filename_bytes = filename_path.encode("utf-8") */ __pyx_v_fd = _wsopen(__pyx_v_u16_path, __pyx_v_flags, _SH_DENYRW, (_S_IREAD | _S_IWRITE)); - /* "pyreadstat/_readstat_writer.pyx":532 - * IF PY_MAJOR_VERSION >2: + /* "pyreadstat/_readstat_writer.pyx":527 + * cdef char *path * - * if os.name == "nt": # <<<<<<<<<<<<<< - * filename_str = os.fsdecode(filename_path) - * u16_path = PyUnicode_AsWideCharString(filename_str, &length) + * if os.name == "nt": # <<<<<<<<<<<<<< + * filename_str = os.fsdecode(filename_path) + * u16_path = PyUnicode_AsWideCharString(filename_str, &length) */ goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":539 - * else: - * #filename_bytes = filename_path.encode("utf-8") - * path = filename_path # <<<<<<<<<<<<<< - * flags = O_WRONLY | O_CREAT | O_TRUNC - * fd = open(path, flags, 0644) + /* "pyreadstat/_readstat_writer.pyx":534 + * else: + * #filename_bytes = filename_path.encode("utf-8") + * path = filename_path # <<<<<<<<<<<<<< + * flags = O_WRONLY | O_CREAT | O_TRUNC + * fd = open(path, flags, 0644) */ /*else*/ { if (unlikely(__pyx_v_filename_path == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 539, __pyx_L1_error) + __PYX_ERR(0, 534, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename_path); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error) - __pyx_v_path = ((char *)__pyx_t_6); + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename_path); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 534, __pyx_L1_error) + __pyx_v_path = ((char *)__pyx_t_7); - /* "pyreadstat/_readstat_writer.pyx":540 - * #filename_bytes = filename_path.encode("utf-8") - * path = filename_path - * flags = O_WRONLY | O_CREAT | O_TRUNC # <<<<<<<<<<<<<< - * fd = open(path, flags, 0644) + /* "pyreadstat/_readstat_writer.pyx":535 + * #filename_bytes = filename_path.encode("utf-8") + * path = filename_path + * flags = O_WRONLY | O_CREAT | O_TRUNC # <<<<<<<<<<<<<< + * fd = open(path, flags, 0644) * */ __pyx_v_flags = ((O_WRONLY | O_CREAT) | O_TRUNC); - /* "pyreadstat/_readstat_writer.pyx":541 - * path = filename_path - * flags = O_WRONLY | O_CREAT | O_TRUNC - * fd = open(path, flags, 0644) # <<<<<<<<<<<<<< + /* "pyreadstat/_readstat_writer.pyx":536 + * path = filename_path + * flags = O_WRONLY | O_CREAT | O_TRUNC + * fd = open(path, flags, 0644) # <<<<<<<<<<<<<< * - * ELSE: + * return fd */ __pyx_v_fd = open(__pyx_v_path, __pyx_v_flags, 0644); } __pyx_L3:; - /* "pyreadstat/_readstat_writer.pyx":552 - * fd = open(path, flags, 0644) + /* "pyreadstat/_readstat_writer.pyx":538 + * fd = open(path, flags, 0644) * * return fd # <<<<<<<<<<<<<< * @@ -9167,7 +10799,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f __pyx_r = __pyx_v_fd; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":521 + /* "pyreadstat/_readstat_writer.pyx":518 * raise ReadstatError(err_message) * * cdef int open_file(bytes filename_path): # <<<<<<<<<<<<<< @@ -9180,52 +10812,100 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_WriteUnraisable("pyreadstat._readstat_writer.open_file", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); - __pyx_r = 0; + __Pyx_AddTraceback("pyreadstat._readstat_writer.open_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_filename_str); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":554 +/* "pyreadstat/_readstat_writer.pyx":540 * return fd * * cdef int close_file(int fd): # <<<<<<<<<<<<<< - * IF UNAME_SYSNAME == 'Windows': + * if os.name == "nt": * return _close(fd) */ static int __pyx_f_10pyreadstat_16_readstat_writer_close_file(int __pyx_v_fd) { int __pyx_r; __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close_file", 0); - /* "pyreadstat/_readstat_writer.pyx":558 + /* "pyreadstat/_readstat_writer.pyx":541 + * + * cdef int close_file(int fd): + * if os.name == "nt": # <<<<<<<<<<<<<< + * return _close(fd) + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_nt, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "pyreadstat/_readstat_writer.pyx":542 + * cdef int close_file(int fd): + * if os.name == "nt": + * return _close(fd) # <<<<<<<<<<<<<< + * else: + * return close(fd) + */ + __pyx_r = _close(__pyx_v_fd); + goto __pyx_L0; + + /* "pyreadstat/_readstat_writer.pyx":541 + * + * cdef int close_file(int fd): + * if os.name == "nt": # <<<<<<<<<<<<<< + * return _close(fd) + * else: + */ + } + + /* "pyreadstat/_readstat_writer.pyx":544 * return _close(fd) - * ELSE: + * else: * return close(fd) # <<<<<<<<<<<<<< * * cdef int run_write(df, object filename_path, dst_file_format file_format, str file_label, object column_labels, */ - __pyx_r = close(__pyx_v_fd); - goto __pyx_L0; + /*else*/ { + __pyx_r = close(__pyx_v_fd); + goto __pyx_L0; + } - /* "pyreadstat/_readstat_writer.pyx":554 + /* "pyreadstat/_readstat_writer.pyx":540 * return fd * * cdef int close_file(int fd): # <<<<<<<<<<<<<< - * IF UNAME_SYSNAME == 'Windows': + * if os.name == "nt": * return _close(fd) */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pyreadstat._readstat_writer.close_file", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":560 +/* "pyreadstat/_readstat_writer.pyx":546 * return close(fd) * * cdef int run_write(df, object filename_path, dst_file_format file_format, str file_label, object column_labels, # <<<<<<<<<<<<<< @@ -9295,19 +10975,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); PyObject *__pyx_t_9 = NULL; - PyObject *(*__pyx_t_10)(PyObject *); - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - long __pyx_t_13; - PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + Py_ssize_t __pyx_t_12; + PyObject *(*__pyx_t_13)(PyObject *); + long __pyx_t_14; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; - int __pyx_t_18; + PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; char *__pyx_t_21; @@ -9315,21 +10995,20 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d int __pyx_t_23; int __pyx_t_24; int __pyx_t_25; - __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type __pyx_t_26; - int __pyx_t_27; + int __pyx_t_26; + __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type __pyx_t_27; char const *__pyx_t_28; readstat_type_t __pyx_t_29; char const *__pyx_t_30; - int __pyx_t_31; - char const *__pyx_t_32; - readstat_label_set_t *__pyx_t_33; - double __pyx_t_34; - int32_t __pyx_t_35; + char const *__pyx_t_31; + readstat_label_set_t *__pyx_t_32; + double __pyx_t_33; + int32_t __pyx_t_34; + char const *__pyx_t_35; char const *__pyx_t_36; - char const *__pyx_t_37; + PyObject *__pyx_t_37 = NULL; PyObject *__pyx_t_38 = NULL; PyObject *__pyx_t_39 = NULL; - PyObject *__pyx_t_40 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9337,33 +11016,34 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_v_filename_path); __Pyx_INCREF(__pyx_v_column_labels); - /* "pyreadstat/_readstat_writer.pyx":574 - * raise PyreadstatError("Writing API not supported on python 2 on windows") + /* "pyreadstat/_readstat_writer.pyx":556 + * """ * * if not isinstance(df, pd.DataFrame): # <<<<<<<<<<<<<< * raise PyreadstatError("first argument must be a pandas data frame") * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_v_df, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 574, __pyx_L1_error) + __pyx_t_3 = PyObject_IsInstance(__pyx_v_df, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); + __pyx_t_4 = (!__pyx_t_3); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":575 + /* "pyreadstat/_readstat_writer.pyx":557 * * if not isinstance(df, pd.DataFrame): * raise PyreadstatError("first argument must be a pandas data frame") # <<<<<<<<<<<<<< * * if variable_value_labels: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { @@ -9371,19 +11051,23 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_kp_s_first_argument_must_be_a_pandas) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_first_argument_must_be_a_pandas); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_kp_s_first_argument_must_be_a_pandas}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 575, __pyx_L1_error) + __PYX_ERR(0, 557, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":574 - * raise PyreadstatError("Writing API not supported on python 2 on windows") + /* "pyreadstat/_readstat_writer.pyx":556 + * """ * * if not isinstance(df, pd.DataFrame): # <<<<<<<<<<<<<< * raise PyreadstatError("first argument must be a pandas data frame") @@ -9391,17 +11075,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":577 + /* "pyreadstat/_readstat_writer.pyx":559 * raise PyreadstatError("first argument must be a pandas data frame") * * if variable_value_labels: # <<<<<<<<<<<<<< * for k,v in variable_value_labels.items(): * if type(v) != dict: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_value_labels); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_value_labels); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 559, __pyx_L1_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":578 + /* "pyreadstat/_readstat_writer.pyx":560 * * if variable_value_labels: * for k,v in variable_value_labels.items(): # <<<<<<<<<<<<<< @@ -9410,45 +11094,45 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 578, __pyx_L1_error) + __PYX_ERR(0, 560, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_variable_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_variable_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; - __pyx_t_7 = NULL; + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __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(0, 578, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 560, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (likely(!__pyx_t_7)) { + if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 560, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 560, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { - __pyx_t_2 = __pyx_t_7(__pyx_t_1); + __pyx_t_2 = __pyx_t_8(__pyx_t_1); 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, 578, __pyx_L1_error) + else __PYX_ERR(0, 560, __pyx_L1_error) } break; } @@ -9460,115 +11144,120 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 578, __pyx_L1_error) + __PYX_ERR(0, 560, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 560, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); + index = 0; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 578, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 560, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L8_unpacking_done; __pyx_L7_unpacking_failed:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 578, __pyx_L1_error) + __PYX_ERR(0, 560, __pyx_L1_error) __pyx_L8_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9); + __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":579 + /* "pyreadstat/_readstat_writer.pyx":561 * if variable_value_labels: * for k,v in variable_value_labels.items(): * if type(v) != dict: # <<<<<<<<<<<<<< * msg = "variable_value_labels: value for key %s must be dict, got %s" % (k, str(type(v))) * raise PyreadstatError(msg) */ - __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyDict_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_v)), ((PyObject *)(&PyDict_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":580 + /* "pyreadstat/_readstat_writer.pyx":562 * for k,v in variable_value_labels.items(): * if type(v) != dict: * msg = "variable_value_labels: value for key %s must be dict, got %s" % (k, str(type(v))) # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_v))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Str(((PyObject *)Py_TYPE(__pyx_v_v))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 580, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 562, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_k); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_value_for, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_variable_value_labels_value_for, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_msg = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":581 + /* "pyreadstat/_readstat_writer.pyx":563 * if type(v) != dict: * msg = "variable_value_labels: value for key %s must be dict, got %s" % (k, str(type(v))) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * if missing_user_values: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 581, __pyx_L1_error) + __PYX_ERR(0, 563, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":579 + /* "pyreadstat/_readstat_writer.pyx":561 * if variable_value_labels: * for k,v in variable_value_labels.items(): * if type(v) != dict: # <<<<<<<<<<<<<< @@ -9577,7 +11266,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":578 + /* "pyreadstat/_readstat_writer.pyx":560 * * if variable_value_labels: * for k,v in variable_value_labels.items(): # <<<<<<<<<<<<<< @@ -9587,7 +11276,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":577 + /* "pyreadstat/_readstat_writer.pyx":559 * raise PyreadstatError("first argument must be a pandas data frame") * * if variable_value_labels: # <<<<<<<<<<<<<< @@ -9596,17 +11285,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":583 + /* "pyreadstat/_readstat_writer.pyx":565 * raise PyreadstatError(msg) * * if missing_user_values: # <<<<<<<<<<<<<< * if file_format == FILE_FORMAT_DTA: * valid_user_missing = valid_user_missing_stata */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 583, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 565, __pyx_L1_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":584 + /* "pyreadstat/_readstat_writer.pyx":566 * * if missing_user_values: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -9616,7 +11305,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d switch (__pyx_v_file_format) { case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA: - /* "pyreadstat/_readstat_writer.pyx":585 + /* "pyreadstat/_readstat_writer.pyx":567 * if missing_user_values: * if file_format == FILE_FORMAT_DTA: * valid_user_missing = valid_user_missing_stata # <<<<<<<<<<<<<< @@ -9626,7 +11315,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_stata); __pyx_v_valid_user_missing = __pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_stata; - /* "pyreadstat/_readstat_writer.pyx":584 + /* "pyreadstat/_readstat_writer.pyx":566 * * if missing_user_values: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -9636,7 +11325,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAS7BDAT: - /* "pyreadstat/_readstat_writer.pyx":586 + /* "pyreadstat/_readstat_writer.pyx":568 * if file_format == FILE_FORMAT_DTA: * valid_user_missing = valid_user_missing_stata * elif file_format == FILE_FORMAT_SAS7BDAT or file_format == FILE_FORMAT_SAS7BCAT: # <<<<<<<<<<<<<< @@ -9645,7 +11334,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAS7BCAT: - /* "pyreadstat/_readstat_writer.pyx":587 + /* "pyreadstat/_readstat_writer.pyx":569 * valid_user_missing = valid_user_missing_stata * elif file_format == FILE_FORMAT_SAS7BDAT or file_format == FILE_FORMAT_SAS7BCAT: * valid_user_missing = valid_user_missing_sas # <<<<<<<<<<<<<< @@ -9655,7 +11344,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_sas); __pyx_v_valid_user_missing = __pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_sas; - /* "pyreadstat/_readstat_writer.pyx":586 + /* "pyreadstat/_readstat_writer.pyx":568 * if file_format == FILE_FORMAT_DTA: * valid_user_missing = valid_user_missing_stata * elif file_format == FILE_FORMAT_SAS7BDAT or file_format == FILE_FORMAT_SAS7BCAT: # <<<<<<<<<<<<<< @@ -9666,7 +11355,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d default: break; } - /* "pyreadstat/_readstat_writer.pyx":588 + /* "pyreadstat/_readstat_writer.pyx":570 * elif file_format == FILE_FORMAT_SAS7BDAT or file_format == FILE_FORMAT_SAS7BCAT: * valid_user_missing = valid_user_missing_sas * for key, missing_values in missing_user_values.items(): # <<<<<<<<<<<<<< @@ -9675,45 +11364,45 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_missing_user_values == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 588, __pyx_L1_error) + __PYX_ERR(0, 570, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_missing_user_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_missing_user_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; - __pyx_t_7 = NULL; + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 570, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_7)) { + if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 570, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 570, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_1 = __pyx_t_7(__pyx_t_2); + __pyx_t_1 = __pyx_t_8(__pyx_t_2); 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, 588, __pyx_L1_error) + else __PYX_ERR(0, 570, __pyx_L1_error) } break; } @@ -9725,52 +11414,52 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 588, __pyx_L1_error) + __PYX_ERR(0, 570, __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, 0); __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); } else { - __pyx_t_8 = PyList_GET_ITEM(sequence, 0); + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); __pyx_t_5 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_5); #else - __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 588, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 588, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L13_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); + index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 588, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L14_unpacking_done; - __pyx_L13_unpacking_failed:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = NULL; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 570, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L15_unpacking_done; + __pyx_L14_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, 588, __pyx_L1_error) - __pyx_L14_unpacking_done:; + __PYX_ERR(0, 570, __pyx_L1_error) + __pyx_L15_unpacking_done:; } - __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_9); + __pyx_t_9 = 0; __Pyx_XDECREF_SET(__pyx_v_missing_values, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":589 + /* "pyreadstat/_readstat_writer.pyx":571 * valid_user_missing = valid_user_missing_sas * for key, missing_values in missing_user_values.items(): * if not isinstance(missing_values, list): # <<<<<<<<<<<<<< @@ -9778,10 +11467,10 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * raise PyreadstatError(msg) */ __pyx_t_4 = PyList_Check(__pyx_v_missing_values); - __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0); + __pyx_t_3 = (!__pyx_t_4); if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":590 + /* "pyreadstat/_readstat_writer.pyx":572 * for key, missing_values in missing_user_values.items(): * if not isinstance(missing_values, list): * msg = "missing_user_values: values in dictionary must be list" # <<<<<<<<<<<<<< @@ -9791,35 +11480,40 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_kp_s_missing_user_values_values_in_di); __pyx_v_msg = __pyx_kp_s_missing_user_values_values_in_di; - /* "pyreadstat/_readstat_writer.pyx":591 + /* "pyreadstat/_readstat_writer.pyx":573 * if not isinstance(missing_values, list): * msg = "missing_user_values: values in dictionary must be list" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * for val in missing_values: * if val not in valid_user_missing: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = NULL; + __pyx_t_9 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_msg}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 591, __pyx_L1_error) + __PYX_ERR(0, 573, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":589 + /* "pyreadstat/_readstat_writer.pyx":571 * valid_user_missing = valid_user_missing_sas * for key, missing_values in missing_user_values.items(): * if not isinstance(missing_values, list): # <<<<<<<<<<<<<< @@ -9828,7 +11522,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":592 + /* "pyreadstat/_readstat_writer.pyx":574 * msg = "missing_user_values: values in dictionary must be list" * raise PyreadstatError(msg) * for val in missing_values: # <<<<<<<<<<<<<< @@ -9836,39 +11530,39 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * msg = "missing_user_values supports values a to z for Stata and A to Z and _ for SAS, got %s instead" % str(val) */ if (likely(PyList_CheckExact(__pyx_v_missing_values)) || PyTuple_CheckExact(__pyx_v_missing_values)) { - __pyx_t_1 = __pyx_v_missing_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; - __pyx_t_12 = NULL; + __pyx_t_1 = __pyx_v_missing_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; + __pyx_t_13 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 574, __pyx_L1_error) } for (;;) { - if (likely(!__pyx_t_12)) { + if (likely(!__pyx_t_13)) { if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_12 >= 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_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 574, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_12 >= 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_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 574, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { - __pyx_t_5 = __pyx_t_12(__pyx_t_1); + __pyx_t_5 = __pyx_t_13(__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, 592, __pyx_L1_error) + else __PYX_ERR(0, 574, __pyx_L1_error) } break; } @@ -9877,62 +11571,66 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":593 + /* "pyreadstat/_readstat_writer.pyx":575 * raise PyreadstatError(msg) * for val in missing_values: * if val not in valid_user_missing: # <<<<<<<<<<<<<< * msg = "missing_user_values supports values a to z for Stata and A to Z and _ for SAS, got %s instead" % str(val) * raise PyreadstatError(msg) */ - if (unlikely(!__pyx_v_valid_user_missing)) { __Pyx_RaiseUnboundLocalError("valid_user_missing"); __PYX_ERR(0, 593, __pyx_L1_error) } - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_val, __pyx_v_valid_user_missing, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 593, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (unlikely(__pyx_t_4)) { + if (unlikely(!__pyx_v_valid_user_missing)) { __Pyx_RaiseUnboundLocalError("valid_user_missing"); __PYX_ERR(0, 575, __pyx_L1_error) } + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_val, __pyx_v_valid_user_missing, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 575, __pyx_L1_error) + if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":594 + /* "pyreadstat/_readstat_writer.pyx":576 * for val in missing_values: * if val not in valid_user_missing: * msg = "missing_user_values supports values a to z for Stata and A to Z and _ for SAS, got %s instead" % str(val) # <<<<<<<<<<<<<< * raise PyreadstatError(msg) * */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_val); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Str(__pyx_v_val); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 576, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyString_FormatSafe(__pyx_kp_s_missing_user_values_supports_val, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 594, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyString_FormatSafe(__pyx_kp_s_missing_user_values_supports_val, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_msg = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_msg = __pyx_t_9; + __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":595 + /* "pyreadstat/_readstat_writer.pyx":577 * if val not in valid_user_missing: * msg = "missing_user_values supports values a to z for Stata and A to Z and _ for SAS, got %s instead" % str(val) * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * cdef readstat_error_t retcode */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = NULL; + __pyx_t_10 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_9)) { + __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_9); + __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 595, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_msg}; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(0, 577, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":593 + /* "pyreadstat/_readstat_writer.pyx":575 * raise PyreadstatError(msg) * for val in missing_values: * if val not in valid_user_missing: # <<<<<<<<<<<<<< @@ -9941,7 +11639,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":592 + /* "pyreadstat/_readstat_writer.pyx":574 * msg = "missing_user_values: values in dictionary must be list" * raise PyreadstatError(msg) * for val in missing_values: # <<<<<<<<<<<<<< @@ -9951,7 +11649,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":588 + /* "pyreadstat/_readstat_writer.pyx":570 * elif file_format == FILE_FORMAT_SAS7BDAT or file_format == FILE_FORMAT_SAS7BCAT: * valid_user_missing = valid_user_missing_sas * for key, missing_values in missing_user_values.items(): # <<<<<<<<<<<<<< @@ -9961,7 +11659,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":583 + /* "pyreadstat/_readstat_writer.pyx":565 * raise PyreadstatError(msg) * * if missing_user_values: # <<<<<<<<<<<<<< @@ -9970,41 +11668,46 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":606 + /* "pyreadstat/_readstat_writer.pyx":588 * cdef char *file_labl * * cdef list col_names = df.columns.values.tolist() # <<<<<<<<<<<<<< * if len(col_names) != len(set(col_names)): * msg = "Non unique column names detected in the dataframe!" */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_values); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_tolist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_tolist); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_8)) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 606, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_9, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_2))) __PYX_ERR(0, 588, __pyx_L1_error) __pyx_v_col_names = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":607 + /* "pyreadstat/_readstat_writer.pyx":589 * * cdef list col_names = df.columns.values.tolist() * if len(col_names) != len(set(col_names)): # <<<<<<<<<<<<<< @@ -10013,17 +11716,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 607, __pyx_L1_error) + __PYX_ERR(0, 589, __pyx_L1_error) } - __pyx_t_6 = PyList_GET_SIZE(__pyx_v_col_names); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 607, __pyx_L1_error) - __pyx_t_2 = PySet_New(__pyx_v_col_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) + __pyx_t_7 = PyList_GET_SIZE(__pyx_v_col_names); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_t_2 = PySet_New(__pyx_v_col_names); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PySet_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 607, __pyx_L1_error) + __pyx_t_12 = PySet_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = ((__pyx_t_6 != __pyx_t_11) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_3 = (__pyx_t_7 != __pyx_t_12); + if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":608 + /* "pyreadstat/_readstat_writer.pyx":590 * cdef list col_names = df.columns.values.tolist() * if len(col_names) != len(set(col_names)): * msg = "Non unique column names detected in the dataframe!" # <<<<<<<<<<<<<< @@ -10033,35 +11736,40 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_kp_s_Non_unique_column_names_detected); __pyx_v_msg = __pyx_kp_s_Non_unique_column_names_detected; - /* "pyreadstat/_readstat_writer.pyx":609 + /* "pyreadstat/_readstat_writer.pyx":591 * if len(col_names) != len(set(col_names)): * msg = "Non unique column names detected in the dataframe!" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * * for variable_name in col_names: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = NULL; + __pyx_t_9 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_8)) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 609, __pyx_L1_error) + __PYX_ERR(0, 591, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":607 + /* "pyreadstat/_readstat_writer.pyx":589 * * cdef list col_names = df.columns.values.tolist() * if len(col_names) != len(set(col_names)): # <<<<<<<<<<<<<< @@ -10070,7 +11778,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":611 + /* "pyreadstat/_readstat_writer.pyx":593 * raise PyreadstatError(msg) * * for variable_name in col_names: # <<<<<<<<<<<<<< @@ -10079,75 +11787,80 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 611, __pyx_L1_error) + __PYX_ERR(0, 593, __pyx_L1_error) } - __pyx_t_2 = __pyx_v_col_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_11 = 0; + __pyx_t_2 = __pyx_v_col_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_12 = 0; for (;;) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 611, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 593, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif __Pyx_XDECREF_SET(__pyx_v_variable_name, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":612 + /* "pyreadstat/_readstat_writer.pyx":594 * * for variable_name in col_names: * if type(variable_name) != str: # <<<<<<<<<<<<<< * raise PyreadstatError("variable name '%s' is of type %s and it must be str (not starting with numbers!)" % (variable_name, str(type(variable_name)))) * if not variable_name[0].isalpha(): */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_variable_name)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 612, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_variable_name)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_t_4)) { + if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":613 + /* "pyreadstat/_readstat_writer.pyx":595 * for variable_name in col_names: * if type(variable_name) != str: * raise PyreadstatError("variable name '%s' is of type %s and it must be str (not starting with numbers!)" % (variable_name, str(type(variable_name)))) # <<<<<<<<<<<<<< * if not variable_name[0].isalpha(): * raise PyreadstatError("variable name '%s' starts with an illegal (non-alphabetic) character: '%s' (ordinal %s)" % (variable_name, variable_name[0], ord(variable_name[0]))) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_variable_name))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 613, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_Str(((PyObject *)Py_TYPE(__pyx_v_variable_name))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_variable_name); __Pyx_GIVEREF(__pyx_v_variable_name); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_variable_name); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_variable_name); __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_variable_name_s_is_of_type_s_and, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 613, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_variable_name_s_is_of_type_s_and, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_6 = 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_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 613, __pyx_L1_error) + __PYX_ERR(0, 595, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":612 + /* "pyreadstat/_readstat_writer.pyx":594 * * for variable_name in col_names: * if type(variable_name) != str: # <<<<<<<<<<<<<< @@ -10156,90 +11869,100 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":614 + /* "pyreadstat/_readstat_writer.pyx":596 * if type(variable_name) != str: * raise PyreadstatError("variable name '%s' is of type %s and it must be str (not starting with numbers!)" % (variable_name, str(type(variable_name)))) * if not variable_name[0].isalpha(): # <<<<<<<<<<<<<< * raise PyreadstatError("variable name '%s' starts with an illegal (non-alphabetic) character: '%s' (ordinal %s)" % (variable_name, variable_name[0], ord(variable_name[0]))) * if " " in variable_name: */ - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_variable_name, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_isalpha); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_variable_name, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_isalpha); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 614, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_9, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = ((!__pyx_t_4) != 0); - if (unlikely(__pyx_t_3)) { + __pyx_t_4 = (!__pyx_t_3); + if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":615 + /* "pyreadstat/_readstat_writer.pyx":597 * raise PyreadstatError("variable name '%s' is of type %s and it must be str (not starting with numbers!)" % (variable_name, str(type(variable_name)))) * if not variable_name[0].isalpha(): * raise PyreadstatError("variable name '%s' starts with an illegal (non-alphabetic) character: '%s' (ordinal %s)" % (variable_name, variable_name[0], ord(variable_name[0]))) # <<<<<<<<<<<<<< * if " " in variable_name: * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 615, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_variable_name, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_variable_name, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 615, __pyx_L1_error) + __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_variable_name, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_13 = __Pyx_PyObject_Ord(__pyx_t_9); if (unlikely(__pyx_t_13 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_variable_name, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = __Pyx_PyObject_Ord(__pyx_t_10); if (unlikely(__pyx_t_14 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_v_variable_name); __Pyx_GIVEREF(__pyx_v_variable_name); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_variable_name); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_variable_name); __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_9); - __pyx_t_8 = 0; + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_10); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_variable_name_s_starts_with_an_i, __pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = NULL; + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_variable_name_s_starts_with_an_i, __pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_14)) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_14, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_10}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 615, __pyx_L1_error) + __PYX_ERR(0, 597, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":614 + /* "pyreadstat/_readstat_writer.pyx":596 * if type(variable_name) != str: * raise PyreadstatError("variable name '%s' is of type %s and it must be str (not starting with numbers!)" % (variable_name, str(type(variable_name)))) * if not variable_name[0].isalpha(): # <<<<<<<<<<<<<< @@ -10248,50 +11971,54 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":616 + /* "pyreadstat/_readstat_writer.pyx":598 * if not variable_name[0].isalpha(): * raise PyreadstatError("variable name '%s' starts with an illegal (non-alphabetic) character: '%s' (ordinal %s)" % (variable_name, variable_name[0], ord(variable_name[0]))) * if " " in variable_name: # <<<<<<<<<<<<<< * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) * */ - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__2, __pyx_v_variable_name, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 616, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); + __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__2, __pyx_v_variable_name, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 598, __pyx_L1_error) if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":617 + /* "pyreadstat/_readstat_writer.pyx":599 * raise PyreadstatError("variable name '%s' starts with an illegal (non-alphabetic) character: '%s' (ordinal %s)" % (variable_name, variable_name[0], ord(variable_name[0]))) * if " " in variable_name: * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) # <<<<<<<<<<<<<< * * if file_format == FILE_FORMAT_POR: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyString_FormatSafe(__pyx_kp_s_variable_name_s_contains_a_space, __pyx_v_variable_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = NULL; + __pyx_t_10 = __Pyx_PyString_FormatSafe(__pyx_kp_s_variable_name_s_contains_a_space, __pyx_v_variable_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_14)) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_14, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 617, __pyx_L1_error) - - /* "pyreadstat/_readstat_writer.pyx":616 - * if not variable_name[0].isalpha(): + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_10}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 599, __pyx_L1_error) + + /* "pyreadstat/_readstat_writer.pyx":598 + * if not variable_name[0].isalpha(): * raise PyreadstatError("variable name '%s' starts with an illegal (non-alphabetic) character: '%s' (ordinal %s)" % (variable_name, variable_name[0], ord(variable_name[0]))) * if " " in variable_name: # <<<<<<<<<<<<<< * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) @@ -10299,7 +12026,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":611 + /* "pyreadstat/_readstat_writer.pyx":593 * raise PyreadstatError(msg) * * for variable_name in col_names: # <<<<<<<<<<<<<< @@ -10309,65 +12036,70 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":619 + /* "pyreadstat/_readstat_writer.pyx":601 * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) * * if file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< * col_names = [x.upper() for x in col_names] * */ - __pyx_t_4 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR) != 0); + __pyx_t_4 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":620 + /* "pyreadstat/_readstat_writer.pyx":602 * * if file_format == FILE_FORMAT_POR: * col_names = [x.upper() for x in col_names] # <<<<<<<<<<<<<< * * cdef list col_types = get_pandas_column_types(df, missing_user_values, variable_value_labels) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 620, __pyx_L1_error) + __PYX_ERR(0, 602, __pyx_L1_error) } - __pyx_t_1 = __pyx_v_col_names; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; + __pyx_t_1 = __pyx_v_col_names; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; for (;;) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_12 >= 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_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 602, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_upper); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_9); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); - __Pyx_INCREF(__pyx_t_14); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_upper); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_9, function); + __Pyx_DECREF_SET(__pyx_t_10, function); + __pyx_t_6 = 1; } } - __pyx_t_5 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 620, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 620, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_15, }; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 602, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 602, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_col_names, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":619 + /* "pyreadstat/_readstat_writer.pyx":601 * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) * * if file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -10376,29 +12108,29 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":622 + /* "pyreadstat/_readstat_writer.pyx":604 * col_names = [x.upper() for x in col_names] * * cdef list col_types = get_pandas_column_types(df, missing_user_values, variable_value_labels) # <<<<<<<<<<<<<< * cdef int row_count = len(df) * cdef int col_count = len(col_names) */ - __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types(__pyx_v_df, __pyx_v_missing_user_values, __pyx_v_variable_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error) + __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types(__pyx_v_df, __pyx_v_missing_user_values, __pyx_v_variable_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_col_types = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":623 + /* "pyreadstat/_readstat_writer.pyx":605 * * cdef list col_types = get_pandas_column_types(df, missing_user_values, variable_value_labels) * cdef int row_count = len(df) # <<<<<<<<<<<<<< * cdef int col_count = len(col_names) * cdef dict col_names_to_types = {k:v[0] for k,v in zip(col_names, col_types)} */ - __pyx_t_11 = PyObject_Length(__pyx_v_df); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 623, __pyx_L1_error) - __pyx_v_row_count = __pyx_t_11; + __pyx_t_12 = PyObject_Length(__pyx_v_df); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 605, __pyx_L1_error) + __pyx_v_row_count = __pyx_t_12; - /* "pyreadstat/_readstat_writer.pyx":624 + /* "pyreadstat/_readstat_writer.pyx":606 * cdef list col_types = get_pandas_column_types(df, missing_user_values, variable_value_labels) * cdef int row_count = len(df) * cdef int col_count = len(col_names) # <<<<<<<<<<<<<< @@ -10407,12 +12139,12 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 624, __pyx_L1_error) + __PYX_ERR(0, 606, __pyx_L1_error) } - __pyx_t_11 = PyList_GET_SIZE(__pyx_v_col_names); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 624, __pyx_L1_error) - __pyx_v_col_count = __pyx_t_11; + __pyx_t_12 = PyList_GET_SIZE(__pyx_v_col_names); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 606, __pyx_L1_error) + __pyx_v_col_count = __pyx_t_12; - /* "pyreadstat/_readstat_writer.pyx":625 + /* "pyreadstat/_readstat_writer.pyx":607 * cdef int row_count = len(df) * cdef int col_count = len(col_names) * cdef dict col_names_to_types = {k:v[0] for k,v in zip(col_names, col_types)} # <<<<<<<<<<<<<< @@ -10420,9 +12152,9 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * cdef readstat_variable_t *variable */ { /* enter inner scope */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_col_names); __Pyx_GIVEREF(__pyx_v_col_names); @@ -10430,44 +12162,44 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_v_col_types); __Pyx_GIVEREF(__pyx_v_col_types); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_col_types); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; - __pyx_t_7 = NULL; + __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 607, __pyx_L35_error) } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { - if (likely(!__pyx_t_7)) { + if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_12 >= 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_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 607, __pyx_L35_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_12 >= 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_11); __Pyx_INCREF(__pyx_t_5); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_5); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 607, __pyx_L35_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L30_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { - __pyx_t_5 = __pyx_t_7(__pyx_t_1); + __pyx_t_5 = __pyx_t_8(__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, 625, __pyx_L30_error) + else __PYX_ERR(0, 607, __pyx_L35_error) } break; } @@ -10479,69 +12211,69 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 625, __pyx_L30_error) + __PYX_ERR(0, 607, __pyx_L35_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); } else { - __pyx_t_9 = PyList_GET_ITEM(sequence, 0); - __pyx_t_14 = PyList_GET_ITEM(sequence, 1); + __pyx_t_10 = PyList_GET_ITEM(sequence, 0); + __pyx_t_15 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_15); #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 625, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 625, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 607, __pyx_L35_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 607, __pyx_L35_error) + __Pyx_GOTREF(__pyx_t_15); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; - __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 625, __pyx_L30_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; - index = 0; __pyx_t_9 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L33_unpacking_failed; + __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_9); - index = 1; __pyx_t_14 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_14)) goto __pyx_L33_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 625, __pyx_L30_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L34_unpacking_done; - __pyx_L33_unpacking_failed:; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); + index = 0; __pyx_t_10 = __pyx_t_11(__pyx_t_9); if (unlikely(!__pyx_t_10)) goto __pyx_L38_unpacking_failed; + __Pyx_GOTREF(__pyx_t_10); + index = 1; __pyx_t_15 = __pyx_t_11(__pyx_t_9); if (unlikely(!__pyx_t_15)) goto __pyx_L38_unpacking_failed; + __Pyx_GOTREF(__pyx_t_15); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_9), 2) < 0) __PYX_ERR(0, 607, __pyx_L35_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L39_unpacking_done; + __pyx_L38_unpacking_failed:; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 625, __pyx_L30_error) - __pyx_L34_unpacking_done:; + __PYX_ERR(0, 607, __pyx_L35_error) + __pyx_L39_unpacking_done:; } - __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_9); - __pyx_t_9 = 0; - __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_14); - __pyx_t_14 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_7genexpr__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L30_error) + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_10); + __pyx_t_10 = 0; + __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_7genexpr__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_GOTREF(__pyx_t_5); - if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 625, __pyx_L30_error) + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 607, __pyx_L35_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; - goto __pyx_L35_exit_scope; - __pyx_L30_error:; + goto __pyx_L41_exit_scope; + __pyx_L35_error:; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; goto __pyx_L1_error; - __pyx_L35_exit_scope:; + __pyx_L41_exit_scope:; } /* exit inner scope */ __pyx_v_col_names_to_types = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":634 + /* "pyreadstat/_readstat_writer.pyx":616 * cdef int col_indx * cdef bytes cur_col_label * cdef int col_label_count = 0 # <<<<<<<<<<<<<< @@ -10550,7 +12282,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_col_label_count = 0; - /* "pyreadstat/_readstat_writer.pyx":643 + /* "pyreadstat/_readstat_writer.pyx":625 * cdef object values * cdef dict value_labels * cdef int lblset_cnt = 0 # <<<<<<<<<<<<<< @@ -10559,21 +12291,20 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_lblset_cnt = 0; - /* "pyreadstat/_readstat_writer.pyx":651 + /* "pyreadstat/_readstat_writer.pyx":633 * cdef float mulfac * * if hasattr(os, 'fsencode'): # <<<<<<<<<<<<<< * try: * filename_path = os.fsencode(filename_path) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 651, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_fsencode); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 651, __pyx_L1_error) + __pyx_t_4 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_s_fsencode); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = (__pyx_t_4 != 0); - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":652 + /* "pyreadstat/_readstat_writer.pyx":634 * * if hasattr(os, 'fsencode'): * try: # <<<<<<<<<<<<<< @@ -10583,25 +12314,26 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_15); + __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_18); /*try:*/ { - /* "pyreadstat/_readstat_writer.pyx":653 + /* "pyreadstat/_readstat_writer.pyx":635 * if hasattr(os, 'fsencode'): * try: * filename_path = os.fsencode(filename_path) # <<<<<<<<<<<<<< * except UnicodeError: * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L37_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L37_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L43_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_1)) { @@ -10609,17 +12341,21 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_filename_path); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L37_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_filename_path}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L43_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF_SET(__pyx_v_filename_path, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":652 + /* "pyreadstat/_readstat_writer.pyx":634 * * if hasattr(os, 'fsencode'): * try: # <<<<<<<<<<<<<< @@ -10627,51 +12363,52 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * except UnicodeError: */ } - __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_L42_try_end; - __pyx_L37_error:; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + goto __pyx_L48_try_end; + __pyx_L43_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":654 + /* "pyreadstat/_readstat_writer.pyx":636 * try: * filename_path = os.fsencode(filename_path) * except UnicodeError: # <<<<<<<<<<<<<< * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") */ - __pyx_t_18 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeError); - if (__pyx_t_18) { + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeError); + if (__pyx_t_6) { __Pyx_AddTraceback("pyreadstat._readstat_writer.run_write", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 654, __pyx_L39_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 636, __pyx_L45_except_error) + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_1); - /* "pyreadstat/_readstat_writer.pyx":655 + /* "pyreadstat/_readstat_writer.pyx":637 * filename_path = os.fsencode(filename_path) * except UnicodeError: * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) # <<<<<<<<<<<<<< * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_warnings); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 655, __pyx_L39_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_warnings); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 637, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_warn); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 637, __pyx_L45_except_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_warn); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 655, __pyx_L39_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_sys); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 655, __pyx_L39_except_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_sys); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 637, __pyx_L45_except_error) __Pyx_GOTREF(__pyx_t_19); - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 655, __pyx_L39_except_error) + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 637, __pyx_L45_except_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __pyx_t_19 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_20); if (likely(__pyx_t_19)) { @@ -10679,130 +12416,145 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_20, function); + __pyx_t_6 = 1; } } - __pyx_t_9 = (__pyx_t_19) ? __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_19) : __Pyx_PyObject_CallNoArg(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 655, __pyx_L39_except_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_t_20 = __Pyx_PyString_FormatSafe(__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_t_9); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 655, __pyx_L39_except_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_19, }; + __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_20, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 637, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __pyx_t_20 = __Pyx_PyString_FormatSafe(__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_t_10); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 637, __pyx_L45_except_error) __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_6 = 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_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_6 = 1; } } - __pyx_t_14 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_20) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_20); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 655, __pyx_L39_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_20}; + __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 637, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "pyreadstat/_readstat_writer.pyx":656 + /* "pyreadstat/_readstat_writer.pyx":638 * except UnicodeError: * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") # <<<<<<<<<<<<<< * else: - * IF PY_MAJOR_VERSION >2: + * if type(filename_path) == str: */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_os); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 656, __pyx_L39_except_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_fsdecode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 656, __pyx_L39_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_os); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 638, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_fsdecode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 638, __pyx_L45_except_error) __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_20); - if (likely(__pyx_t_8)) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_20); + if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_20, function); + __pyx_t_6 = 1; } } - __pyx_t_14 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_8, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_v_filename_path); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 656, __pyx_L39_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_encode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 656, __pyx_L39_except_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_filename_path}; + __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_20, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 638, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + } + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_encode); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 638, __pyx_L45_except_error) __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 656, __pyx_L39_except_error) - __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 638, __pyx_L45_except_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_v_filename_bytes = __pyx_t_14; - __pyx_t_14 = 0; + __pyx_v_filename_bytes = __pyx_t_15; + __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L38_exception_handled; + goto __pyx_L44_exception_handled; } - goto __pyx_L39_except_error; - __pyx_L39_except_error:; + goto __pyx_L45_except_error; - /* "pyreadstat/_readstat_writer.pyx":652 + /* "pyreadstat/_readstat_writer.pyx":634 * * if hasattr(os, 'fsencode'): * try: # <<<<<<<<<<<<<< * filename_path = os.fsencode(filename_path) * except UnicodeError: */ - __Pyx_XGIVEREF(__pyx_t_15); + __pyx_L45_except_error:; __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); goto __pyx_L1_error; - __pyx_L38_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_15); + __pyx_L44_exception_handled:; __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); - __pyx_L42_try_end:; + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); + __pyx_L48_try_end:; } - /* "pyreadstat/_readstat_writer.pyx":651 + /* "pyreadstat/_readstat_writer.pyx":633 * cdef float mulfac * * if hasattr(os, 'fsencode'): # <<<<<<<<<<<<<< * try: * filename_path = os.fsencode(filename_path) */ - goto __pyx_L36; + goto __pyx_L42; } - /* "pyreadstat/_readstat_writer.pyx":659 + /* "pyreadstat/_readstat_writer.pyx":640 + * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") * else: - * IF PY_MAJOR_VERSION >2: - * if type(filename_path) == str: # <<<<<<<<<<<<<< - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: + * if type(filename_path) == str: # <<<<<<<<<<<<<< + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: */ /*else*/ { - __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 659, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 640, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":660 - * IF PY_MAJOR_VERSION >2: - * if type(filename_path) == str: - * filename_bytes = filename_path.encode('utf-8') # <<<<<<<<<<<<<< - * elif type(filename_path) == bytes: - * filename_bytes = filename_path + /* "pyreadstat/_readstat_writer.pyx":641 + * else: + * if type(filename_path) == str: + * filename_bytes = filename_path.encode('utf-8') # <<<<<<<<<<<<<< + * elif type(filename_path) == bytes: + * filename_bytes = filename_path */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 660, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_filename_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { @@ -10810,69 +12562,74 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_s_utf_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __pyx_v_filename_bytes = __pyx_t_1; __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":659 + /* "pyreadstat/_readstat_writer.pyx":640 + * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") * else: - * IF PY_MAJOR_VERSION >2: - * if type(filename_path) == str: # <<<<<<<<<<<<<< - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: + * if type(filename_path) == str: # <<<<<<<<<<<<<< + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: */ - goto __pyx_L45; + goto __pyx_L51; } - /* "pyreadstat/_readstat_writer.pyx":661 - * if type(filename_path) == str: - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< - * filename_bytes = filename_path - * else: + /* "pyreadstat/_readstat_writer.pyx":642 + * if type(filename_path) == str: + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< + * filename_bytes = filename_path + * else: */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyBytes_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 661, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_filename_path)), ((PyObject *)(&PyBytes_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(__pyx_t_3)) { + if (likely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":662 - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: - * filename_bytes = filename_path # <<<<<<<<<<<<<< - * else: - * raise PyreadstatError("path must be either str or bytes") + /* "pyreadstat/_readstat_writer.pyx":643 + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: + * filename_bytes = filename_path # <<<<<<<<<<<<<< + * else: + * raise PyreadstatError("path must be either str or bytes") */ __Pyx_INCREF(__pyx_v_filename_path); __pyx_v_filename_bytes = __pyx_v_filename_path; - /* "pyreadstat/_readstat_writer.pyx":661 - * if type(filename_path) == str: - * filename_bytes = filename_path.encode('utf-8') - * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< - * filename_bytes = filename_path - * else: + /* "pyreadstat/_readstat_writer.pyx":642 + * if type(filename_path) == str: + * filename_bytes = filename_path.encode('utf-8') + * elif type(filename_path) == bytes: # <<<<<<<<<<<<<< + * filename_bytes = filename_path + * else: */ - goto __pyx_L45; + goto __pyx_L51; } - /* "pyreadstat/_readstat_writer.pyx":664 - * filename_bytes = filename_path - * else: - * raise PyreadstatError("path must be either str or bytes") # <<<<<<<<<<<<<< - * ELSE: - * if type(filename_path) not in (str, bytes, unicode): + /* "pyreadstat/_readstat_writer.pyx":645 + * filename_bytes = filename_path + * else: + * raise PyreadstatError("path must be either str or bytes") # <<<<<<<<<<<<<< + * + * filename_path = os.path.expanduser(filename_path) */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { @@ -10880,37 +12637,42 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_kp_s_path_must_be_either_str_or_bytes) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_path_must_be_either_str_or_bytes); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_s_path_must_be_either_str_or_bytes}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 664, __pyx_L1_error) + __PYX_ERR(0, 645, __pyx_L1_error) } - __pyx_L45:; + __pyx_L51:; } - __pyx_L36:; + __pyx_L42:; - /* "pyreadstat/_readstat_writer.pyx":670 - * filename_bytes = filename_path.encode('utf-8') + /* "pyreadstat/_readstat_writer.pyx":647 + * raise PyreadstatError("path must be either str or bytes") * * filename_path = os.path.expanduser(filename_path) # <<<<<<<<<<<<<< * cdef int fd = open_file(filename_path) * writer = readstat_writer_init() */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 670, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 670, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 670, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { @@ -10918,27 +12680,32 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_filename_path); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_filename_path}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF_SET(__pyx_v_filename_path, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":671 + /* "pyreadstat/_readstat_writer.pyx":648 * * filename_path = os.path.expanduser(filename_path) * cdef int fd = open_file(filename_path) # <<<<<<<<<<<<<< * writer = readstat_writer_init() * */ - if (!(likely(PyBytes_CheckExact(__pyx_v_filename_path))||((__pyx_v_filename_path) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_filename_path)->tp_name), 0))) __PYX_ERR(0, 671, __pyx_L1_error) - __pyx_v_fd = __pyx_f_10pyreadstat_16_readstat_writer_open_file(((PyObject*)__pyx_v_filename_path)); + if (!(likely(PyBytes_CheckExact(__pyx_v_filename_path))||((__pyx_v_filename_path) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_filename_path))) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_t_6 = __pyx_f_10pyreadstat_16_readstat_writer_open_file(((PyObject*)__pyx_v_filename_path)); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_v_fd = __pyx_t_6; - /* "pyreadstat/_readstat_writer.pyx":672 + /* "pyreadstat/_readstat_writer.pyx":649 * filename_path = os.path.expanduser(filename_path) * cdef int fd = open_file(filename_path) * writer = readstat_writer_init() # <<<<<<<<<<<<<< @@ -10947,7 +12714,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_writer = readstat_writer_init(); - /* "pyreadstat/_readstat_writer.pyx":674 + /* "pyreadstat/_readstat_writer.pyx":651 * writer = readstat_writer_init() * * try: # <<<<<<<<<<<<<< @@ -10958,45 +12725,45 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15); + __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16); + __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_15); /*try:*/ { - /* "pyreadstat/_readstat_writer.pyx":676 + /* "pyreadstat/_readstat_writer.pyx":653 * try: * * check_exit_status(readstat_set_data_writer(writer, write_bytes)) # <<<<<<<<<<<<<< * * if file_label: */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_data_writer(__pyx_v_writer, __pyx_f_10pyreadstat_16_readstat_writer_write_bytes)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_set_data_writer(__pyx_v_writer, __pyx_f_10pyreadstat_16_readstat_writer_write_bytes)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 653, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":678 + /* "pyreadstat/_readstat_writer.pyx":655 * check_exit_status(readstat_set_data_writer(writer, write_bytes)) * * if file_label: # <<<<<<<<<<<<<< * file_label_bytes = file_label.encode("utf-8") * file_labl = file_label_bytes */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_file_label); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 678, __pyx_L49_error) - if (__pyx_t_3) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_file_label); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 655, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":679 + /* "pyreadstat/_readstat_writer.pyx":656 * * if file_label: * file_label_bytes = file_label.encode("utf-8") # <<<<<<<<<<<<<< * file_labl = file_label_bytes * check_exit_status(readstat_writer_set_file_label(writer, file_labl)) */ - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_file_label, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L49_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_file_label, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 679, __pyx_L49_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_1))) __PYX_ERR(0, 656, __pyx_L55_error) __pyx_v_file_label_bytes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":680 + /* "pyreadstat/_readstat_writer.pyx":657 * if file_label: * file_label_bytes = file_label.encode("utf-8") * file_labl = file_label_bytes # <<<<<<<<<<<<<< @@ -11005,21 +12772,21 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_file_label_bytes == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 680, __pyx_L49_error) + __PYX_ERR(0, 657, __pyx_L55_error) } - __pyx_t_21 = __Pyx_PyBytes_AsWritableString(__pyx_v_file_label_bytes); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 680, __pyx_L49_error) + __pyx_t_21 = __Pyx_PyBytes_AsWritableString(__pyx_v_file_label_bytes); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L55_error) __pyx_v_file_labl = ((char *)__pyx_t_21); - /* "pyreadstat/_readstat_writer.pyx":681 + /* "pyreadstat/_readstat_writer.pyx":658 * file_label_bytes = file_label.encode("utf-8") * file_labl = file_label_bytes * check_exit_status(readstat_writer_set_file_label(writer, file_labl)) # <<<<<<<<<<<<<< * * if note: */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_file_label(__pyx_v_writer, __pyx_v_file_labl)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 681, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_file_label(__pyx_v_writer, __pyx_v_file_labl)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":678 + /* "pyreadstat/_readstat_writer.pyx":655 * check_exit_status(readstat_set_data_writer(writer, write_bytes)) * * if file_label: # <<<<<<<<<<<<<< @@ -11028,30 +12795,30 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":683 + /* "pyreadstat/_readstat_writer.pyx":660 * check_exit_status(readstat_writer_set_file_label(writer, file_labl)) * * if note: # <<<<<<<<<<<<<< * readstat_add_note(writer, note.encode("utf-8")) * */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_note); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 683, __pyx_L49_error) - if (__pyx_t_3) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_note); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 660, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":684 + /* "pyreadstat/_readstat_writer.pyx":661 * * if note: * readstat_add_note(writer, note.encode("utf-8")) # <<<<<<<<<<<<<< * * if file_format_version > -1: */ - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_note, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L49_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_note, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_22 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) __PYX_ERR(0, 684, __pyx_L49_error) + __pyx_t_22 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L55_error) readstat_add_note(__pyx_v_writer, __pyx_t_22); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":683 + /* "pyreadstat/_readstat_writer.pyx":660 * check_exit_status(readstat_writer_set_file_label(writer, file_labl)) * * if note: # <<<<<<<<<<<<<< @@ -11060,26 +12827,26 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":686 + /* "pyreadstat/_readstat_writer.pyx":663 * readstat_add_note(writer, note.encode("utf-8")) * * if file_format_version > -1: # <<<<<<<<<<<<<< * check_exit_status(readstat_writer_set_file_format_version(writer, file_format_version)) * */ - __pyx_t_3 = ((__pyx_v_file_format_version > -1L) != 0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_file_format_version > -1L); + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":687 + /* "pyreadstat/_readstat_writer.pyx":664 * * if file_format_version > -1: * check_exit_status(readstat_writer_set_file_format_version(writer, file_format_version)) # <<<<<<<<<<<<<< * * if row_compression: */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_file_format_version(__pyx_v_writer, __pyx_v_file_format_version)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_file_format_version(__pyx_v_writer, __pyx_v_file_format_version)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":686 + /* "pyreadstat/_readstat_writer.pyx":663 * readstat_add_note(writer, note.encode("utf-8")) * * if file_format_version > -1: # <<<<<<<<<<<<<< @@ -11088,26 +12855,25 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":689 + /* "pyreadstat/_readstat_writer.pyx":666 * check_exit_status(readstat_writer_set_file_format_version(writer, file_format_version)) * * if row_compression: # <<<<<<<<<<<<<< * check_exit_status(readstat_writer_set_compression(writer, READSTAT_COMPRESS_ROWS)) * */ - __pyx_t_3 = (__pyx_v_row_compression != 0); - if (__pyx_t_3) { + if (__pyx_v_row_compression) { - /* "pyreadstat/_readstat_writer.pyx":690 + /* "pyreadstat/_readstat_writer.pyx":667 * * if row_compression: * check_exit_status(readstat_writer_set_compression(writer, READSTAT_COMPRESS_ROWS)) # <<<<<<<<<<<<<< * * # table name is used only for xpt files */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_compression(__pyx_v_writer, READSTAT_COMPRESS_ROWS)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_compression(__pyx_v_writer, READSTAT_COMPRESS_ROWS)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":689 + /* "pyreadstat/_readstat_writer.pyx":666 * check_exit_status(readstat_writer_set_file_format_version(writer, file_format_version)) * * if row_compression: # <<<<<<<<<<<<<< @@ -11116,48 +12882,48 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":693 + /* "pyreadstat/_readstat_writer.pyx":670 * * # table name is used only for xpt files * if table_name: # <<<<<<<<<<<<<< * table_name_bytes = table_name.encode("utf-8") * tab_name = table_name_bytes */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_table_name); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 693, __pyx_L49_error) - if (__pyx_t_3) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_table_name); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 670, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":694 + /* "pyreadstat/_readstat_writer.pyx":671 * # table name is used only for xpt files * if table_name: * table_name_bytes = table_name.encode("utf-8") # <<<<<<<<<<<<<< * tab_name = table_name_bytes * check_exit_status(readstat_writer_set_table_name(writer, tab_name)) */ - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_table_name, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L49_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_table_name, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_table_name_bytes = __pyx_t_1; __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":695 + /* "pyreadstat/_readstat_writer.pyx":672 * if table_name: * table_name_bytes = table_name.encode("utf-8") * tab_name = table_name_bytes # <<<<<<<<<<<<<< * check_exit_status(readstat_writer_set_table_name(writer, tab_name)) * */ - __pyx_t_21 = __Pyx_PyObject_AsWritableString(__pyx_v_table_name_bytes); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L49_error) + __pyx_t_21 = __Pyx_PyObject_AsWritableString(__pyx_v_table_name_bytes); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 672, __pyx_L55_error) __pyx_v_tab_name = ((char *)__pyx_t_21); - /* "pyreadstat/_readstat_writer.pyx":696 + /* "pyreadstat/_readstat_writer.pyx":673 * table_name_bytes = table_name.encode("utf-8") * tab_name = table_name_bytes * check_exit_status(readstat_writer_set_table_name(writer, tab_name)) # <<<<<<<<<<<<<< * * # add variables */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_table_name(__pyx_v_writer, __pyx_v_tab_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_writer_set_table_name(__pyx_v_writer, __pyx_v_tab_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":693 + /* "pyreadstat/_readstat_writer.pyx":670 * * # table name is used only for xpt files * if table_name: # <<<<<<<<<<<<<< @@ -11166,48 +12932,49 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":699 + /* "pyreadstat/_readstat_writer.pyx":676 * * # add variables * if column_labels: # <<<<<<<<<<<<<< * if type(column_labels) != list and type(column_labels) != dict: * raise PyreadstatError("column_labels must be either list or dict!") */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_column_labels); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 699, __pyx_L49_error) - if (__pyx_t_3) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_column_labels); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 676, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":700 + /* "pyreadstat/_readstat_writer.pyx":677 * # add variables * if column_labels: * if type(column_labels) != list and type(column_labels) != dict: # <<<<<<<<<<<<<< * raise PyreadstatError("column_labels must be either list or dict!") * if type(column_labels) == dict: */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_column_labels)), ((PyObject *)(&PyList_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L49_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 700, __pyx_L49_error) + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_column_labels)), ((PyObject *)(&PyList_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L55_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 677, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + if (__pyx_t_3) { } else { - __pyx_t_3 = __pyx_t_4; - goto __pyx_L62_bool_binop_done; + __pyx_t_4 = __pyx_t_3; + goto __pyx_L68_bool_binop_done; } - __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_column_labels)), ((PyObject *)(&PyDict_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L49_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 700, __pyx_L49_error) + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_column_labels)), ((PyObject *)(&PyDict_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L55_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 677, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __pyx_t_4; - __pyx_L62_bool_binop_done:; - if (unlikely(__pyx_t_3)) { + __pyx_t_4 = __pyx_t_3; + __pyx_L68_bool_binop_done:; + if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":701 + /* "pyreadstat/_readstat_writer.pyx":678 * if column_labels: * if type(column_labels) != list and type(column_labels) != dict: * raise PyreadstatError("column_labels must be either list or dict!") # <<<<<<<<<<<<<< * if type(column_labels) == dict: * col_label_temp = list() */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L49_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 678, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { @@ -11215,18 +12982,22 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_kp_s_column_labels_must_be_either_lis) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_column_labels_must_be_either_lis); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_s_column_labels_must_be_either_lis}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 701, __pyx_L49_error) + __PYX_ERR(0, 678, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":700 + /* "pyreadstat/_readstat_writer.pyx":677 * # add variables * if column_labels: * if type(column_labels) != list and type(column_labels) != dict: # <<<<<<<<<<<<<< @@ -11235,43 +13006,43 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":702 + /* "pyreadstat/_readstat_writer.pyx":679 * if type(column_labels) != list and type(column_labels) != dict: * raise PyreadstatError("column_labels must be either list or dict!") * if type(column_labels) == dict: # <<<<<<<<<<<<<< * col_label_temp = list() * for col_indx in range(col_count): */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_column_labels)), ((PyObject *)(&PyDict_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L49_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 702, __pyx_L49_error) + __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_column_labels)), ((PyObject *)(&PyDict_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L55_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 679, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":703 + /* "pyreadstat/_readstat_writer.pyx":680 * raise PyreadstatError("column_labels must be either list or dict!") * if type(column_labels) == dict: * col_label_temp = list() # <<<<<<<<<<<<<< * for col_indx in range(col_count): * variable_name = col_names[col_indx] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L49_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_col_label_temp = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":704 + /* "pyreadstat/_readstat_writer.pyx":681 * if type(column_labels) == dict: * col_label_temp = list() * for col_indx in range(col_count): # <<<<<<<<<<<<<< * variable_name = col_names[col_indx] * if variable_name in column_labels.keys(): */ - __pyx_t_18 = __pyx_v_col_count; - __pyx_t_23 = __pyx_t_18; + __pyx_t_6 = __pyx_v_col_count; + __pyx_t_23 = __pyx_t_6; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_col_indx = __pyx_t_24; - /* "pyreadstat/_readstat_writer.pyx":705 + /* "pyreadstat/_readstat_writer.pyx":682 * col_label_temp = list() * for col_indx in range(col_count): * variable_name = col_names[col_indx] # <<<<<<<<<<<<<< @@ -11280,23 +13051,24 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 705, __pyx_L49_error) + __PYX_ERR(0, 682, __pyx_L55_error) } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_variable_name, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":706 + /* "pyreadstat/_readstat_writer.pyx":683 * for col_indx in range(col_count): * variable_name = col_names[col_indx] * if variable_name in column_labels.keys(): # <<<<<<<<<<<<<< * col_label_temp.append(column_labels[variable_name]) * else: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_column_labels, __pyx_n_s_keys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 706, __pyx_L49_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_column_labels, __pyx_n_s_keys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = NULL; + __pyx_t_25 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { @@ -11304,41 +13076,44 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_25 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_variable_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 706, __pyx_L49_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_2, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_25, 0+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_variable_name, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 683, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":707 + /* "pyreadstat/_readstat_writer.pyx":684 * variable_name = col_names[col_indx] * if variable_name in column_labels.keys(): * col_label_temp.append(column_labels[variable_name]) # <<<<<<<<<<<<<< * else: * col_label_temp.append(None) */ - __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_column_labels, __pyx_v_variable_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_column_labels, __pyx_v_variable_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_25 = __Pyx_PyList_Append(__pyx_v_col_label_temp, __pyx_t_1); if (unlikely(__pyx_t_25 == ((int)-1))) __PYX_ERR(0, 707, __pyx_L49_error) + __pyx_t_26 = __Pyx_PyList_Append(__pyx_v_col_label_temp, __pyx_t_1); if (unlikely(__pyx_t_26 == ((int)-1))) __PYX_ERR(0, 684, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":706 + /* "pyreadstat/_readstat_writer.pyx":683 * for col_indx in range(col_count): * variable_name = col_names[col_indx] * if variable_name in column_labels.keys(): # <<<<<<<<<<<<<< * col_label_temp.append(column_labels[variable_name]) * else: */ - goto __pyx_L67; + goto __pyx_L73; } - /* "pyreadstat/_readstat_writer.pyx":709 + /* "pyreadstat/_readstat_writer.pyx":686 * col_label_temp.append(column_labels[variable_name]) * else: * col_label_temp.append(None) # <<<<<<<<<<<<<< @@ -11346,12 +13121,12 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * */ /*else*/ { - __pyx_t_25 = __Pyx_PyList_Append(__pyx_v_col_label_temp, Py_None); if (unlikely(__pyx_t_25 == ((int)-1))) __PYX_ERR(0, 709, __pyx_L49_error) + __pyx_t_26 = __Pyx_PyList_Append(__pyx_v_col_label_temp, Py_None); if (unlikely(__pyx_t_26 == ((int)-1))) __PYX_ERR(0, 686, __pyx_L55_error) } - __pyx_L67:; + __pyx_L73:; } - /* "pyreadstat/_readstat_writer.pyx":710 + /* "pyreadstat/_readstat_writer.pyx":687 * else: * col_label_temp.append(None) * column_labels = col_label_temp # <<<<<<<<<<<<<< @@ -11361,7 +13136,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_v_col_label_temp); __Pyx_DECREF_SET(__pyx_v_column_labels, __pyx_v_col_label_temp); - /* "pyreadstat/_readstat_writer.pyx":702 + /* "pyreadstat/_readstat_writer.pyx":679 * if type(column_labels) != list and type(column_labels) != dict: * raise PyreadstatError("column_labels must be either list or dict!") * if type(column_labels) == dict: # <<<<<<<<<<<<<< @@ -11370,36 +13145,37 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":712 + /* "pyreadstat/_readstat_writer.pyx":689 * column_labels = col_label_temp * * col_label_count = len(column_labels) # <<<<<<<<<<<<<< * if col_label_count != col_count: * raise PyreadstatError("length of column labels must be the same as number of columns") */ - __pyx_t_11 = PyObject_Length(__pyx_v_column_labels); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 712, __pyx_L49_error) - __pyx_v_col_label_count = __pyx_t_11; + __pyx_t_12 = PyObject_Length(__pyx_v_column_labels); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 689, __pyx_L55_error) + __pyx_v_col_label_count = __pyx_t_12; - /* "pyreadstat/_readstat_writer.pyx":713 + /* "pyreadstat/_readstat_writer.pyx":690 * * col_label_count = len(column_labels) * if col_label_count != col_count: # <<<<<<<<<<<<<< * raise PyreadstatError("length of column labels must be the same as number of columns") * */ - __pyx_t_4 = ((__pyx_v_col_label_count != __pyx_v_col_count) != 0); + __pyx_t_4 = (__pyx_v_col_label_count != __pyx_v_col_count); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":714 + /* "pyreadstat/_readstat_writer.pyx":691 * col_label_count = len(column_labels) * if col_label_count != col_count: * raise PyreadstatError("length of column labels must be the same as number of columns") # <<<<<<<<<<<<<< * * for col_indx in range(col_count): */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 714, __pyx_L49_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 691, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { @@ -11407,18 +13183,22 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_kp_s_length_of_column_labels_must_be) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_s_length_of_column_labels_must_be); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_s_length_of_column_labels_must_be}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 714, __pyx_L49_error) + __PYX_ERR(0, 691, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":713 + /* "pyreadstat/_readstat_writer.pyx":690 * * col_label_count = len(column_labels) * if col_label_count != col_count: # <<<<<<<<<<<<<< @@ -11427,7 +13207,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":699 + /* "pyreadstat/_readstat_writer.pyx":676 * * # add variables * if column_labels: # <<<<<<<<<<<<<< @@ -11436,19 +13216,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":716 + /* "pyreadstat/_readstat_writer.pyx":693 * raise PyreadstatError("length of column labels must be the same as number of columns") * * for col_indx in range(col_count): # <<<<<<<<<<<<<< * curtype, max_length, _ = col_types[col_indx] * variable_name = col_names[col_indx] */ - __pyx_t_18 = __pyx_v_col_count; - __pyx_t_23 = __pyx_t_18; + __pyx_t_6 = __pyx_v_col_count; + __pyx_t_23 = __pyx_t_6; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_col_indx = __pyx_t_24; - /* "pyreadstat/_readstat_writer.pyx":717 + /* "pyreadstat/_readstat_writer.pyx":694 * * for col_indx in range(col_count): * curtype, max_length, _ = col_types[col_indx] # <<<<<<<<<<<<<< @@ -11457,9 +13237,9 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_col_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 717, __pyx_L49_error) + __PYX_ERR(0, 694, __pyx_L55_error) } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; @@ -11467,63 +13247,63 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 717, __pyx_L49_error) + __PYX_ERR(0, 694, __pyx_L55_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_14 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); - __pyx_t_14 = PyList_GET_ITEM(sequence, 2); + __pyx_t_15 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 717, __pyx_L49_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L49_error) + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 717, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 694, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_20 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 717, __pyx_L49_error) + __pyx_t_20 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 694, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_20)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_20); if (unlikely(!__pyx_t_5)) goto __pyx_L71_unpacking_failed; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_20); + index = 0; __pyx_t_5 = __pyx_t_11(__pyx_t_20); if (unlikely(!__pyx_t_5)) goto __pyx_L77_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_2 = __pyx_t_10(__pyx_t_20); if (unlikely(!__pyx_t_2)) goto __pyx_L71_unpacking_failed; + index = 1; __pyx_t_2 = __pyx_t_11(__pyx_t_20); if (unlikely(!__pyx_t_2)) goto __pyx_L77_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - index = 2; __pyx_t_14 = __pyx_t_10(__pyx_t_20); if (unlikely(!__pyx_t_14)) goto __pyx_L71_unpacking_failed; - __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_20), 3) < 0) __PYX_ERR(0, 717, __pyx_L49_error) - __pyx_t_10 = NULL; + index = 2; __pyx_t_15 = __pyx_t_11(__pyx_t_20); if (unlikely(!__pyx_t_15)) goto __pyx_L77_unpacking_failed; + __Pyx_GOTREF(__pyx_t_15); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_20), 3) < 0) __PYX_ERR(0, 694, __pyx_L55_error) + __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - goto __pyx_L72_unpacking_done; - __pyx_L71_unpacking_failed:; + goto __pyx_L78_unpacking_done; + __pyx_L77_unpacking_failed:; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_t_10 = NULL; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 717, __pyx_L49_error) - __pyx_L72_unpacking_done:; + __PYX_ERR(0, 694, __pyx_L55_error) + __pyx_L78_unpacking_done:; } - __pyx_t_26 = ((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 717, __pyx_L49_error) + __pyx_t_27 = ((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L55_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 717, __pyx_L49_error) + __pyx_t_25 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L55_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_curtype = __pyx_t_26; - __pyx_v_max_length = __pyx_t_27; - __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_14); - __pyx_t_14 = 0; + __pyx_v_curtype = __pyx_t_27; + __pyx_v_max_length = __pyx_t_25; + __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_15); + __pyx_t_15 = 0; - /* "pyreadstat/_readstat_writer.pyx":718 + /* "pyreadstat/_readstat_writer.pyx":695 * for col_indx in range(col_count): * curtype, max_length, _ = col_types[col_indx] * variable_name = col_names[col_indx] # <<<<<<<<<<<<<< @@ -11532,63 +13312,68 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 718, __pyx_L49_error) + __PYX_ERR(0, 695, __pyx_L55_error) } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_variable_name, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":719 + /* "pyreadstat/_readstat_writer.pyx":696 * curtype, max_length, _ = col_types[col_indx] * variable_name = col_names[col_indx] * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) # <<<<<<<<<<<<<< * if variable_format: * tempformat = variable_format.get(variable_name) */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_variable_name, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 719, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_variable_name, __pyx_n_s_encode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 696, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14); + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_25 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_2, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_28 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_28) && PyErr_Occurred())) __PYX_ERR(0, 719, __pyx_L49_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_s_utf_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __pyx_t_28 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_28) && PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L55_error) if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 719, __pyx_L49_error) + __PYX_ERR(0, 696, __pyx_L55_error) } - __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 719, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L49_error) + __pyx_t_15 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 696, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_29 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 719, __pyx_L49_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_29 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L55_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_variable = readstat_add_variable(__pyx_v_writer, __pyx_t_28, __pyx_t_29, __pyx_v_max_length); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":720 + /* "pyreadstat/_readstat_writer.pyx":697 * variable_name = col_names[col_indx] * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) * if variable_format: # <<<<<<<<<<<<<< * tempformat = variable_format.get(variable_name) * if tempformat: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_format); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 720, __pyx_L49_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_format); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 697, __pyx_L55_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":721 + /* "pyreadstat/_readstat_writer.pyx":698 * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) * if variable_format: * tempformat = variable_format.get(variable_name) # <<<<<<<<<<<<<< @@ -11597,38 +13382,38 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_variable_format == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 721, __pyx_L49_error) + __PYX_ERR(0, 698, __pyx_L55_error) } - __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_format, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_format, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 721, __pyx_L49_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 698, __pyx_L55_error) __Pyx_XDECREF_SET(__pyx_v_tempformat, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":722 + /* "pyreadstat/_readstat_writer.pyx":699 * if variable_format: * tempformat = variable_format.get(variable_name) * if tempformat: # <<<<<<<<<<<<<< * readstat_variable_set_format(variable, tempformat.encode("utf-8")) * if curtype in pyrwriter_datetimelike_types and (variable_format is None or variable_name not in variable_format.keys()): */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_tempformat); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 722, __pyx_L49_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_tempformat); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 699, __pyx_L55_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":723 + /* "pyreadstat/_readstat_writer.pyx":700 * tempformat = variable_format.get(variable_name) * if tempformat: * readstat_variable_set_format(variable, tempformat.encode("utf-8")) # <<<<<<<<<<<<<< * if curtype in pyrwriter_datetimelike_types and (variable_format is None or variable_name not in variable_format.keys()): * curformat = get_datetimelike_format_for_readstat(file_format, curtype) */ - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_tempformat, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L49_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_tempformat, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_30 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_30) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L49_error) + __pyx_t_30 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_30) && PyErr_Occurred())) __PYX_ERR(0, 700, __pyx_L55_error) readstat_variable_set_format(__pyx_v_variable, __pyx_t_30); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":722 + /* "pyreadstat/_readstat_writer.pyx":699 * if variable_format: * tempformat = variable_format.get(variable_name) * if tempformat: # <<<<<<<<<<<<<< @@ -11637,7 +13422,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":720 + /* "pyreadstat/_readstat_writer.pyx":697 * variable_name = col_names[col_indx] * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) * if variable_format: # <<<<<<<<<<<<<< @@ -11646,57 +13431,55 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":724 + /* "pyreadstat/_readstat_writer.pyx":701 * if tempformat: * readstat_variable_set_format(variable, tempformat.encode("utf-8")) * if curtype in pyrwriter_datetimelike_types and (variable_format is None or variable_name not in variable_format.keys()): # <<<<<<<<<<<<<< * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) */ - __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 724, __pyx_L49_error) + __PYX_ERR(0, 701, __pyx_L55_error) } - __pyx_t_3 = (__Pyx_PySet_ContainsTF(__pyx_t_1, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 724, __pyx_L49_error) + __pyx_t_3 = (__Pyx_PySet_ContainsTF(__pyx_t_1, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 701, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_31 = (__pyx_t_3 != 0); - if (__pyx_t_31) { + if (__pyx_t_3) { } else { - __pyx_t_4 = __pyx_t_31; - goto __pyx_L76_bool_binop_done; + __pyx_t_4 = __pyx_t_3; + goto __pyx_L82_bool_binop_done; } - __pyx_t_31 = (__pyx_v_variable_format == ((PyObject*)Py_None)); - __pyx_t_3 = (__pyx_t_31 != 0); + __pyx_t_3 = (__pyx_v_variable_format == ((PyObject*)Py_None)); if (!__pyx_t_3) { } else { __pyx_t_4 = __pyx_t_3; - goto __pyx_L76_bool_binop_done; + goto __pyx_L82_bool_binop_done; } if (unlikely(__pyx_v_variable_format == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "keys"); - __PYX_ERR(0, 724, __pyx_L49_error) + __PYX_ERR(0, 701, __pyx_L55_error) } - __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_variable_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyDict_Keys(__pyx_v_variable_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_variable_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 724, __pyx_L49_error) + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_variable_name, __pyx_t_1, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 701, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_31 = (__pyx_t_3 != 0); - __pyx_t_4 = __pyx_t_31; - __pyx_L76_bool_binop_done:; + __pyx_t_4 = __pyx_t_3; + __pyx_L82_bool_binop_done:; if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":725 + /* "pyreadstat/_readstat_writer.pyx":702 * readstat_variable_set_format(variable, tempformat.encode("utf-8")) * if curtype in pyrwriter_datetimelike_types and (variable_format is None or variable_name not in variable_format.keys()): * curformat = get_datetimelike_format_for_readstat(file_format, curtype) # <<<<<<<<<<<<<< * readstat_variable_set_format(variable, curformat) * if col_label_count: */ - __pyx_v_curformat = __pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for_readstat(__pyx_v_file_format, __pyx_v_curtype); + __pyx_t_21 = __pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for_readstat(__pyx_v_file_format, __pyx_v_curtype); if (unlikely(__pyx_t_21 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 702, __pyx_L55_error) + __pyx_v_curformat = __pyx_t_21; - /* "pyreadstat/_readstat_writer.pyx":726 + /* "pyreadstat/_readstat_writer.pyx":703 * if curtype in pyrwriter_datetimelike_types and (variable_format is None or variable_name not in variable_format.keys()): * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) # <<<<<<<<<<<<<< @@ -11705,7 +13488,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ readstat_variable_set_format(__pyx_v_variable, __pyx_v_curformat); - /* "pyreadstat/_readstat_writer.pyx":724 + /* "pyreadstat/_readstat_writer.pyx":701 * if tempformat: * readstat_variable_set_format(variable, tempformat.encode("utf-8")) * if curtype in pyrwriter_datetimelike_types and (variable_format is None or variable_name not in variable_format.keys()): # <<<<<<<<<<<<<< @@ -11714,7 +13497,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":727 + /* "pyreadstat/_readstat_writer.pyx":704 * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) * if col_label_count: # <<<<<<<<<<<<<< @@ -11724,64 +13507,68 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_4 = (__pyx_v_col_label_count != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":728 + /* "pyreadstat/_readstat_writer.pyx":705 * readstat_variable_set_format(variable, curformat) * if col_label_count: * if column_labels[col_indx] is not None: # <<<<<<<<<<<<<< * if type(column_labels[col_indx]) != str: * raise PyreadstatError("Column labels must be strings") */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_31 = (__pyx_t_4 != 0); - if (__pyx_t_31) { + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":729 + /* "pyreadstat/_readstat_writer.pyx":706 * if col_label_count: * if column_labels[col_indx] is not None: * if type(column_labels[col_indx]) != str: # <<<<<<<<<<<<<< * raise PyreadstatError("Column labels must be strings") * cur_col_label = column_labels[col_indx].encode("utf-8") */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_1)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 729, __pyx_L49_error) + __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_1)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_31 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 729, __pyx_L49_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 706, __pyx_L55_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__pyx_t_31)) { + if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":730 + /* "pyreadstat/_readstat_writer.pyx":707 * if column_labels[col_indx] is not None: * if type(column_labels[col_indx]) != str: * raise PyreadstatError("Column labels must be strings") # <<<<<<<<<<<<<< * cur_col_label = column_labels[col_indx].encode("utf-8") * readstat_variable_set_label(variable, cur_col_label) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L49_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 707, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = NULL; + __pyx_t_15 = NULL; + __pyx_t_25 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_14)) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_25 = 1; } } - __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_kp_s_Column_labels_must_be_strings) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Column_labels_must_be_strings); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 730, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_kp_s_Column_labels_must_be_strings}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 707, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 730, __pyx_L49_error) + __PYX_ERR(0, 707, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":729 + /* "pyreadstat/_readstat_writer.pyx":706 * if col_label_count: * if column_labels[col_indx] is not None: * if type(column_labels[col_indx]) != str: # <<<<<<<<<<<<<< @@ -11790,38 +13577,43 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":731 + /* "pyreadstat/_readstat_writer.pyx":708 * if type(column_labels[col_indx]) != str: * raise PyreadstatError("Column labels must be strings") * cur_col_label = column_labels[col_indx].encode("utf-8") # <<<<<<<<<<<<<< * readstat_variable_set_label(variable, cur_col_label) * if variable_value_labels: */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 731, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_encode); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 708, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14); + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_25 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_1, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 731, __pyx_L49_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_s_utf_8}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(0, 708, __pyx_L55_error) __Pyx_XDECREF_SET(__pyx_v_cur_col_label, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":732 + /* "pyreadstat/_readstat_writer.pyx":709 * raise PyreadstatError("Column labels must be strings") * cur_col_label = column_labels[col_indx].encode("utf-8") * readstat_variable_set_label(variable, cur_col_label) # <<<<<<<<<<<<<< @@ -11830,12 +13622,12 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_cur_col_label == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 732, __pyx_L49_error) + __PYX_ERR(0, 709, __pyx_L55_error) } - __pyx_t_32 = __Pyx_PyBytes_AsString(__pyx_v_cur_col_label); if (unlikely((!__pyx_t_32) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L49_error) - readstat_variable_set_label(__pyx_v_variable, __pyx_t_32); + __pyx_t_31 = __Pyx_PyBytes_AsString(__pyx_v_cur_col_label); if (unlikely((!__pyx_t_31) && PyErr_Occurred())) __PYX_ERR(0, 709, __pyx_L55_error) + readstat_variable_set_label(__pyx_v_variable, __pyx_t_31); - /* "pyreadstat/_readstat_writer.pyx":728 + /* "pyreadstat/_readstat_writer.pyx":705 * readstat_variable_set_format(variable, curformat) * if col_label_count: * if column_labels[col_indx] is not None: # <<<<<<<<<<<<<< @@ -11844,7 +13636,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":727 + /* "pyreadstat/_readstat_writer.pyx":704 * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) * if col_label_count: # <<<<<<<<<<<<<< @@ -11853,17 +13645,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":733 + /* "pyreadstat/_readstat_writer.pyx":710 * cur_col_label = column_labels[col_indx].encode("utf-8") * readstat_variable_set_label(variable, cur_col_label) * if variable_value_labels: # <<<<<<<<<<<<<< * value_labels = variable_value_labels.get(variable_name) * if value_labels: */ - __pyx_t_31 = __Pyx_PyObject_IsTrue(__pyx_v_variable_value_labels); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 733, __pyx_L49_error) - if (__pyx_t_31) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_value_labels); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 710, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":734 + /* "pyreadstat/_readstat_writer.pyx":711 * readstat_variable_set_label(variable, cur_col_label) * if variable_value_labels: * value_labels = variable_value_labels.get(variable_name) # <<<<<<<<<<<<<< @@ -11872,43 +13664,43 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_variable_value_labels == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 734, __pyx_L49_error) + __PYX_ERR(0, 711, __pyx_L55_error) } - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 734, __pyx_L49_error) + if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_2))) __PYX_ERR(0, 711, __pyx_L55_error) __Pyx_XDECREF_SET(__pyx_v_value_labels, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":735 + /* "pyreadstat/_readstat_writer.pyx":712 * if variable_value_labels: * value_labels = variable_value_labels.get(variable_name) * if value_labels: # <<<<<<<<<<<<<< * labelset_name = variable_name + str(lblset_cnt) * lblset_cnt += 1 */ - __pyx_t_31 = __Pyx_PyObject_IsTrue(__pyx_v_value_labels); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 735, __pyx_L49_error) - if (__pyx_t_31) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_value_labels); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 712, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":736 + /* "pyreadstat/_readstat_writer.pyx":713 * value_labels = variable_value_labels.get(variable_name) * if value_labels: * labelset_name = variable_name + str(lblset_cnt) # <<<<<<<<<<<<<< * lblset_cnt += 1 * curuser_missing = None */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_lblset_cnt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_lblset_cnt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 736, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_Str(__pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 713, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_v_variable_name, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L49_error) + __pyx_t_2 = PyNumber_Add(__pyx_v_variable_name, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF_SET(__pyx_v_labelset_name, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":737 + /* "pyreadstat/_readstat_writer.pyx":714 * if value_labels: * labelset_name = variable_name + str(lblset_cnt) * lblset_cnt += 1 # <<<<<<<<<<<<<< @@ -11917,7 +13709,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_lblset_cnt = (__pyx_v_lblset_cnt + 1); - /* "pyreadstat/_readstat_writer.pyx":738 + /* "pyreadstat/_readstat_writer.pyx":715 * labelset_name = variable_name + str(lblset_cnt) * lblset_cnt += 1 * curuser_missing = None # <<<<<<<<<<<<<< @@ -11927,17 +13719,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(Py_None); __Pyx_XDECREF_SET(__pyx_v_curuser_missing, Py_None); - /* "pyreadstat/_readstat_writer.pyx":739 + /* "pyreadstat/_readstat_writer.pyx":716 * lblset_cnt += 1 * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< * curuser_missing = missing_user_values.get(variable_name) * label_set = set_value_label(writer, value_labels, labelset_name, */ - __pyx_t_31 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 739, __pyx_L49_error) - if (__pyx_t_31) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 716, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":740 + /* "pyreadstat/_readstat_writer.pyx":717 * curuser_missing = None * if missing_user_values: * curuser_missing = missing_user_values.get(variable_name) # <<<<<<<<<<<<<< @@ -11946,14 +13738,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_missing_user_values == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 740, __pyx_L49_error) + __PYX_ERR(0, 717, __pyx_L55_error) } - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_curuser_missing, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":739 + /* "pyreadstat/_readstat_writer.pyx":716 * lblset_cnt += 1 * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< @@ -11962,40 +13754,40 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":741 + /* "pyreadstat/_readstat_writer.pyx":718 * if missing_user_values: * curuser_missing = missing_user_values.get(variable_name) * label_set = set_value_label(writer, value_labels, labelset_name, # <<<<<<<<<<<<<< * col_names_to_types[variable_name], file_format, variable_name, curuser_missing) * readstat_variable_set_label_set(variable, label_set) */ - if (!(likely(PyString_CheckExact(__pyx_v_labelset_name))||((__pyx_v_labelset_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_labelset_name)->tp_name), 0))) __PYX_ERR(0, 741, __pyx_L49_error) + if (!(likely(PyString_CheckExact(__pyx_v_labelset_name))||((__pyx_v_labelset_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_labelset_name))) __PYX_ERR(0, 718, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":742 + /* "pyreadstat/_readstat_writer.pyx":719 * curuser_missing = missing_user_values.get(variable_name) * label_set = set_value_label(writer, value_labels, labelset_name, * col_names_to_types[variable_name], file_format, variable_name, curuser_missing) # <<<<<<<<<<<<<< * readstat_variable_set_label_set(variable, label_set) * if missing_ranges: */ - __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_col_names_to_types, __pyx_v_variable_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_col_names_to_types, __pyx_v_variable_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_26 = ((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L49_error) + __pyx_t_27 = ((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_2)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 719, __pyx_L55_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_variable_name)->tp_name), 0))) __PYX_ERR(0, 742, __pyx_L49_error) - if (!(likely(PyList_CheckExact(__pyx_v_curuser_missing))||((__pyx_v_curuser_missing) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_curuser_missing)->tp_name), 0))) __PYX_ERR(0, 742, __pyx_L49_error) + if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_variable_name))) __PYX_ERR(0, 719, __pyx_L55_error) + if (!(likely(PyList_CheckExact(__pyx_v_curuser_missing))||((__pyx_v_curuser_missing) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_curuser_missing))) __PYX_ERR(0, 719, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":741 + /* "pyreadstat/_readstat_writer.pyx":718 * if missing_user_values: * curuser_missing = missing_user_values.get(variable_name) * label_set = set_value_label(writer, value_labels, labelset_name, # <<<<<<<<<<<<<< * col_names_to_types[variable_name], file_format, variable_name, curuser_missing) * readstat_variable_set_label_set(variable, label_set) */ - __pyx_t_33 = __pyx_f_10pyreadstat_16_readstat_writer_set_value_label(__pyx_v_writer, __pyx_v_value_labels, ((PyObject*)__pyx_v_labelset_name), __pyx_t_26, __pyx_v_file_format, ((PyObject*)__pyx_v_variable_name), ((PyObject*)__pyx_v_curuser_missing)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 741, __pyx_L49_error) - __pyx_v_label_set = __pyx_t_33; + __pyx_t_32 = __pyx_f_10pyreadstat_16_readstat_writer_set_value_label(__pyx_v_writer, __pyx_v_value_labels, ((PyObject*)__pyx_v_labelset_name), __pyx_t_27, __pyx_v_file_format, ((PyObject*)__pyx_v_variable_name), ((PyObject*)__pyx_v_curuser_missing)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 718, __pyx_L55_error) + __pyx_v_label_set = __pyx_t_32; - /* "pyreadstat/_readstat_writer.pyx":743 + /* "pyreadstat/_readstat_writer.pyx":720 * label_set = set_value_label(writer, value_labels, labelset_name, * col_names_to_types[variable_name], file_format, variable_name, curuser_missing) * readstat_variable_set_label_set(variable, label_set) # <<<<<<<<<<<<<< @@ -12004,7 +13796,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ readstat_variable_set_label_set(__pyx_v_variable, __pyx_v_label_set); - /* "pyreadstat/_readstat_writer.pyx":735 + /* "pyreadstat/_readstat_writer.pyx":712 * if variable_value_labels: * value_labels = variable_value_labels.get(variable_name) * if value_labels: # <<<<<<<<<<<<<< @@ -12013,7 +13805,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":733 + /* "pyreadstat/_readstat_writer.pyx":710 * cur_col_label = column_labels[col_indx].encode("utf-8") * readstat_variable_set_label(variable, cur_col_label) * if variable_value_labels: # <<<<<<<<<<<<<< @@ -12022,17 +13814,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":744 + /* "pyreadstat/_readstat_writer.pyx":721 * col_names_to_types[variable_name], file_format, variable_name, curuser_missing) * readstat_variable_set_label_set(variable, label_set) * if missing_ranges: # <<<<<<<<<<<<<< * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: */ - __pyx_t_31 = __Pyx_PyObject_IsTrue(__pyx_v_missing_ranges); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 744, __pyx_L49_error) - if (__pyx_t_31) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_ranges); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 721, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":745 + /* "pyreadstat/_readstat_writer.pyx":722 * readstat_variable_set_label_set(variable, label_set) * if missing_ranges: * cur_ranges = missing_ranges.get(variable_name) # <<<<<<<<<<<<<< @@ -12041,35 +13833,35 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_missing_ranges == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 745, __pyx_L49_error) + __PYX_ERR(0, 722, __pyx_L55_error) } - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_ranges, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_ranges, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_cur_ranges, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":746 + /* "pyreadstat/_readstat_writer.pyx":723 * if missing_ranges: * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: # <<<<<<<<<<<<<< * if not isinstance(cur_ranges, list): * msg = "missing_ranges: values in dictionary must be list" */ - __pyx_t_31 = __Pyx_PyObject_IsTrue(__pyx_v_cur_ranges); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 746, __pyx_L49_error) - if (__pyx_t_31) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_cur_ranges); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 723, __pyx_L55_error) + if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":747 + /* "pyreadstat/_readstat_writer.pyx":724 * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: * if not isinstance(cur_ranges, list): # <<<<<<<<<<<<<< * msg = "missing_ranges: values in dictionary must be list" * raise PyreadstatError(msg) */ - __pyx_t_31 = PyList_Check(__pyx_v_cur_ranges); - __pyx_t_4 = ((!(__pyx_t_31 != 0)) != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_4 = PyList_Check(__pyx_v_cur_ranges); + __pyx_t_3 = (!__pyx_t_4); + if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":748 + /* "pyreadstat/_readstat_writer.pyx":725 * if cur_ranges: * if not isinstance(cur_ranges, list): * msg = "missing_ranges: values in dictionary must be list" # <<<<<<<<<<<<<< @@ -12079,35 +13871,40 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_kp_s_missing_ranges_values_in_diction); __pyx_v_msg = __pyx_kp_s_missing_ranges_values_in_diction; - /* "pyreadstat/_readstat_writer.pyx":749 + /* "pyreadstat/_readstat_writer.pyx":726 * if not isinstance(cur_ranges, list): * msg = "missing_ranges: values in dictionary must be list" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * add_missing_ranges(cur_ranges, variable, curtype, variable_name) * if variable_alignment: */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 749, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 726, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14); + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_25 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_1, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_msg); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_msg}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 749, __pyx_L49_error) + __PYX_ERR(0, 726, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":747 + /* "pyreadstat/_readstat_writer.pyx":724 * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: * if not isinstance(cur_ranges, list): # <<<<<<<<<<<<<< @@ -12116,18 +13913,18 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":750 + /* "pyreadstat/_readstat_writer.pyx":727 * msg = "missing_ranges: values in dictionary must be list" * raise PyreadstatError(msg) * add_missing_ranges(cur_ranges, variable, curtype, variable_name) # <<<<<<<<<<<<<< * if variable_alignment: * # At the moment this is ineffective for sav and dta (the function runs but in */ - if (!(likely(PyList_CheckExact(__pyx_v_cur_ranges))||((__pyx_v_cur_ranges) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_cur_ranges)->tp_name), 0))) __PYX_ERR(0, 750, __pyx_L49_error) - if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_variable_name)->tp_name), 0))) __PYX_ERR(0, 750, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(((PyObject*)__pyx_v_cur_ranges), __pyx_v_variable, __pyx_v_curtype, ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 750, __pyx_L49_error) + if (!(likely(PyList_CheckExact(__pyx_v_cur_ranges))||((__pyx_v_cur_ranges) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_v_cur_ranges))) __PYX_ERR(0, 727, __pyx_L55_error) + if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_variable_name))) __PYX_ERR(0, 727, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(((PyObject*)__pyx_v_cur_ranges), __pyx_v_variable, __pyx_v_curtype, ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 727, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":746 + /* "pyreadstat/_readstat_writer.pyx":723 * if missing_ranges: * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: # <<<<<<<<<<<<<< @@ -12136,7 +13933,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":744 + /* "pyreadstat/_readstat_writer.pyx":721 * col_names_to_types[variable_name], file_format, variable_name, curuser_missing) * readstat_variable_set_label_set(variable, label_set) * if missing_ranges: # <<<<<<<<<<<<<< @@ -12145,17 +13942,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":751 + /* "pyreadstat/_readstat_writer.pyx":728 * raise PyreadstatError(msg) * add_missing_ranges(cur_ranges, variable, curtype, variable_name) * if variable_alignment: # <<<<<<<<<<<<<< * # At the moment this is ineffective for sav and dta (the function runs but in * # the resulting file all alignments are still unknown) */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_alignment); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 751, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_alignment); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 728, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":754 + /* "pyreadstat/_readstat_writer.pyx":731 * # At the moment this is ineffective for sav and dta (the function runs but in * # the resulting file all alignments are still unknown) * cur_alignment = variable_alignment.get(variable_name) # <<<<<<<<<<<<<< @@ -12164,35 +13961,35 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_variable_alignment == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 754, __pyx_L49_error) + __PYX_ERR(0, 731, __pyx_L55_error) } - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_alignment, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_alignment, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_cur_alignment, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":755 + /* "pyreadstat/_readstat_writer.pyx":732 * # the resulting file all alignments are still unknown) * cur_alignment = variable_alignment.get(variable_name) * if cur_alignment: # <<<<<<<<<<<<<< * set_variable_alignment(variable, cur_alignment, variable_name) * if variable_display_width: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_cur_alignment); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 755, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_alignment); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 732, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":756 + /* "pyreadstat/_readstat_writer.pyx":733 * cur_alignment = variable_alignment.get(variable_name) * if cur_alignment: * set_variable_alignment(variable, cur_alignment, variable_name) # <<<<<<<<<<<<<< * if variable_display_width: * cur_display_width = variable_display_width.get(variable_name) */ - if (!(likely(PyString_CheckExact(__pyx_v_cur_alignment))||((__pyx_v_cur_alignment) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_cur_alignment)->tp_name), 0))) __PYX_ERR(0, 756, __pyx_L49_error) - if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_variable_name)->tp_name), 0))) __PYX_ERR(0, 756, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(__pyx_v_variable, ((PyObject*)__pyx_v_cur_alignment), ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 756, __pyx_L49_error) + if (!(likely(PyString_CheckExact(__pyx_v_cur_alignment))||((__pyx_v_cur_alignment) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_cur_alignment))) __PYX_ERR(0, 733, __pyx_L55_error) + if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_variable_name))) __PYX_ERR(0, 733, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(__pyx_v_variable, ((PyObject*)__pyx_v_cur_alignment), ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 733, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":755 + /* "pyreadstat/_readstat_writer.pyx":732 * # the resulting file all alignments are still unknown) * cur_alignment = variable_alignment.get(variable_name) * if cur_alignment: # <<<<<<<<<<<<<< @@ -12201,7 +13998,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":751 + /* "pyreadstat/_readstat_writer.pyx":728 * raise PyreadstatError(msg) * add_missing_ranges(cur_ranges, variable, curtype, variable_name) * if variable_alignment: # <<<<<<<<<<<<<< @@ -12210,17 +14007,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":757 + /* "pyreadstat/_readstat_writer.pyx":734 * if cur_alignment: * set_variable_alignment(variable, cur_alignment, variable_name) * if variable_display_width: # <<<<<<<<<<<<<< * cur_display_width = variable_display_width.get(variable_name) * if cur_display_width: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_display_width); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 757, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_display_width); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 734, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":758 + /* "pyreadstat/_readstat_writer.pyx":735 * set_variable_alignment(variable, cur_alignment, variable_name) * if variable_display_width: * cur_display_width = variable_display_width.get(variable_name) # <<<<<<<<<<<<<< @@ -12229,35 +14026,35 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_variable_display_width == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 758, __pyx_L49_error) + __PYX_ERR(0, 735, __pyx_L55_error) } - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_display_width, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_display_width, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_cur_display_width, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":759 + /* "pyreadstat/_readstat_writer.pyx":736 * if variable_display_width: * cur_display_width = variable_display_width.get(variable_name) * if cur_display_width: # <<<<<<<<<<<<<< * set_variable_display_width(variable, cur_display_width, variable_name) * if variable_measure: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_cur_display_width); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 759, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_display_width); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 736, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":760 + /* "pyreadstat/_readstat_writer.pyx":737 * cur_display_width = variable_display_width.get(variable_name) * if cur_display_width: * set_variable_display_width(variable, cur_display_width, variable_name) # <<<<<<<<<<<<<< * if variable_measure: * cur_measure = variable_measure.get(variable_name) */ - __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_v_cur_display_width); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L49_error) - if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_variable_name)->tp_name), 0))) __PYX_ERR(0, 760, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(__pyx_v_variable, __pyx_t_27, ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L49_error) + __pyx_t_25 = __Pyx_PyInt_As_int(__pyx_v_cur_display_width); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 737, __pyx_L55_error) + if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_variable_name))) __PYX_ERR(0, 737, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(__pyx_v_variable, __pyx_t_25, ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 737, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":759 + /* "pyreadstat/_readstat_writer.pyx":736 * if variable_display_width: * cur_display_width = variable_display_width.get(variable_name) * if cur_display_width: # <<<<<<<<<<<<<< @@ -12266,7 +14063,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":757 + /* "pyreadstat/_readstat_writer.pyx":734 * if cur_alignment: * set_variable_alignment(variable, cur_alignment, variable_name) * if variable_display_width: # <<<<<<<<<<<<<< @@ -12275,17 +14072,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":761 + /* "pyreadstat/_readstat_writer.pyx":738 * if cur_display_width: * set_variable_display_width(variable, cur_display_width, variable_name) * if variable_measure: # <<<<<<<<<<<<<< * cur_measure = variable_measure.get(variable_name) * if cur_measure: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_measure); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 761, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_measure); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 738, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":762 + /* "pyreadstat/_readstat_writer.pyx":739 * set_variable_display_width(variable, cur_display_width, variable_name) * if variable_measure: * cur_measure = variable_measure.get(variable_name) # <<<<<<<<<<<<<< @@ -12294,35 +14091,35 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_variable_measure == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 762, __pyx_L49_error) + __PYX_ERR(0, 739, __pyx_L55_error) } - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_measure, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_measure, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_cur_measure, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":763 + /* "pyreadstat/_readstat_writer.pyx":740 * if variable_measure: * cur_measure = variable_measure.get(variable_name) * if cur_measure: # <<<<<<<<<<<<<< * set_variable_measure(variable, cur_measure, variable_name) * */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_cur_measure); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 763, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_measure); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 740, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":764 + /* "pyreadstat/_readstat_writer.pyx":741 * cur_measure = variable_measure.get(variable_name) * if cur_measure: * set_variable_measure(variable, cur_measure, variable_name) # <<<<<<<<<<<<<< * * # start writing */ - if (!(likely(PyString_CheckExact(__pyx_v_cur_measure))||((__pyx_v_cur_measure) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_cur_measure)->tp_name), 0))) __PYX_ERR(0, 764, __pyx_L49_error) - if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_variable_name)->tp_name), 0))) __PYX_ERR(0, 764, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(__pyx_v_variable, ((PyObject*)__pyx_v_cur_measure), ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 764, __pyx_L49_error) + if (!(likely(PyString_CheckExact(__pyx_v_cur_measure))||((__pyx_v_cur_measure) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_cur_measure))) __PYX_ERR(0, 741, __pyx_L55_error) + if (!(likely(PyString_CheckExact(__pyx_v_variable_name))||((__pyx_v_variable_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_variable_name))) __PYX_ERR(0, 741, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(__pyx_v_variable, ((PyObject*)__pyx_v_cur_measure), ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 741, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":763 + /* "pyreadstat/_readstat_writer.pyx":740 * if variable_measure: * cur_measure = variable_measure.get(variable_name) * if cur_measure: # <<<<<<<<<<<<<< @@ -12331,7 +14128,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":761 + /* "pyreadstat/_readstat_writer.pyx":738 * if cur_display_width: * set_variable_display_width(variable, cur_display_width, variable_name) * if variable_measure: # <<<<<<<<<<<<<< @@ -12341,7 +14138,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } } - /* "pyreadstat/_readstat_writer.pyx":767 + /* "pyreadstat/_readstat_writer.pyx":744 * * # start writing * if file_format == FILE_FORMAT_SAS7BCAT: # <<<<<<<<<<<<<< @@ -12351,16 +14148,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d switch (__pyx_v_file_format) { case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAS7BCAT: - /* "pyreadstat/_readstat_writer.pyx":768 + /* "pyreadstat/_readstat_writer.pyx":745 * # start writing * if file_format == FILE_FORMAT_SAS7BCAT: * check_exit_status(readstat_begin_writing_sas7bcat(writer, &fd)) # <<<<<<<<<<<<<< * elif file_format == FILE_FORMAT_DTA: * check_exit_status(readstat_begin_writing_dta(writer, &fd, row_count)) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_sas7bcat(__pyx_v_writer, (&__pyx_v_fd))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_sas7bcat(__pyx_v_writer, (&__pyx_v_fd))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 745, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":767 + /* "pyreadstat/_readstat_writer.pyx":744 * * # start writing * if file_format == FILE_FORMAT_SAS7BCAT: # <<<<<<<<<<<<<< @@ -12370,16 +14167,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA: - /* "pyreadstat/_readstat_writer.pyx":770 + /* "pyreadstat/_readstat_writer.pyx":747 * check_exit_status(readstat_begin_writing_sas7bcat(writer, &fd)) * elif file_format == FILE_FORMAT_DTA: * check_exit_status(readstat_begin_writing_dta(writer, &fd, row_count)) # <<<<<<<<<<<<<< * elif file_format == FILE_FORMAT_SAV: * check_exit_status(readstat_begin_writing_sav(writer, &fd, row_count)) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_dta(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 770, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_dta(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 747, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":769 + /* "pyreadstat/_readstat_writer.pyx":746 * if file_format == FILE_FORMAT_SAS7BCAT: * check_exit_status(readstat_begin_writing_sas7bcat(writer, &fd)) * elif file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -12389,16 +14186,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAV: - /* "pyreadstat/_readstat_writer.pyx":772 + /* "pyreadstat/_readstat_writer.pyx":749 * check_exit_status(readstat_begin_writing_dta(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_SAV: * check_exit_status(readstat_begin_writing_sav(writer, &fd, row_count)) # <<<<<<<<<<<<<< * elif file_format == FILE_FORMAT_POR: * check_exit_status(readstat_begin_writing_por(writer, &fd, row_count)) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_sav(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_sav(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 749, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":771 + /* "pyreadstat/_readstat_writer.pyx":748 * elif file_format == FILE_FORMAT_DTA: * check_exit_status(readstat_begin_writing_dta(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_SAV: # <<<<<<<<<<<<<< @@ -12408,16 +14205,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR: - /* "pyreadstat/_readstat_writer.pyx":774 + /* "pyreadstat/_readstat_writer.pyx":751 * check_exit_status(readstat_begin_writing_sav(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_POR: * check_exit_status(readstat_begin_writing_por(writer, &fd, row_count)) # <<<<<<<<<<<<<< * elif file_format == FILE_FORMAT_SAS7BDAT: * check_exit_status(readstat_begin_writing_sas7bdat(writer, &fd, row_count)) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_por(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 774, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_por(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 751, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":773 + /* "pyreadstat/_readstat_writer.pyx":750 * elif file_format == FILE_FORMAT_SAV: * check_exit_status(readstat_begin_writing_sav(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -12427,16 +14224,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAS7BDAT: - /* "pyreadstat/_readstat_writer.pyx":776 + /* "pyreadstat/_readstat_writer.pyx":753 * check_exit_status(readstat_begin_writing_por(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_SAS7BDAT: * check_exit_status(readstat_begin_writing_sas7bdat(writer, &fd, row_count)) # <<<<<<<<<<<<<< * elif file_format == FILE_FORMAT_XPORT: * check_exit_status(readstat_begin_writing_xport(writer, &fd, row_count)) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_sas7bdat(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_sas7bdat(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 753, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":775 + /* "pyreadstat/_readstat_writer.pyx":752 * elif file_format == FILE_FORMAT_POR: * check_exit_status(readstat_begin_writing_por(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_SAS7BDAT: # <<<<<<<<<<<<<< @@ -12446,16 +14243,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_XPORT: - /* "pyreadstat/_readstat_writer.pyx":778 + /* "pyreadstat/_readstat_writer.pyx":755 * check_exit_status(readstat_begin_writing_sas7bdat(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_XPORT: * check_exit_status(readstat_begin_writing_xport(writer, &fd, row_count)) # <<<<<<<<<<<<<< * else: * raise PyreadstatError("unknown file format") */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_xport(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_writing_xport(__pyx_v_writer, (&__pyx_v_fd), __pyx_v_row_count)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 755, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":777 + /* "pyreadstat/_readstat_writer.pyx":754 * elif file_format == FILE_FORMAT_SAS7BDAT: * check_exit_status(readstat_begin_writing_sas7bdat(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_XPORT: # <<<<<<<<<<<<<< @@ -12465,58 +14262,63 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; default: - /* "pyreadstat/_readstat_writer.pyx":780 + /* "pyreadstat/_readstat_writer.pyx":757 * check_exit_status(readstat_begin_writing_xport(writer, &fd, row_count)) * else: * raise PyreadstatError("unknown file format") # <<<<<<<<<<<<<< * * # validation */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 780, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 757, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14); + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_1, __pyx_kp_s_unknown_file_format) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_s_unknown_file_format); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_s_unknown_file_format}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 780, __pyx_L49_error) + __PYX_ERR(0, 757, __pyx_L55_error) break; } - /* "pyreadstat/_readstat_writer.pyx":783 + /* "pyreadstat/_readstat_writer.pyx":760 * * # validation * check_exit_status(readstat_validate_metadata(writer)) # <<<<<<<<<<<<<< * for col_indx in range(col_count): * tempvar = readstat_get_variable(writer, col_indx) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_validate_metadata(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_validate_metadata(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":784 + /* "pyreadstat/_readstat_writer.pyx":761 * # validation * check_exit_status(readstat_validate_metadata(writer)) * for col_indx in range(col_count): # <<<<<<<<<<<<<< * tempvar = readstat_get_variable(writer, col_indx) * check_exit_status(readstat_validate_variable(writer, tempvar)) */ - __pyx_t_18 = __pyx_v_col_count; - __pyx_t_23 = __pyx_t_18; + __pyx_t_6 = __pyx_v_col_count; + __pyx_t_23 = __pyx_t_6; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_col_indx = __pyx_t_24; - /* "pyreadstat/_readstat_writer.pyx":785 + /* "pyreadstat/_readstat_writer.pyx":762 * check_exit_status(readstat_validate_metadata(writer)) * for col_indx in range(col_count): * tempvar = readstat_get_variable(writer, col_indx) # <<<<<<<<<<<<<< @@ -12525,130 +14327,134 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_tempvar = readstat_get_variable(__pyx_v_writer, __pyx_v_col_indx); - /* "pyreadstat/_readstat_writer.pyx":786 + /* "pyreadstat/_readstat_writer.pyx":763 * for col_indx in range(col_count): * tempvar = readstat_get_variable(writer, col_indx) * check_exit_status(readstat_validate_variable(writer, tempvar)) # <<<<<<<<<<<<<< * * # vectorized transform of datetime64ns columns */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_validate_variable(__pyx_v_writer, __pyx_v_tempvar)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_validate_variable(__pyx_v_writer, __pyx_v_tempvar)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L55_error) } - /* "pyreadstat/_readstat_writer.pyx":789 + /* "pyreadstat/_readstat_writer.pyx":766 * * # vectorized transform of datetime64ns columns * pywriter_types = [x[0] for x in col_types] # <<<<<<<<<<<<<< * hasdatetime64 = PYWRITER_DATETIME64 in pywriter_types * if hasdatetime64: */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L49_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(__pyx_v_col_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 789, __pyx_L49_error) + __PYX_ERR(0, 766, __pyx_L55_error) } - __pyx_t_14 = __pyx_v_col_types; __Pyx_INCREF(__pyx_t_14); __pyx_t_11 = 0; + __pyx_t_15 = __pyx_v_col_types; __Pyx_INCREF(__pyx_t_15); __pyx_t_12 = 0; for (;;) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_14)) break; + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_15)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 789, __pyx_L49_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 766, __pyx_L55_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_14, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L49_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); #endif __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_x, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 789, __pyx_L49_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 766, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_v_pywriter_types = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":790 + /* "pyreadstat/_readstat_writer.pyx":767 * # vectorized transform of datetime64ns columns * pywriter_types = [x[0] for x in col_types] * hasdatetime64 = PYWRITER_DATETIME64 in pywriter_types # <<<<<<<<<<<<<< * if hasdatetime64: * df2 = df.copy() */ - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 767, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_v_pywriter_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 790, __pyx_L49_error) + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_v_pywriter_types, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 767, __pyx_L55_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_hasdatetime64 = __pyx_t_4; + __pyx_v_hasdatetime64 = __pyx_t_3; - /* "pyreadstat/_readstat_writer.pyx":791 + /* "pyreadstat/_readstat_writer.pyx":768 * pywriter_types = [x[0] for x in col_types] * hasdatetime64 = PYWRITER_DATETIME64 in pywriter_types * if hasdatetime64: # <<<<<<<<<<<<<< * df2 = df.copy() * for col_indx in range(col_count): */ - __pyx_t_4 = (__pyx_v_hasdatetime64 != 0); - if (__pyx_t_4) { + if (__pyx_v_hasdatetime64) { - /* "pyreadstat/_readstat_writer.pyx":792 + /* "pyreadstat/_readstat_writer.pyx":769 * hasdatetime64 = PYWRITER_DATETIME64 in pywriter_types * if hasdatetime64: * df2 = df.copy() # <<<<<<<<<<<<<< * for col_indx in range(col_count): * if pywriter_types[col_indx] == PYWRITER_DATETIME64: */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_copy); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 792, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_copy); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 769, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14); + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15); if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_14, function); + __Pyx_DECREF_SET(__pyx_t_15, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 792, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_1, }; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } __pyx_v_df2 = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":793 + /* "pyreadstat/_readstat_writer.pyx":770 * if hasdatetime64: * df2 = df.copy() * for col_indx in range(col_count): # <<<<<<<<<<<<<< * if pywriter_types[col_indx] == PYWRITER_DATETIME64: * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: */ - __pyx_t_18 = __pyx_v_col_count; - __pyx_t_23 = __pyx_t_18; + __pyx_t_6 = __pyx_v_col_count; + __pyx_t_23 = __pyx_t_6; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_col_indx = __pyx_t_24; - /* "pyreadstat/_readstat_writer.pyx":794 + /* "pyreadstat/_readstat_writer.pyx":771 * df2 = df.copy() * for col_indx in range(col_count): * if pywriter_types[col_indx] == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: * offset_secs = spss_offset_secs */ - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_pywriter_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L49_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_pywriter_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 794, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_14, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L49_error) + __pyx_t_15 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 771, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_15, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L55_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 794, __pyx_L49_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 771, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":795 + /* "pyreadstat/_readstat_writer.pyx":772 * for col_indx in range(col_count): * if pywriter_types[col_indx] == PYWRITER_DATETIME64: * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -12659,7 +14465,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAV: case __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR: - /* "pyreadstat/_readstat_writer.pyx":796 + /* "pyreadstat/_readstat_writer.pyx":773 * if pywriter_types[col_indx] == PYWRITER_DATETIME64: * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: * offset_secs = spss_offset_secs # <<<<<<<<<<<<<< @@ -12668,7 +14474,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_offset_secs = __pyx_v_10pyreadstat_16_readstat_writer_spss_offset_secs; - /* "pyreadstat/_readstat_writer.pyx":795 + /* "pyreadstat/_readstat_writer.pyx":772 * for col_indx in range(col_count): * if pywriter_types[col_indx] == PYWRITER_DATETIME64: * if file_format == FILE_FORMAT_SAV or file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -12678,7 +14484,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; default: - /* "pyreadstat/_readstat_writer.pyx":798 + /* "pyreadstat/_readstat_writer.pyx":775 * offset_secs = spss_offset_secs * else: * offset_secs = sas_offset_secs # <<<<<<<<<<<<<< @@ -12689,7 +14495,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; } - /* "pyreadstat/_readstat_writer.pyx":799 + /* "pyreadstat/_readstat_writer.pyx":776 * else: * offset_secs = sas_offset_secs * mulfac = 1.0 # <<<<<<<<<<<<<< @@ -12698,17 +14504,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_mulfac = 1.0; - /* "pyreadstat/_readstat_writer.pyx":800 + /* "pyreadstat/_readstat_writer.pyx":777 * offset_secs = sas_offset_secs * mulfac = 1.0 * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< * # stata stores in milliseconds * mulfac = 1000.0 */ - __pyx_t_4 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA) != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA); + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":802 + /* "pyreadstat/_readstat_writer.pyx":779 * if file_format == FILE_FORMAT_DTA: * # stata stores in milliseconds * mulfac = 1000.0 # <<<<<<<<<<<<<< @@ -12717,7 +14523,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_mulfac = 1000.0; - /* "pyreadstat/_readstat_writer.pyx":800 + /* "pyreadstat/_readstat_writer.pyx":777 * offset_secs = sas_offset_secs * mulfac = 1.0 * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -12726,128 +14532,143 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":803 + /* "pyreadstat/_readstat_writer.pyx":780 * # stata stores in milliseconds * mulfac = 1000.0 * df2.iloc[:, col_indx] = (np.round(df2.iloc[:, col_indx].values.astype(object).astype(np.float64)/1e9) + offset_secs) * mulfac # <<<<<<<<<<<<<< * else: * df2 = df */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_round); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L49_error) + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_round); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_df2, __pyx_n_s_iloc); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 803, __pyx_L49_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_df2, __pyx_n_s_iloc); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_20); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_col_indx); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 803, __pyx_L49_error) + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_col_indx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice_); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_20, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_slice_); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_20, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_values); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_values); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 803, __pyx_L49_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_25 = 1; } } - __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_builtin_object) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_builtin_object); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_builtin_object}; + __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 803, __pyx_L49_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_25 = 1; } } - __pyx_t_14 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyFloat_DivideObjC(__pyx_t_14, __pyx_float_1e9, 1e9, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = NULL; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10}; + __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = __Pyx_PyFloat_DivideObjC(__pyx_t_15, __pyx_float_1e9, 1e9, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = NULL; + __pyx_t_25 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_14)) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_25 = 1; } } - __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_offset_secs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L49_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_9}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_offset_secs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mulfac); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L49_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mulfac); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L49_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L55_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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df2, __pyx_n_s_iloc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L49_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df2, __pyx_n_s_iloc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_col_indx); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 803, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_col_indx); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 780, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); - PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_slice_); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_8); - __pyx_t_8 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_t_14, __pyx_t_1) < 0)) __PYX_ERR(0, 803, __pyx_L49_error) + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_slice_); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_9); + __pyx_t_9 = 0; + if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_t_15, __pyx_t_1) < 0))) __PYX_ERR(0, 780, __pyx_L55_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":794 + /* "pyreadstat/_readstat_writer.pyx":771 * df2 = df.copy() * for col_indx in range(col_count): * if pywriter_types[col_indx] == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< @@ -12857,17 +14678,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } } - /* "pyreadstat/_readstat_writer.pyx":791 + /* "pyreadstat/_readstat_writer.pyx":768 * pywriter_types = [x[0] for x in col_types] * hasdatetime64 = PYWRITER_DATETIME64 in pywriter_types * if hasdatetime64: # <<<<<<<<<<<<<< * df2 = df.copy() * for col_indx in range(col_count): */ - goto __pyx_L98; + goto __pyx_L105; } - /* "pyreadstat/_readstat_writer.pyx":805 + /* "pyreadstat/_readstat_writer.pyx":782 * df2.iloc[:, col_indx] = (np.round(df2.iloc[:, col_indx].values.astype(object).astype(np.float64)/1e9) + offset_secs) * mulfac * else: * df2 = df # <<<<<<<<<<<<<< @@ -12878,9 +14699,9 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_v_df); __pyx_v_df2 = __pyx_v_df; } - __pyx_L98:; + __pyx_L105:; - /* "pyreadstat/_readstat_writer.pyx":808 + /* "pyreadstat/_readstat_writer.pyx":785 * * # inserting * rowcnt = 0 # <<<<<<<<<<<<<< @@ -12890,50 +14711,50 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_int_0); __pyx_v_rowcnt = __pyx_int_0; - /* "pyreadstat/_readstat_writer.pyx":810 + /* "pyreadstat/_readstat_writer.pyx":787 * rowcnt = 0 * * for row in df2.values: # <<<<<<<<<<<<<< * check_exit_status(readstat_begin_row(writer)) * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df2, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df2, __pyx_n_s_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_14 = __pyx_t_1; __Pyx_INCREF(__pyx_t_14); __pyx_t_11 = 0; - __pyx_t_7 = NULL; + __pyx_t_15 = __pyx_t_1; __Pyx_INCREF(__pyx_t_15); __pyx_t_12 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 810, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_7 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 810, __pyx_L49_error) + __pyx_t_12 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 787, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 787, __pyx_L55_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_7)) { - if (likely(PyList_CheckExact(__pyx_t_14))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_14)) break; + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_15))) { + if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_15)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 810, __pyx_L49_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 787, __pyx_L55_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_14, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L49_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_14)) break; + if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_15)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 810, __pyx_L49_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 787, __pyx_L55_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_14, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L49_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_15, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_1 = __pyx_t_7(__pyx_t_14); + __pyx_t_1 = __pyx_t_8(__pyx_t_15); 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, 810, __pyx_L49_error) + else __PYX_ERR(0, 787, __pyx_L55_error) } break; } @@ -12942,28 +14763,28 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":811 + /* "pyreadstat/_readstat_writer.pyx":788 * * for row in df2.values: * check_exit_status(readstat_begin_row(writer)) # <<<<<<<<<<<<<< * * for col_indx in range(col_count): */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_row(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 811, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_row(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":813 + /* "pyreadstat/_readstat_writer.pyx":790 * check_exit_status(readstat_begin_row(writer)) * * for col_indx in range(col_count): # <<<<<<<<<<<<<< * * tempvar = readstat_get_variable(writer, col_indx) */ - __pyx_t_18 = __pyx_v_col_count; - __pyx_t_23 = __pyx_t_18; + __pyx_t_6 = __pyx_v_col_count; + __pyx_t_23 = __pyx_t_6; for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_col_indx = __pyx_t_24; - /* "pyreadstat/_readstat_writer.pyx":815 + /* "pyreadstat/_readstat_writer.pyx":792 * for col_indx in range(col_count): * * tempvar = readstat_get_variable(writer, col_indx) # <<<<<<<<<<<<<< @@ -12972,32 +14793,32 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_tempvar = readstat_get_variable(__pyx_v_writer, __pyx_v_col_indx); - /* "pyreadstat/_readstat_writer.pyx":816 + /* "pyreadstat/_readstat_writer.pyx":793 * * tempvar = readstat_get_variable(writer, col_indx) * curval = row[col_indx] # <<<<<<<<<<<<<< * #curtype = col_types[col_indx][0] * curtype = pywriter_types[col_indx] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_row, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_row, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_curval, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":818 + /* "pyreadstat/_readstat_writer.pyx":795 * curval = row[col_indx] * #curtype = col_types[col_indx][0] * curtype = pywriter_types[col_indx] # <<<<<<<<<<<<<< * is_missing = col_types[col_indx][2] * curuser_missing = None */ - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_pywriter_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_pywriter_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 795, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_26 = ((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L49_error) + __pyx_t_27 = ((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)__Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 795, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_curtype = __pyx_t_26; + __pyx_v_curtype = __pyx_t_27; - /* "pyreadstat/_readstat_writer.pyx":819 + /* "pyreadstat/_readstat_writer.pyx":796 * #curtype = col_types[col_indx][0] * curtype = pywriter_types[col_indx] * is_missing = col_types[col_indx][2] # <<<<<<<<<<<<<< @@ -13006,17 +14827,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_col_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 819, __pyx_L49_error) + __PYX_ERR(0, 796, __pyx_L55_error) } - __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L49_error) + __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 819, __pyx_L49_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 796, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_is_missing, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":820 + /* "pyreadstat/_readstat_writer.pyx":797 * curtype = pywriter_types[col_indx] * is_missing = col_types[col_indx][2] * curuser_missing = None # <<<<<<<<<<<<<< @@ -13026,17 +14847,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(Py_None); __Pyx_XDECREF_SET(__pyx_v_curuser_missing, Py_None); - /* "pyreadstat/_readstat_writer.pyx":821 + /* "pyreadstat/_readstat_writer.pyx":798 * is_missing = col_types[col_indx][2] * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< * curuser_missing = missing_user_values.get(col_names[col_indx]) * */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 821, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 798, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":822 + /* "pyreadstat/_readstat_writer.pyx":799 * curuser_missing = None * if missing_user_values: * curuser_missing = missing_user_values.get(col_names[col_indx]) # <<<<<<<<<<<<<< @@ -13045,21 +14866,21 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_missing_user_values == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get"); - __PYX_ERR(0, 822, __pyx_L49_error) + __PYX_ERR(0, 799, __pyx_L55_error) } if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 822, __pyx_L49_error) + __PYX_ERR(0, 799, __pyx_L55_error) } - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L49_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_curuser_missing, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":821 + /* "pyreadstat/_readstat_writer.pyx":798 * is_missing = col_types[col_indx][2] * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< @@ -13068,66 +14889,71 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":824 + /* "pyreadstat/_readstat_writer.pyx":801 * curuser_missing = missing_user_values.get(col_names[col_indx]) * * if is_missing: # <<<<<<<<<<<<<< * #if curval is None or (type(curval) in numeric_types and np.isnan(curval)): * if pd.isna(curval): */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_is_missing); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 824, __pyx_L49_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_missing); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 801, __pyx_L55_error) + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":826 + /* "pyreadstat/_readstat_writer.pyx":803 * if is_missing: * #if curval is None or (type(curval) in numeric_types and np.isnan(curval)): * if pd.isna(curval): # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_missing_value(writer, tempvar)) * continue */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L49_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isna); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 826, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isna); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 803, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_25 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_v_curval) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_curval); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 826, __pyx_L49_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_curval}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 803, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":827 + /* "pyreadstat/_readstat_writer.pyx":804 * #if curval is None or (type(curval) in numeric_types and np.isnan(curval)): * if pd.isna(curval): * check_exit_status(readstat_insert_missing_value(writer, tempvar)) # <<<<<<<<<<<<<< * continue * */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_missing_value(__pyx_v_writer, __pyx_v_tempvar)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 827, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_missing_value(__pyx_v_writer, __pyx_v_tempvar)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 804, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":828 + /* "pyreadstat/_readstat_writer.pyx":805 * if pd.isna(curval): * check_exit_status(readstat_insert_missing_value(writer, tempvar)) * continue # <<<<<<<<<<<<<< * * if curuser_missing and curtype in pywriter_numeric_types: */ - goto __pyx_L105_continue; + goto __pyx_L112_continue; - /* "pyreadstat/_readstat_writer.pyx":826 + /* "pyreadstat/_readstat_writer.pyx":803 * if is_missing: * #if curval is None or (type(curval) in numeric_types and np.isnan(curval)): * if pd.isna(curval): # <<<<<<<<<<<<<< @@ -13136,7 +14962,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":824 + /* "pyreadstat/_readstat_writer.pyx":801 * curuser_missing = missing_user_values.get(col_names[col_indx]) * * if is_missing: # <<<<<<<<<<<<<< @@ -13145,63 +14971,61 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":830 + /* "pyreadstat/_readstat_writer.pyx":807 * continue * * if curuser_missing and curtype in pywriter_numeric_types: # <<<<<<<<<<<<<< * if curval in curuser_missing: * check_exit_status(readstat_insert_tagged_missing_value(writer, tempvar, ord(curval))) */ - __pyx_t_31 = __Pyx_PyObject_IsTrue(__pyx_v_curuser_missing); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 830, __pyx_L49_error) - if (__pyx_t_31) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_curuser_missing); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 807, __pyx_L55_error) + if (__pyx_t_4) { } else { - __pyx_t_4 = __pyx_t_31; - goto __pyx_L111_bool_binop_done; + __pyx_t_3 = __pyx_t_4; + goto __pyx_L118_bool_binop_done; } - __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 830, __pyx_L49_error) + __PYX_ERR(0, 807, __pyx_L55_error) } - __pyx_t_31 = (__Pyx_PySet_ContainsTF(__pyx_t_1, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_EQ)); if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 830, __pyx_L49_error) + __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_t_1, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 807, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_31 != 0); - __pyx_t_4 = __pyx_t_3; - __pyx_L111_bool_binop_done:; - if (__pyx_t_4) { + __pyx_t_3 = __pyx_t_4; + __pyx_L118_bool_binop_done:; + if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":831 + /* "pyreadstat/_readstat_writer.pyx":808 * * if curuser_missing and curtype in pywriter_numeric_types: * if curval in curuser_missing: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_tagged_missing_value(writer, tempvar, ord(curval))) * continue */ - __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_curval, __pyx_v_curuser_missing, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 831, __pyx_L49_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_curval, __pyx_v_curuser_missing, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 808, __pyx_L55_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":832 + /* "pyreadstat/_readstat_writer.pyx":809 * if curuser_missing and curtype in pywriter_numeric_types: * if curval in curuser_missing: * check_exit_status(readstat_insert_tagged_missing_value(writer, tempvar, ord(curval))) # <<<<<<<<<<<<<< * continue * */ - __pyx_t_13 = __Pyx_PyObject_Ord(__pyx_v_curval); if (unlikely(__pyx_t_13 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 832, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_tagged_missing_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_13)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 832, __pyx_L49_error) + __pyx_t_14 = __Pyx_PyObject_Ord(__pyx_v_curval); if (unlikely(__pyx_t_14 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 809, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_tagged_missing_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_14)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 809, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":833 + /* "pyreadstat/_readstat_writer.pyx":810 * if curval in curuser_missing: * check_exit_status(readstat_insert_tagged_missing_value(writer, tempvar, ord(curval))) * continue # <<<<<<<<<<<<<< * * if curtype == PYWRITER_DOUBLE: */ - goto __pyx_L105_continue; + goto __pyx_L112_continue; - /* "pyreadstat/_readstat_writer.pyx":831 + /* "pyreadstat/_readstat_writer.pyx":808 * * if curuser_missing and curtype in pywriter_numeric_types: * if curval in curuser_missing: # <<<<<<<<<<<<<< @@ -13210,7 +15034,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":830 + /* "pyreadstat/_readstat_writer.pyx":807 * continue * * if curuser_missing and curtype in pywriter_numeric_types: # <<<<<<<<<<<<<< @@ -13219,268 +15043,272 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":835 + /* "pyreadstat/_readstat_writer.pyx":812 * continue * * if curtype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype == PYWRITER_INTEGER: */ - __pyx_t_3 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE) != 0); + __pyx_t_3 = (__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":836 + /* "pyreadstat/_readstat_writer.pyx":813 * * if curtype == PYWRITER_DOUBLE: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) # <<<<<<<<<<<<<< * elif curtype == PYWRITER_INTEGER: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) */ - __pyx_t_34 = __pyx_PyFloat_AsDouble(__pyx_v_curval); if (unlikely((__pyx_t_34 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 836, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, ((double)__pyx_t_34))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 836, __pyx_L49_error) + __pyx_t_33 = __pyx_PyFloat_AsDouble(__pyx_v_curval); if (unlikely((__pyx_t_33 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 813, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, ((double)__pyx_t_33))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 813, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":835 + /* "pyreadstat/_readstat_writer.pyx":812 * continue * * if curtype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype == PYWRITER_INTEGER: */ - goto __pyx_L114; + goto __pyx_L121; } - /* "pyreadstat/_readstat_writer.pyx":837 + /* "pyreadstat/_readstat_writer.pyx":814 * if curtype == PYWRITER_DOUBLE: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype == PYWRITER_INTEGER: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_LOGICAL: */ - __pyx_t_3 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER) != 0); + __pyx_t_3 = (__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":838 + /* "pyreadstat/_readstat_writer.pyx":815 * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype == PYWRITER_INTEGER: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) # <<<<<<<<<<<<<< * elif curtype == PYWRITER_LOGICAL: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) */ - __pyx_t_35 = __Pyx_PyInt_As_int32_t(__pyx_v_curval); if (unlikely((__pyx_t_35 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 838, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_35)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 838, __pyx_L49_error) + __pyx_t_34 = __Pyx_PyInt_As_int32_t(__pyx_v_curval); if (unlikely((__pyx_t_34 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_34)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":837 + /* "pyreadstat/_readstat_writer.pyx":814 * if curtype == PYWRITER_DOUBLE: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype == PYWRITER_INTEGER: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_LOGICAL: */ - goto __pyx_L114; + goto __pyx_L121; } - /* "pyreadstat/_readstat_writer.pyx":839 + /* "pyreadstat/_readstat_writer.pyx":816 * elif curtype == PYWRITER_INTEGER: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_LOGICAL: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_CHARACTER: */ - __pyx_t_3 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL) != 0); + __pyx_t_3 = (__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":840 + /* "pyreadstat/_readstat_writer.pyx":817 * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_LOGICAL: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) # <<<<<<<<<<<<<< * elif curtype == PYWRITER_CHARACTER: * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) */ - __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_v_curval); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, ((int)__pyx_t_27))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L49_error) + __pyx_t_25 = __Pyx_PyInt_As_int(__pyx_v_curval); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, ((int)__pyx_t_25))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":839 + /* "pyreadstat/_readstat_writer.pyx":816 * elif curtype == PYWRITER_INTEGER: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_LOGICAL: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_CHARACTER: */ - goto __pyx_L114; + goto __pyx_L121; } - /* "pyreadstat/_readstat_writer.pyx":841 + /* "pyreadstat/_readstat_writer.pyx":818 * elif curtype == PYWRITER_LOGICAL: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_CHARACTER: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) * elif curtype == PYWRITER_OBJECT: */ - __pyx_t_3 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER) != 0); + __pyx_t_3 = (__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":842 + /* "pyreadstat/_readstat_writer.pyx":819 * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_CHARACTER: * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) # <<<<<<<<<<<<<< * elif curtype == PYWRITER_OBJECT: * curvalstr = str(curval) */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 842, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 819, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_25 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_utf_8); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 842, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_36 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_36) && PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_36)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L49_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_s_utf_8}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_35 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_35) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_35)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":841 + /* "pyreadstat/_readstat_writer.pyx":818 * elif curtype == PYWRITER_LOGICAL: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_CHARACTER: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) * elif curtype == PYWRITER_OBJECT: */ - goto __pyx_L114; + goto __pyx_L121; } - /* "pyreadstat/_readstat_writer.pyx":843 + /* "pyreadstat/_readstat_writer.pyx":820 * elif curtype == PYWRITER_CHARACTER: * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) * elif curtype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) */ - __pyx_t_3 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT) != 0); + __pyx_t_3 = (__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":844 + /* "pyreadstat/_readstat_writer.pyx":821 * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) * elif curtype == PYWRITER_OBJECT: * curvalstr = str(curval) # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) * elif curtype == PYWRITER_DATETIME64: */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_curval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyObject_Str(__pyx_v_curval); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 844, __pyx_L49_error) + if (!(likely(PyString_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 821, __pyx_L55_error) __Pyx_XDECREF_SET(__pyx_v_curvalstr, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":845 + /* "pyreadstat/_readstat_writer.pyx":822 * elif curtype == PYWRITER_OBJECT: * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) # <<<<<<<<<<<<<< * elif curtype == PYWRITER_DATETIME64: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) */ - __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_curvalstr, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L49_error) + __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_curvalstr, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_36 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_36) && PyErr_Occurred())) __PYX_ERR(0, 845, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_36)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 845, __pyx_L49_error) + __pyx_t_35 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_35) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_35)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":843 + /* "pyreadstat/_readstat_writer.pyx":820 * elif curtype == PYWRITER_CHARACTER: * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) * elif curtype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) */ - goto __pyx_L114; + goto __pyx_L121; } - /* "pyreadstat/_readstat_writer.pyx":846 + /* "pyreadstat/_readstat_writer.pyx":823 * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) * elif curtype == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype in pyrwriter_datetimelike_types: */ - __pyx_t_3 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64) != 0); + __pyx_t_3 = (__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":847 + /* "pyreadstat/_readstat_writer.pyx":824 * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) * elif curtype == PYWRITER_DATETIME64: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) # <<<<<<<<<<<<<< * elif curtype in pyrwriter_datetimelike_types: * dtimelikeval = convert_datetimelike_to_number(file_format, curtype, curval) */ - __pyx_t_34 = __pyx_PyFloat_AsDouble(__pyx_v_curval); if (unlikely((__pyx_t_34 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 847, __pyx_L49_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, ((double)__pyx_t_34))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 847, __pyx_L49_error) + __pyx_t_33 = __pyx_PyFloat_AsDouble(__pyx_v_curval); if (unlikely((__pyx_t_33 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 824, __pyx_L55_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, ((double)__pyx_t_33))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 824, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":846 + /* "pyreadstat/_readstat_writer.pyx":823 * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) * elif curtype == PYWRITER_DATETIME64: # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype in pyrwriter_datetimelike_types: */ - goto __pyx_L114; + goto __pyx_L121; } - /* "pyreadstat/_readstat_writer.pyx":848 + /* "pyreadstat/_readstat_writer.pyx":825 * elif curtype == PYWRITER_DATETIME64: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype in pyrwriter_datetimelike_types: # <<<<<<<<<<<<<< * dtimelikeval = convert_datetimelike_to_number(file_format, curtype, curval) * check_exit_status(readstat_insert_double_value(writer, tempvar, dtimelikeval)) */ - __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 848, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 848, __pyx_L49_error) + __PYX_ERR(0, 825, __pyx_L55_error) } - __pyx_t_3 = (__Pyx_PySet_ContainsTF(__pyx_t_1, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 848, __pyx_L49_error) + __pyx_t_3 = (__Pyx_PySet_ContainsTF(__pyx_t_1, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 825, __pyx_L55_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = (__pyx_t_3 != 0); - if (likely(__pyx_t_4)) { + if (likely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":849 + /* "pyreadstat/_readstat_writer.pyx":826 * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype in pyrwriter_datetimelike_types: * dtimelikeval = convert_datetimelike_to_number(file_format, curtype, curval) # <<<<<<<<<<<<<< * check_exit_status(readstat_insert_double_value(writer, tempvar, dtimelikeval)) * else: */ - __pyx_t_34 = __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_number(__pyx_v_file_format, __pyx_v_curtype, __pyx_v_curval); if (unlikely(__pyx_t_34 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 849, __pyx_L49_error) - __pyx_v_dtimelikeval = __pyx_t_34; + __pyx_t_33 = __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_number(__pyx_v_file_format, __pyx_v_curtype, __pyx_v_curval); if (unlikely(__pyx_t_33 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 826, __pyx_L55_error) + __pyx_v_dtimelikeval = __pyx_t_33; - /* "pyreadstat/_readstat_writer.pyx":850 + /* "pyreadstat/_readstat_writer.pyx":827 * elif curtype in pyrwriter_datetimelike_types: * dtimelikeval = convert_datetimelike_to_number(file_format, curtype, curval) * check_exit_status(readstat_insert_double_value(writer, tempvar, dtimelikeval)) # <<<<<<<<<<<<<< * else: * raise PyreadstatError("Unknown data format to insert") */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_v_dtimelikeval)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_v_dtimelikeval)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 827, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":848 + /* "pyreadstat/_readstat_writer.pyx":825 * elif curtype == PYWRITER_DATETIME64: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype in pyrwriter_datetimelike_types: # <<<<<<<<<<<<<< * dtimelikeval = convert_datetimelike_to_number(file_format, curtype, curval) * check_exit_status(readstat_insert_double_value(writer, tempvar, dtimelikeval)) */ - goto __pyx_L114; + goto __pyx_L121; } - /* "pyreadstat/_readstat_writer.pyx":852 + /* "pyreadstat/_readstat_writer.pyx":829 * check_exit_status(readstat_insert_double_value(writer, tempvar, dtimelikeval)) * else: * raise PyreadstatError("Unknown data format to insert") # <<<<<<<<<<<<<< @@ -13488,53 +15316,58 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * check_exit_status(readstat_end_row(writer)) */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 852, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 829, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_9); __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_25 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_25 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_kp_s_Unknown_data_format_to_insert) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_s_Unknown_data_format_to_insert); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 852, __pyx_L49_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_s_Unknown_data_format_to_insert}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_25, 1+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L55_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 852, __pyx_L49_error) + __PYX_ERR(0, 829, __pyx_L55_error) } - __pyx_L114:; - __pyx_L105_continue:; + __pyx_L121:; + __pyx_L112_continue:; } - /* "pyreadstat/_readstat_writer.pyx":854 + /* "pyreadstat/_readstat_writer.pyx":831 * raise PyreadstatError("Unknown data format to insert") * * check_exit_status(readstat_end_row(writer)) # <<<<<<<<<<<<<< * rowcnt += 1 * */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_end_row(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 854, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_end_row(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 831, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":855 + /* "pyreadstat/_readstat_writer.pyx":832 * * check_exit_status(readstat_end_row(writer)) * rowcnt += 1 # <<<<<<<<<<<<<< * * check_exit_status(readstat_end_writing(writer)) */ - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_rowcnt, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L49_error) + __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_rowcnt, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L55_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_rowcnt, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/_readstat_writer.pyx":810 + /* "pyreadstat/_readstat_writer.pyx":787 * rowcnt = 0 * * for row in df2.values: # <<<<<<<<<<<<<< @@ -13542,18 +15375,18 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * */ } - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "pyreadstat/_readstat_writer.pyx":857 + /* "pyreadstat/_readstat_writer.pyx":834 * rowcnt += 1 * * check_exit_status(readstat_end_writing(writer)) # <<<<<<<<<<<<<< * * except: */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_end_writing(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L49_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_end_writing(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 834, __pyx_L55_error) - /* "pyreadstat/_readstat_writer.pyx":674 + /* "pyreadstat/_readstat_writer.pyx":651 * writer = readstat_writer_init() * * try: # <<<<<<<<<<<<<< @@ -13561,21 +15394,21 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d * check_exit_status(readstat_set_data_writer(writer, write_bytes)) */ } + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; __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_L54_try_end; - __pyx_L49_error:; + goto __pyx_L60_try_end; + __pyx_L55_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":859 + /* "pyreadstat/_readstat_writer.pyx":836 * check_exit_status(readstat_end_writing(writer)) * * except: # <<<<<<<<<<<<<< @@ -13584,44 +15417,44 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ /*except:*/ { __Pyx_AddTraceback("pyreadstat._readstat_writer.run_write", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_1, &__pyx_t_8) < 0) __PYX_ERR(0, 859, __pyx_L51_except_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_8); + if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 836, __pyx_L57_except_error) + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_9); - /* "pyreadstat/_readstat_writer.pyx":860 + /* "pyreadstat/_readstat_writer.pyx":837 * * except: * raise # <<<<<<<<<<<<<< * finally: * readstat_writer_free(writer) */ - __Pyx_GIVEREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ErrRestoreWithState(__pyx_t_14, __pyx_t_1, __pyx_t_8); - __pyx_t_14 = 0; __pyx_t_1 = 0; __pyx_t_8 = 0; - __PYX_ERR(0, 860, __pyx_L51_except_error) + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestoreWithState(__pyx_t_15, __pyx_t_1, __pyx_t_9); + __pyx_t_15 = 0; __pyx_t_1 = 0; __pyx_t_9 = 0; + __PYX_ERR(0, 837, __pyx_L57_except_error) } - __pyx_L51_except_error:; - /* "pyreadstat/_readstat_writer.pyx":674 + /* "pyreadstat/_readstat_writer.pyx":651 * writer = readstat_writer_init() * * try: # <<<<<<<<<<<<<< * * check_exit_status(readstat_set_data_writer(writer, write_bytes)) */ + __pyx_L57_except_error:; + __Pyx_XGIVEREF(__pyx_t_18); __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_L47_error; - __pyx_L54_try_end:; + __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_17, __pyx_t_16); + goto __pyx_L53_error; + __pyx_L60_try_end:; } } - /* "pyreadstat/_readstat_writer.pyx":862 + /* "pyreadstat/_readstat_writer.pyx":839 * raise * finally: * readstat_writer_free(writer) # <<<<<<<<<<<<<< @@ -13632,41 +15465,41 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d /*normal exit:*/{ readstat_writer_free(__pyx_v_writer); - /* "pyreadstat/_readstat_writer.pyx":863 + /* "pyreadstat/_readstat_writer.pyx":840 * finally: * readstat_writer_free(writer) * close_file(fd) # <<<<<<<<<<<<<< * * return 0 */ - (void)(__pyx_f_10pyreadstat_16_readstat_writer_close_file(__pyx_v_fd)); - goto __pyx_L48; + __pyx_t_6 = __pyx_f_10pyreadstat_16_readstat_writer_close_file(__pyx_v_fd); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L1_error) + goto __pyx_L54; } - __pyx_L47_error:; + __pyx_L53_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_38 = 0; __pyx_t_39 = 0; __pyx_t_40 = 0; + __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_37 = 0; __pyx_t_38 = 0; __pyx_t_39 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 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_38, &__pyx_t_39, &__pyx_t_40); - 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); + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_37, &__pyx_t_38, &__pyx_t_39); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_t_37); __Pyx_XGOTREF(__pyx_t_38); __Pyx_XGOTREF(__pyx_t_39); - __Pyx_XGOTREF(__pyx_t_40); - __pyx_t_18 = __pyx_lineno; __pyx_t_23 = __pyx_clineno; __pyx_t_37 = __pyx_filename; + __pyx_t_6 = __pyx_lineno; __pyx_t_23 = __pyx_clineno; __pyx_t_36 = __pyx_filename; { - /* "pyreadstat/_readstat_writer.pyx":862 + /* "pyreadstat/_readstat_writer.pyx":839 * raise * finally: * readstat_writer_free(writer) # <<<<<<<<<<<<<< @@ -13675,33 +15508,45 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ readstat_writer_free(__pyx_v_writer); - /* "pyreadstat/_readstat_writer.pyx":863 + /* "pyreadstat/_readstat_writer.pyx":840 * finally: * readstat_writer_free(writer) * close_file(fd) # <<<<<<<<<<<<<< * * return 0 */ - (void)(__pyx_f_10pyreadstat_16_readstat_writer_close_file(__pyx_v_fd)); + __pyx_t_24 = __pyx_f_10pyreadstat_16_readstat_writer_close_file(__pyx_v_fd); if (unlikely(__pyx_t_24 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 840, __pyx_L126_error) } if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_37); __Pyx_XGIVEREF(__pyx_t_38); __Pyx_XGIVEREF(__pyx_t_39); - __Pyx_XGIVEREF(__pyx_t_40); - __Pyx_ExceptionReset(__pyx_t_38, __pyx_t_39, __pyx_t_40); + __Pyx_ExceptionReset(__pyx_t_37, __pyx_t_38, __pyx_t_39); } - __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_38 = 0; __pyx_t_39 = 0; __pyx_t_40 = 0; - __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_23; __pyx_filename = __pyx_t_37; + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18); + __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_37 = 0; __pyx_t_38 = 0; __pyx_t_39 = 0; + __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_23; __pyx_filename = __pyx_t_36; + goto __pyx_L1_error; + __pyx_L126_error:; + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_37); + __Pyx_XGIVEREF(__pyx_t_38); + __Pyx_XGIVEREF(__pyx_t_39); + __Pyx_ExceptionReset(__pyx_t_37, __pyx_t_38, __pyx_t_39); + } + __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_37 = 0; __pyx_t_38 = 0; __pyx_t_39 = 0; goto __pyx_L1_error; } - __pyx_L48:; + __pyx_L54:; } - /* "pyreadstat/_readstat_writer.pyx":865 + /* "pyreadstat/_readstat_writer.pyx":842 * close_file(fd) * * return 0 # <<<<<<<<<<<<<< @@ -13709,7 +15554,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_r = 0; goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":560 + /* "pyreadstat/_readstat_writer.pyx":546 * return close(fd) * * cdef int run_write(df, object filename_path, dst_file_format file_format, str file_label, object column_labels, # <<<<<<<<<<<<<< @@ -13722,9 +15567,9 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_15); __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_AddTraceback("pyreadstat._readstat_writer.run_write", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -13774,38 +15619,6 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec__readstat_writer(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec__readstat_writer}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "_readstat_writer", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -13815,281 +15628,299 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_CategoricalDtype, __pyx_k_CategoricalDtype, sizeof(__pyx_k_CategoricalDtype), 0, 0, 1, 1}, - {&__pyx_kp_s_Column_labels_must_be_strings, __pyx_k_Column_labels_must_be_strings, sizeof(__pyx_k_Column_labels_must_be_strings), 0, 0, 1, 0}, - {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1}, - {&__pyx_n_s_Float32Dtype, __pyx_k_Float32Dtype, sizeof(__pyx_k_Float32Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_Float64Dtype, __pyx_k_Float64Dtype, sizeof(__pyx_k_Float64Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_Int16Dtype, __pyx_k_Int16Dtype, sizeof(__pyx_k_Int16Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_Int32Dtype, __pyx_k_Int32Dtype, sizeof(__pyx_k_Int32Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_Int64Dtype, __pyx_k_Int64Dtype, sizeof(__pyx_k_Int64Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_Int8Dtype, __pyx_k_Int8Dtype, sizeof(__pyx_k_Int8Dtype), 0, 0, 1, 1}, - {&__pyx_kp_s_M8_ns, __pyx_k_M8_ns, sizeof(__pyx_k_M8_ns), 0, 0, 1, 0}, - {&__pyx_kp_s_Non_unique_column_names_detected, __pyx_k_Non_unique_column_names_detected, sizeof(__pyx_k_Non_unique_column_names_detected), 0, 0, 1, 0}, - {&__pyx_n_s_PyreadstatError, __pyx_k_PyreadstatError, sizeof(__pyx_k_PyreadstatError), 0, 0, 1, 1}, - {&__pyx_n_s_ReadstatError, __pyx_k_ReadstatError, sizeof(__pyx_k_ReadstatError), 0, 0, 1, 1}, - {&__pyx_n_s_Timestamp, __pyx_k_Timestamp, sizeof(__pyx_k_Timestamp), 0, 0, 1, 1}, - {&__pyx_n_s_UInt16Dtype, __pyx_k_UInt16Dtype, sizeof(__pyx_k_UInt16Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_UInt32Dtype, __pyx_k_UInt32Dtype, sizeof(__pyx_k_UInt32Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_UInt64Dtype, __pyx_k_UInt64Dtype, sizeof(__pyx_k_UInt64Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_UInt8Dtype, __pyx_k_UInt8Dtype, sizeof(__pyx_k_UInt8Dtype), 0, 0, 1, 1}, - {&__pyx_n_s_UnicodeError, __pyx_k_UnicodeError, sizeof(__pyx_k_UnicodeError), 0, 0, 1, 1}, - {&__pyx_kp_s_Unknown_data_format_to_insert, __pyx_k_Unknown_data_format_to_insert, sizeof(__pyx_k_Unknown_data_format_to_insert), 0, 0, 1, 0}, - {&__pyx_kp_s_Unknown_pywriter_variable_format, __pyx_k_Unknown_pywriter_variable_format, sizeof(__pyx_k_Unknown_pywriter_variable_format), 0, 0, 1, 0}, - {&__pyx_n_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 1}, - {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, - {&__pyx_kp_s_alignment_for_variable_s_must_be, __pyx_k_alignment_for_variable_s_must_be, sizeof(__pyx_k_alignment_for_variable_s_must_be), 0, 0, 1, 0}, - {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1}, - {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, - {&__pyx_n_s_asm8, __pyx_k_asm8, sizeof(__pyx_k_asm8), 0, 0, 1, 1}, - {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, - {&__pyx_n_s_calendar, __pyx_k_calendar, sizeof(__pyx_k_calendar), 0, 0, 1, 1}, - {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1}, - {&__pyx_kp_s_character_missing_ranges_value_g, __pyx_k_character_missing_ranges_value_g, sizeof(__pyx_k_character_missing_ranges_value_g), 0, 0, 1, 0}, - {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_kp_s_column_labels_must_be_either_lis, __pyx_k_column_labels_must_be_either_lis, sizeof(__pyx_k_column_labels_must_be_either_lis), 0, 0, 1, 0}, - {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1}, - {&__pyx_n_s_combine, __pyx_k_combine, sizeof(__pyx_k_combine), 0, 0, 1, 1}, - {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, - {&__pyx_n_s_core, __pyx_k_core, sizeof(__pyx_k_core), 0, 0, 1, 1}, - {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1}, - {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1}, - {&__pyx_n_s_datetime64, __pyx_k_datetime64, sizeof(__pyx_k_datetime64), 0, 0, 1, 1}, - {&__pyx_kp_s_datetime64_ms, __pyx_k_datetime64_ms, sizeof(__pyx_k_datetime64_ms), 0, 0, 1, 0}, - {&__pyx_kp_s_datetime64_ns, __pyx_k_datetime64_ns, sizeof(__pyx_k_datetime64_ns), 0, 0, 1, 0}, - {&__pyx_kp_s_datetime64_us, __pyx_k_datetime64_us, sizeof(__pyx_k_datetime64_us), 0, 0, 1, 0}, - {&__pyx_n_s_days, __pyx_k_days, sizeof(__pyx_k_days), 0, 0, 1, 1}, - {&__pyx_kp_s_dictionaries_in_missing_ranges_m, __pyx_k_dictionaries_in_missing_ranges_m, sizeof(__pyx_k_dictionaries_in_missing_ranges_m), 0, 0, 1, 0}, - {&__pyx_n_s_drop, __pyx_k_drop, sizeof(__pyx_k_drop), 0, 0, 1, 1}, - {&__pyx_n_s_dropna, __pyx_k_dropna, sizeof(__pyx_k_dropna), 0, 0, 1, 1}, - {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_dtypes, __pyx_k_dtypes, sizeof(__pyx_k_dtypes), 0, 0, 1, 1}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1}, - {&__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_k_file_path_could_not_be_encoded_w, sizeof(__pyx_k_file_path_could_not_be_encoded_w), 0, 0, 1, 0}, - {&__pyx_kp_s_first_argument_must_be_a_pandas, __pyx_k_first_argument_must_be_a_pandas, sizeof(__pyx_k_first_argument_must_be_a_pandas), 0, 0, 1, 0}, - {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1}, - {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, - {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, - {&__pyx_n_s_fsdecode, __pyx_k_fsdecode, sizeof(__pyx_k_fsdecode), 0, 0, 1, 1}, - {&__pyx_n_s_fsencode, __pyx_k_fsencode, sizeof(__pyx_k_fsencode), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1}, - {&__pyx_n_s_hi, __pyx_k_hi, sizeof(__pyx_k_hi), 0, 0, 1, 1}, - {&__pyx_n_s_iloc, __pyx_k_iloc, sizeof(__pyx_k_iloc), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1}, - {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, - {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1}, - {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, - {&__pyx_n_s_is_datetime64_any_dtype, __pyx_k_is_datetime64_any_dtype, sizeof(__pyx_k_is_datetime64_any_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_is_datetime64_ns_dtype, __pyx_k_is_datetime64_ns_dtype, sizeof(__pyx_k_is_datetime64_ns_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_isalpha, __pyx_k_isalpha, sizeof(__pyx_k_isalpha), 0, 0, 1, 1}, - {&__pyx_n_s_isin, __pyx_k_isin, sizeof(__pyx_k_isin), 0, 0, 1, 1}, - {&__pyx_n_s_isna, __pyx_k_isna, sizeof(__pyx_k_isna), 0, 0, 1, 1}, - {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, - {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, - {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1}, - {&__pyx_kp_s_length_of_column_labels_must_be, __pyx_k_length_of_column_labels_must_be, sizeof(__pyx_k_length_of_column_labels_must_be), 0, 0, 1, 0}, - {&__pyx_n_s_libs, __pyx_k_libs, sizeof(__pyx_k_libs), 0, 0, 1, 1}, - {&__pyx_n_s_lo, __pyx_k_lo, sizeof(__pyx_k_lo), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_kp_s_measure_for_variable_s_must_be_e, __pyx_k_measure_for_variable_s_must_be_e, sizeof(__pyx_k_measure_for_variable_s_must_be_e), 0, 0, 1, 0}, - {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1}, - {&__pyx_kp_s_missing_ranges_hi_and_lo_values, __pyx_k_missing_ranges_hi_and_lo_values, sizeof(__pyx_k_missing_ranges_hi_and_lo_values), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_hi_and_lo_values_2, __pyx_k_missing_ranges_hi_and_lo_values_2, sizeof(__pyx_k_missing_ranges_hi_and_lo_values_2), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_max_1_discrete_nu, __pyx_k_missing_ranges_max_1_discrete_nu, sizeof(__pyx_k_missing_ranges_max_1_discrete_nu), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_max_1_range_value, __pyx_k_missing_ranges_max_1_range_value, sizeof(__pyx_k_missing_ranges_max_1_range_value), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_max_3_discrete_nu, __pyx_k_missing_ranges_max_3_discrete_nu, sizeof(__pyx_k_missing_ranges_max_3_discrete_nu), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_max_3_string_valu, __pyx_k_missing_ranges_max_3_string_valu, sizeof(__pyx_k_missing_ranges_max_3_string_valu), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_string_values_len, __pyx_k_missing_ranges_string_values_len, sizeof(__pyx_k_missing_ranges_string_values_len), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_values_in_diction, __pyx_k_missing_ranges_values_in_diction, sizeof(__pyx_k_missing_ranges_values_in_diction), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_ranges_values_must_be_bo, __pyx_k_missing_ranges_values_must_be_bo, sizeof(__pyx_k_missing_ranges_values_must_be_bo), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_user_values_not_allowed, __pyx_k_missing_user_values_not_allowed, sizeof(__pyx_k_missing_user_values_not_allowed), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_user_values_supports_val, __pyx_k_missing_user_values_supports_val, sizeof(__pyx_k_missing_user_values_supports_val), 0, 0, 1, 0}, - {&__pyx_kp_s_missing_user_values_values_in_di, __pyx_k_missing_user_values_values_in_di, sizeof(__pyx_k_missing_user_values_values_in_di), 0, 0, 1, 0}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, - {&__pyx_n_s_nominal, __pyx_k_nominal, sizeof(__pyx_k_nominal), 0, 0, 1, 1}, - {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, - {&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1}, - {&__pyx_kp_s_numeric_missing_ranges_value_giv, __pyx_k_numeric_missing_ranges_value_giv, sizeof(__pyx_k_numeric_missing_ranges_value_giv), 0, 0, 1, 0}, - {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_ordinal, __pyx_k_ordinal, sizeof(__pyx_k_ordinal), 0, 0, 1, 1}, - {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1}, - {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, - {&__pyx_n_s_pandas_api_types, __pyx_k_pandas_api_types, sizeof(__pyx_k_pandas_api_types), 0, 0, 1, 1}, - {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, - {&__pyx_kp_s_path_must_be_either_str_or_bytes, __pyx_k_path_must_be_either_str_or_bytes, sizeof(__pyx_k_path_must_be_either_str_or_bytes), 0, 0, 1, 0}, - {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_readstat_parser, __pyx_k_readstat_parser, sizeof(__pyx_k_readstat_parser), 0, 0, 1, 1}, - {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1}, - {&__pyx_n_s_reset_index, __pyx_k_reset_index, sizeof(__pyx_k_reset_index), 0, 0, 1, 1}, - {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1}, - {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1}, - {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, - {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1}, - {&__pyx_n_s_surrogateescape, __pyx_k_surrogateescape, sizeof(__pyx_k_surrogateescape), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1}, - {&__pyx_n_s_timegm, __pyx_k_timegm, sizeof(__pyx_k_timegm), 0, 0, 1, 1}, - {&__pyx_n_s_timestamps, __pyx_k_timestamps, sizeof(__pyx_k_timestamps), 0, 0, 1, 1}, - {&__pyx_n_s_timetuple, __pyx_k_timetuple, sizeof(__pyx_k_timetuple), 0, 0, 1, 1}, - {&__pyx_n_s_timezone, __pyx_k_timezone, sizeof(__pyx_k_timezone), 0, 0, 1, 1}, - {&__pyx_n_s_timezone_2, __pyx_k_timezone_2, sizeof(__pyx_k_timezone_2), 0, 0, 1, 1}, - {&__pyx_n_s_tolist, __pyx_k_tolist, sizeof(__pyx_k_tolist), 0, 0, 1, 1}, - {&__pyx_n_s_total_seconds, __pyx_k_total_seconds, sizeof(__pyx_k_total_seconds), 0, 0, 1, 1}, - {&__pyx_n_s_tslibs, __pyx_k_tslibs, sizeof(__pyx_k_tslibs), 0, 0, 1, 1}, - {&__pyx_n_s_tzinfo, __pyx_k_tzinfo, sizeof(__pyx_k_tzinfo), 0, 0, 1, 1}, - {&__pyx_n_s_uint16, __pyx_k_uint16, sizeof(__pyx_k_uint16), 0, 0, 1, 1}, - {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1}, - {&__pyx_n_s_uint64, __pyx_k_uint64, sizeof(__pyx_k_uint64), 0, 0, 1, 1}, - {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1}, - {&__pyx_n_s_union, __pyx_k_union, sizeof(__pyx_k_union), 0, 0, 1, 1}, - {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1}, - {&__pyx_kp_s_unknown_file_format, __pyx_k_unknown_file_format, sizeof(__pyx_k_unknown_file_format), 0, 0, 1, 0}, - {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, - {&__pyx_n_s_utc, __pyx_k_utc, sizeof(__pyx_k_utc), 0, 0, 1, 1}, - {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0}, - {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, - {&__pyx_kp_s_variable_name_s_contains_a_space, __pyx_k_variable_name_s_contains_a_space, sizeof(__pyx_k_variable_name_s_contains_a_space), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_name_s_is_of_type_s_and, __pyx_k_variable_name_s_is_of_type_s_and, sizeof(__pyx_k_variable_name_s_is_of_type_s_and), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_name_s_starts_with_an_i, __pyx_k_variable_name_s_starts_with_an_i, sizeof(__pyx_k_variable_name_s_starts_with_an_i), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_value_labels_type_of_La, __pyx_k_variable_value_labels_type_of_La, sizeof(__pyx_k_variable_value_labels_type_of_La), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_value_labels_type_of_Va, __pyx_k_variable_value_labels_type_of_Va, sizeof(__pyx_k_variable_value_labels_type_of_Va), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_value_labels_type_of_Va_2, __pyx_k_variable_value_labels_type_of_Va_2, sizeof(__pyx_k_variable_value_labels_type_of_Va_2), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_value_labels_type_of_Va_3, __pyx_k_variable_value_labels_type_of_Va_3, sizeof(__pyx_k_variable_value_labels_type_of_Va_3), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_value_labels_type_of_Va_4, __pyx_k_variable_value_labels_type_of_Va_4, sizeof(__pyx_k_variable_value_labels_type_of_Va_4), 0, 0, 1, 0}, - {&__pyx_kp_s_variable_value_labels_value_for, __pyx_k_variable_value_labels_value_for, sizeof(__pyx_k_variable_value_labels_value_for), 0, 0, 1, 0}, - {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1}, - {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1}, - {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, - {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_CategoricalDtype, __pyx_k_CategoricalDtype, sizeof(__pyx_k_CategoricalDtype), 0, 0, 1, 1}, + {&__pyx_kp_s_Column_labels_must_be_strings, __pyx_k_Column_labels_must_be_strings, sizeof(__pyx_k_Column_labels_must_be_strings), 0, 0, 1, 0}, + {&__pyx_n_s_DataFrame, __pyx_k_DataFrame, sizeof(__pyx_k_DataFrame), 0, 0, 1, 1}, + {&__pyx_n_s_Float32Dtype, __pyx_k_Float32Dtype, sizeof(__pyx_k_Float32Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_Float64Dtype, __pyx_k_Float64Dtype, sizeof(__pyx_k_Float64Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_Int16Dtype, __pyx_k_Int16Dtype, sizeof(__pyx_k_Int16Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_Int32Dtype, __pyx_k_Int32Dtype, sizeof(__pyx_k_Int32Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_Int64Dtype, __pyx_k_Int64Dtype, sizeof(__pyx_k_Int64Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_Int8Dtype, __pyx_k_Int8Dtype, sizeof(__pyx_k_Int8Dtype), 0, 0, 1, 1}, + {&__pyx_kp_s_M8_ns, __pyx_k_M8_ns, sizeof(__pyx_k_M8_ns), 0, 0, 1, 0}, + {&__pyx_kp_s_Non_unique_column_names_detected, __pyx_k_Non_unique_column_names_detected, sizeof(__pyx_k_Non_unique_column_names_detected), 0, 0, 1, 0}, + {&__pyx_n_s_PyreadstatError, __pyx_k_PyreadstatError, sizeof(__pyx_k_PyreadstatError), 0, 0, 1, 1}, + {&__pyx_n_s_ReadstatError, __pyx_k_ReadstatError, sizeof(__pyx_k_ReadstatError), 0, 0, 1, 1}, + {&__pyx_n_s_Timestamp, __pyx_k_Timestamp, sizeof(__pyx_k_Timestamp), 0, 0, 1, 1}, + {&__pyx_n_s_UInt16Dtype, __pyx_k_UInt16Dtype, sizeof(__pyx_k_UInt16Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_UInt32Dtype, __pyx_k_UInt32Dtype, sizeof(__pyx_k_UInt32Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_UInt64Dtype, __pyx_k_UInt64Dtype, sizeof(__pyx_k_UInt64Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_UInt8Dtype, __pyx_k_UInt8Dtype, sizeof(__pyx_k_UInt8Dtype), 0, 0, 1, 1}, + {&__pyx_n_s_UnicodeError, __pyx_k_UnicodeError, sizeof(__pyx_k_UnicodeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unknown_data_format_to_insert, __pyx_k_Unknown_data_format_to_insert, sizeof(__pyx_k_Unknown_data_format_to_insert), 0, 0, 1, 0}, + {&__pyx_kp_s_Unknown_pywriter_variable_format, __pyx_k_Unknown_pywriter_variable_format, sizeof(__pyx_k_Unknown_pywriter_variable_format), 0, 0, 1, 0}, + {&__pyx_n_s__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 0, 1, 1}, + {&__pyx_n_s__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 0, 1, 1}, + {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, + {&__pyx_n_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 1}, + {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0}, + {&__pyx_kp_s_alignment_for_variable_s_must_be, __pyx_k_alignment_for_variable_s_must_be, sizeof(__pyx_k_alignment_for_variable_s_must_be), 0, 0, 1, 0}, + {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_asm8, __pyx_k_asm8, sizeof(__pyx_k_asm8), 0, 0, 1, 1}, + {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, + {&__pyx_n_s_calendar, __pyx_k_calendar, sizeof(__pyx_k_calendar), 0, 0, 1, 1}, + {&__pyx_n_s_center, __pyx_k_center, sizeof(__pyx_k_center), 0, 0, 1, 1}, + {&__pyx_kp_s_character_missing_ranges_value_g, __pyx_k_character_missing_ranges_value_g, sizeof(__pyx_k_character_missing_ranges_value_g), 0, 0, 1, 0}, + {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_kp_s_column_labels_must_be_either_lis, __pyx_k_column_labels_must_be_either_lis, sizeof(__pyx_k_column_labels_must_be_either_lis), 0, 0, 1, 0}, + {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1}, + {&__pyx_n_s_combine, __pyx_k_combine, sizeof(__pyx_k_combine), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_core, __pyx_k_core, sizeof(__pyx_k_core), 0, 0, 1, 1}, + {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1}, + {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1}, + {&__pyx_n_s_datetime64, __pyx_k_datetime64, sizeof(__pyx_k_datetime64), 0, 0, 1, 1}, + {&__pyx_kp_s_datetime64_ms, __pyx_k_datetime64_ms, sizeof(__pyx_k_datetime64_ms), 0, 0, 1, 0}, + {&__pyx_kp_s_datetime64_ns, __pyx_k_datetime64_ns, sizeof(__pyx_k_datetime64_ns), 0, 0, 1, 0}, + {&__pyx_kp_s_datetime64_us, __pyx_k_datetime64_us, sizeof(__pyx_k_datetime64_us), 0, 0, 1, 0}, + {&__pyx_n_s_days, __pyx_k_days, sizeof(__pyx_k_days), 0, 0, 1, 1}, + {&__pyx_kp_s_dictionaries_in_missing_ranges_m, __pyx_k_dictionaries_in_missing_ranges_m, sizeof(__pyx_k_dictionaries_in_missing_ranges_m), 0, 0, 1, 0}, + {&__pyx_n_s_drop, __pyx_k_drop, sizeof(__pyx_k_drop), 0, 0, 1, 1}, + {&__pyx_n_s_dropna, __pyx_k_dropna, sizeof(__pyx_k_dropna), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtypes, __pyx_k_dtypes, sizeof(__pyx_k_dtypes), 0, 0, 1, 1}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1}, + {&__pyx_kp_s_file_path_could_not_be_encoded_w, __pyx_k_file_path_could_not_be_encoded_w, sizeof(__pyx_k_file_path_could_not_be_encoded_w), 0, 0, 1, 0}, + {&__pyx_kp_s_first_argument_must_be_a_pandas, __pyx_k_first_argument_must_be_a_pandas, sizeof(__pyx_k_first_argument_must_be_a_pandas), 0, 0, 1, 0}, + {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1}, + {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_fsdecode, __pyx_k_fsdecode, sizeof(__pyx_k_fsdecode), 0, 0, 1, 1}, + {&__pyx_n_s_fsencode, __pyx_k_fsencode, sizeof(__pyx_k_fsencode), 0, 0, 1, 1}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1}, + {&__pyx_n_s_hi, __pyx_k_hi, sizeof(__pyx_k_hi), 0, 0, 1, 1}, + {&__pyx_n_s_iloc, __pyx_k_iloc, sizeof(__pyx_k_iloc), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int16, __pyx_k_int16, sizeof(__pyx_k_int16), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1}, + {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, + {&__pyx_n_s_is_datetime64_any_dtype, __pyx_k_is_datetime64_any_dtype, sizeof(__pyx_k_is_datetime64_any_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_is_datetime64_ns_dtype, __pyx_k_is_datetime64_ns_dtype, sizeof(__pyx_k_is_datetime64_ns_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_isalpha, __pyx_k_isalpha, sizeof(__pyx_k_isalpha), 0, 0, 1, 1}, + {&__pyx_n_s_isin, __pyx_k_isin, sizeof(__pyx_k_isin), 0, 0, 1, 1}, + {&__pyx_n_s_isna, __pyx_k_isna, sizeof(__pyx_k_isna), 0, 0, 1, 1}, + {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, + {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, + {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1}, + {&__pyx_kp_s_length_of_column_labels_must_be, __pyx_k_length_of_column_labels_must_be, sizeof(__pyx_k_length_of_column_labels_must_be), 0, 0, 1, 0}, + {&__pyx_n_s_libs, __pyx_k_libs, sizeof(__pyx_k_libs), 0, 0, 1, 1}, + {&__pyx_n_s_lo, __pyx_k_lo, sizeof(__pyx_k_lo), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_kp_s_measure_for_variable_s_must_be_e, __pyx_k_measure_for_variable_s_must_be_e, sizeof(__pyx_k_measure_for_variable_s_must_be_e), 0, 0, 1, 0}, + {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1}, + {&__pyx_kp_s_missing_ranges_hi_and_lo_values, __pyx_k_missing_ranges_hi_and_lo_values, sizeof(__pyx_k_missing_ranges_hi_and_lo_values), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_hi_and_lo_values_2, __pyx_k_missing_ranges_hi_and_lo_values_2, sizeof(__pyx_k_missing_ranges_hi_and_lo_values_2), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_max_1_discrete_nu, __pyx_k_missing_ranges_max_1_discrete_nu, sizeof(__pyx_k_missing_ranges_max_1_discrete_nu), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_max_1_range_value, __pyx_k_missing_ranges_max_1_range_value, sizeof(__pyx_k_missing_ranges_max_1_range_value), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_max_3_discrete_nu, __pyx_k_missing_ranges_max_3_discrete_nu, sizeof(__pyx_k_missing_ranges_max_3_discrete_nu), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_max_3_string_valu, __pyx_k_missing_ranges_max_3_string_valu, sizeof(__pyx_k_missing_ranges_max_3_string_valu), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_string_values_len, __pyx_k_missing_ranges_string_values_len, sizeof(__pyx_k_missing_ranges_string_values_len), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_values_in_diction, __pyx_k_missing_ranges_values_in_diction, sizeof(__pyx_k_missing_ranges_values_in_diction), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_ranges_values_must_be_bo, __pyx_k_missing_ranges_values_must_be_bo, sizeof(__pyx_k_missing_ranges_values_must_be_bo), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_user_values_not_allowed, __pyx_k_missing_user_values_not_allowed, sizeof(__pyx_k_missing_user_values_not_allowed), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_user_values_supports_val, __pyx_k_missing_user_values_supports_val, sizeof(__pyx_k_missing_user_values_supports_val), 0, 0, 1, 0}, + {&__pyx_kp_s_missing_user_values_values_in_di, __pyx_k_missing_user_values_values_in_di, sizeof(__pyx_k_missing_user_values_values_in_di), 0, 0, 1, 0}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_nominal, __pyx_k_nominal, sizeof(__pyx_k_nominal), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1}, + {&__pyx_kp_s_numeric_missing_ranges_value_giv, __pyx_k_numeric_missing_ranges_value_giv, sizeof(__pyx_k_numeric_missing_ranges_value_giv), 0, 0, 1, 0}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, + {&__pyx_n_s_ordinal, __pyx_k_ordinal, sizeof(__pyx_k_ordinal), 0, 0, 1, 1}, + {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1}, + {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, + {&__pyx_n_s_pandas_api_types, __pyx_k_pandas_api_types, sizeof(__pyx_k_pandas_api_types), 0, 0, 1, 1}, + {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, + {&__pyx_kp_s_path_must_be_either_str_or_bytes, __pyx_k_path_must_be_either_str_or_bytes, sizeof(__pyx_k_path_must_be_either_str_or_bytes), 0, 0, 1, 0}, + {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_readstat_parser, __pyx_k_readstat_parser, sizeof(__pyx_k_readstat_parser), 0, 0, 1, 1}, + {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1}, + {&__pyx_n_s_reset_index, __pyx_k_reset_index, sizeof(__pyx_k_reset_index), 0, 0, 1, 1}, + {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1}, + {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1}, + {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1}, + {&__pyx_n_s_surrogateescape, __pyx_k_surrogateescape, sizeof(__pyx_k_surrogateescape), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1}, + {&__pyx_n_s_timegm, __pyx_k_timegm, sizeof(__pyx_k_timegm), 0, 0, 1, 1}, + {&__pyx_n_s_timestamps, __pyx_k_timestamps, sizeof(__pyx_k_timestamps), 0, 0, 1, 1}, + {&__pyx_n_s_timetuple, __pyx_k_timetuple, sizeof(__pyx_k_timetuple), 0, 0, 1, 1}, + {&__pyx_n_s_timezone, __pyx_k_timezone, sizeof(__pyx_k_timezone), 0, 0, 1, 1}, + {&__pyx_n_s_timezone_2, __pyx_k_timezone_2, sizeof(__pyx_k_timezone_2), 0, 0, 1, 1}, + {&__pyx_n_s_tolist, __pyx_k_tolist, sizeof(__pyx_k_tolist), 0, 0, 1, 1}, + {&__pyx_n_s_total_seconds, __pyx_k_total_seconds, sizeof(__pyx_k_total_seconds), 0, 0, 1, 1}, + {&__pyx_n_s_tslibs, __pyx_k_tslibs, sizeof(__pyx_k_tslibs), 0, 0, 1, 1}, + {&__pyx_n_s_tzinfo, __pyx_k_tzinfo, sizeof(__pyx_k_tzinfo), 0, 0, 1, 1}, + {&__pyx_n_s_uint16, __pyx_k_uint16, sizeof(__pyx_k_uint16), 0, 0, 1, 1}, + {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1}, + {&__pyx_n_s_uint64, __pyx_k_uint64, sizeof(__pyx_k_uint64), 0, 0, 1, 1}, + {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1}, + {&__pyx_n_s_union, __pyx_k_union, sizeof(__pyx_k_union), 0, 0, 1, 1}, + {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1}, + {&__pyx_kp_s_unknown_file_format, __pyx_k_unknown_file_format, sizeof(__pyx_k_unknown_file_format), 0, 0, 1, 0}, + {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, + {&__pyx_n_s_utc, __pyx_k_utc, sizeof(__pyx_k_utc), 0, 0, 1, 1}, + {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0}, + {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, + {&__pyx_kp_s_variable_name_s_contains_a_space, __pyx_k_variable_name_s_contains_a_space, sizeof(__pyx_k_variable_name_s_contains_a_space), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_name_s_is_of_type_s_and, __pyx_k_variable_name_s_is_of_type_s_and, sizeof(__pyx_k_variable_name_s_is_of_type_s_and), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_name_s_starts_with_an_i, __pyx_k_variable_name_s_starts_with_an_i, sizeof(__pyx_k_variable_name_s_starts_with_an_i), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_value_labels_type_of_La, __pyx_k_variable_value_labels_type_of_La, sizeof(__pyx_k_variable_value_labels_type_of_La), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_value_labels_type_of_Va, __pyx_k_variable_value_labels_type_of_Va, sizeof(__pyx_k_variable_value_labels_type_of_Va), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_value_labels_type_of_Va_2, __pyx_k_variable_value_labels_type_of_Va_2, sizeof(__pyx_k_variable_value_labels_type_of_Va_2), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_value_labels_type_of_Va_3, __pyx_k_variable_value_labels_type_of_Va_3, sizeof(__pyx_k_variable_value_labels_type_of_Va_3), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_value_labels_type_of_Va_4, __pyx_k_variable_value_labels_type_of_Va_4, sizeof(__pyx_k_variable_value_labels_type_of_Va_4), 0, 0, 1, 0}, + {&__pyx_kp_s_variable_value_labels_value_for, __pyx_k_variable_value_labels_value_for, sizeof(__pyx_k_variable_value_labels_value_for), 0, 0, 1, 0}, + {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1}, + {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1}, + {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, + {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 61, __pyx_L1_error) - __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 61, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 233, __pyx_L1_error) - __pyx_builtin_UnicodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeError); if (!__pyx_builtin_UnicodeError) __PYX_ERR(0, 654, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_builtin_UnicodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeError); if (!__pyx_builtin_UnicodeError) __PYX_ERR(0, 636, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "pyreadstat/_readstat_writer.pyx":205 + /* "pyreadstat/_readstat_writer.pyx":202 * * max_length = 0 * curseries = df.iloc[:, indx] # <<<<<<<<<<<<<< * curuser_missing = None * if missing_user_values: */ - __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice_); __Pyx_GIVEREF(__pyx_slice_); - /* "pyreadstat/_readstat_writer.pyx":656 + /* "pyreadstat/_readstat_writer.pyx":638 * except UnicodeError: * warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) * filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") # <<<<<<<<<<<<<< * else: - * IF PY_MAJOR_VERSION >2: + * if type(filename_path) == str: */ - __pyx_tuple__3 = PyTuple_Pack(2, __pyx_kp_s_utf_8, __pyx_n_s_surrogateescape); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 656, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(2, __pyx_kp_s_utf_8, __pyx_n_s_surrogateescape); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "pyreadstat/_readstat_writer.pyx":38 + /* "pyreadstat/_readstat_writer.pyx":35 * from _readstat_parser cimport check_exit_status * * cdef set int_types = {int, np.dtype('int32'), np.dtype('int16'), np.dtype('int8'), np.dtype('uint8'), np.dtype('uint16'), # <<<<<<<<<<<<<< * np.int32, np.int16, np.int8, np.uint8, np.uint16} * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_int32); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_int16); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_int8); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_int32); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_uint8); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_int16); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_uint16); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_int8); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_uint8); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_uint16); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "pyreadstat/_readstat_writer.pyx":41 + /* "pyreadstat/_readstat_writer.pyx":38 * np.int32, np.int16, np.int8, np.uint8, np.uint16} * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), # <<<<<<<<<<<<<< * np.dtype('float32'), np.int64, np.uint64, np.uint32, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype(), * pd.Float64Dtype(), pd.Float32Dtype()} */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_int64); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_uint64); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_uint32); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_int64); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_float); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_uint64); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_uint32); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_float); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "pyreadstat/_readstat_writer.pyx":42 + /* "pyreadstat/_readstat_writer.pyx":39 * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), * np.dtype('float32'), np.int64, np.uint64, np.uint32, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype(), # <<<<<<<<<<<<<< * pd.Float64Dtype(), pd.Float32Dtype()} * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_float32); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_float32); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); - /* "pyreadstat/_readstat_writer.pyx":59 + /* "pyreadstat/_readstat_writer.pyx":56 * cdef double spss_offset_days = 141428 * cdef double sas_offset_days = 3653 * cdef object date_0 = datetime.datetime(1970,1,1).date() # <<<<<<<<<<<<<< * * cdef valid_user_missing_sas = [chr(x) for x in range(ord("A"), ord("Z")+1)] + ["_"] */ - __pyx_tuple__14 = PyTuple_Pack(3, __pyx_int_1970, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__16 = PyTuple_Pack(3, __pyx_int_1970, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_get.method_name = &__pyx_n_s_get; __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_items.method_name = &__pyx_n_s_items; __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_keys.method_name = &__pyx_n_s_keys; __pyx_umethod_PySet_Type_union.type = (PyObject*)&PySet_Type; + __pyx_umethod_PySet_Type_union.method_name = &__pyx_n_s_union; __pyx_umethod_PyString_Type_encode.type = (PyObject*)&PyString_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_umethod_PyString_Type_encode.method_name = &__pyx_n_s_encode; + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_float_1e9 = PyFloat_FromDouble(1e9); if (unlikely(!__pyx_float_1e9)) __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) @@ -14100,6 +15931,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -14176,10 +16013,9 @@ static int __Pyx_modinit_type_import_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 42, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_10pyreadstat_16_readstat_parser_data_container = __Pyx_ImportType(__pyx_t_1, "pyreadstat._readstat_parser", "data_container", sizeof(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_10pyreadstat_16_readstat_parser_data_container) __PYX_ERR(1, 42, __pyx_L1_error) + __pyx_ptype_10pyreadstat_16_readstat_parser_data_container = __Pyx_ImportType_3_0_0(__pyx_t_1, "pyreadstat._readstat_parser", "data_container", sizeof(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_10pyreadstat_16_readstat_parser_data_container) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -14199,22 +16035,22 @@ static int __Pyx_modinit_variable_import_code(void) { /*--- Variable import code ---*/ __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportVoidPtr(__pyx_t_1, "readstat_to_numpy_types", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "readstat_to_numpy_types", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -14234,7 +16070,7 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "check_exit_status", (void (**)(void))&__pyx_f_10pyreadstat_16_readstat_parser_check_exit_status, "void (readstat_error_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_0(__pyx_t_1, "check_exit_status", (void (**)(void))&__pyx_f_10pyreadstat_16_readstat_parser_check_exit_status, "void (readstat_error_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -14245,6 +16081,55 @@ static int __Pyx_modinit_function_import_code(void) { } +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec__readstat_writer(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec__readstat_writer}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "_readstat_writer", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 @@ -14295,12 +16180,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -14310,8 +16204,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -14321,8 +16216,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -14338,6 +16237,10 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__readstat_writer(PyObject *__pyx_p #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; @@ -14352,8 +16255,9 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__readstat_writer(PyObject *__pyx_p PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; - Py_ssize_t __pyx_t_15; - PyObject *(*__pyx_t_16)(PyObject *); + PyObject *__pyx_t_15 = NULL; + Py_ssize_t __pyx_t_16; + PyObject *(*__pyx_t_17)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -14367,6 +16271,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__readstat_writer(PyObject *__pyx_p #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("_readstat_writer", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to _readstat_writer pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = 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(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -14385,48 +16318,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("_readstat_writer", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __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(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -14438,7 +16354,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "pyreadstat._readstat_writer")) { - if (unlikely(PyDict_SetItemString(modules, "pyreadstat._readstat_writer", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "pyreadstat._readstat_writer", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -14449,11 +16365,11 @@ if (!__Pyx_RefNanny) { /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); - if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_type_init_code(); - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_variable_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_variable_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -14466,10 +16382,10 @@ if (!__Pyx_RefNanny) { * import warnings * import sys */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/_readstat_writer.pyx":19 * # ############################################################################# @@ -14478,10 +16394,10 @@ if (!__Pyx_RefNanny) { * import sys * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_warnings, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/_readstat_writer.pyx":20 * import os @@ -14490,10 +16406,10 @@ if (!__Pyx_RefNanny) { * * import numpy as np */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/_readstat_writer.pyx":22 * import sys @@ -14502,10 +16418,10 @@ if (!__Pyx_RefNanny) { * #cimport numpy as np * import pandas as pd */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/_readstat_writer.pyx":24 * import numpy as np @@ -14514,10 +16430,10 @@ if (!__Pyx_RefNanny) { * from pandas.api.types import is_datetime64_any_dtype, is_datetime64_ns_dtype * import datetime */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_pandas, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/_readstat_writer.pyx":25 * #cimport numpy as np @@ -14526,702 +16442,702 @@ if (!__Pyx_RefNanny) { * import datetime * import calendar */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_is_datetime64_any_dtype); __Pyx_GIVEREF(__pyx_n_s_is_datetime64_any_dtype); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_is_datetime64_any_dtype); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_is_datetime64_any_dtype); __Pyx_INCREF(__pyx_n_s_is_datetime64_ns_dtype); __Pyx_GIVEREF(__pyx_n_s_is_datetime64_ns_dtype); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_is_datetime64_ns_dtype); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_pandas_api_types, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_is_datetime64_ns_dtype); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pandas_api_types, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_is_datetime64_any_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __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_is_datetime64_any_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_datetime64_any_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_is_datetime64_ns_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_datetime64_ns_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_datetime64_any_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_is_datetime64_ns_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_datetime64_ns_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_writer.pyx":26 * import pandas as pd * from pandas.api.types import is_datetime64_any_dtype, is_datetime64_ns_dtype * import datetime # <<<<<<<<<<<<<< * import calendar - * IF PY_MAJOR_VERSION >2: + * from datetime import timezone as _timezone */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_datetime, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_3) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/_readstat_writer.pyx":27 * from pandas.api.types import is_datetime64_any_dtype, is_datetime64_ns_dtype * import datetime * import calendar # <<<<<<<<<<<<<< - * IF PY_MAJOR_VERSION >2: - * from datetime import timezone as _timezone + * from datetime import timezone as _timezone + * from libc.math cimport round, NAN */ - __pyx_t_2 = __Pyx_Import(__pyx_n_s_calendar, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calendar, __pyx_t_2) < 0) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_calendar, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calendar, __pyx_t_3) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":29 + /* "pyreadstat/_readstat_writer.pyx":28 + * import datetime * import calendar - * IF PY_MAJOR_VERSION >2: - * from datetime import timezone as _timezone # <<<<<<<<<<<<<< - * ELSE: # not available on python 2 - * import pytz as _timezone + * from datetime import timezone as _timezone # <<<<<<<<<<<<<< + * from libc.math cimport round, NAN + * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_timezone_2); __Pyx_GIVEREF(__pyx_n_s_timezone_2); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_timezone_2); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __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_timezone_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_timezone_2); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_datetime, __pyx_t_3, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_timezone, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_timezone_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_timezone, __pyx_t_3) < 0) __PYX_ERR(0, 28, __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; - /* "pyreadstat/_readstat_writer.pyx":35 + /* "pyreadstat/_readstat_writer.pyx":32 * * from readstat_api cimport * * from _readstat_parser import ReadstatError, PyreadstatError # <<<<<<<<<<<<<< * from _readstat_parser cimport check_exit_status * */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_ReadstatError); __Pyx_GIVEREF(__pyx_n_s_ReadstatError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ReadstatError); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ReadstatError); __Pyx_INCREF(__pyx_n_s_PyreadstatError); __Pyx_GIVEREF(__pyx_n_s_PyreadstatError); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_PyreadstatError); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_readstat_parser, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_PyreadstatError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_readstat_parser, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_ReadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __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_ReadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadstatError, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PyreadstatError, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ReadstatError, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PyreadstatError, __pyx_t_2) < 0) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":38 + /* "pyreadstat/_readstat_writer.pyx":35 * from _readstat_parser cimport check_exit_status * * cdef set int_types = {int, np.dtype('int32'), np.dtype('int16'), np.dtype('int8'), np.dtype('uint8'), np.dtype('uint16'), # <<<<<<<<<<<<<< * np.int32, np.int16, np.int8, np.uint8, np.uint16} * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "pyreadstat/_readstat_writer.pyx":39 + /* "pyreadstat/_readstat_writer.pyx":36 * * cdef set int_types = {int, np.dtype('int32'), np.dtype('int16'), np.dtype('int8'), np.dtype('uint8'), np.dtype('uint16'), * np.int32, np.int16, np.int8, np.uint8, np.uint16} # <<<<<<<<<<<<<< * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int16); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int32); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint16); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_uint8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PySet_Add(__pyx_t_6, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - if (PySet_Add(__pyx_t_6, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_3) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_uint16); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PySet_Add(__pyx_t_7, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + if (PySet_Add(__pyx_t_7, __pyx_t_3) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_4) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_7, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PySet_Add(__pyx_t_7, __pyx_t_4) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_5) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_7, __pyx_t_5) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_7) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_8) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_7, __pyx_t_6) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PySet_Add(__pyx_t_7, __pyx_t_8) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_9) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_7, __pyx_t_9) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_10) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_7, __pyx_t_10) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PySet_Add(__pyx_t_6, __pyx_t_11) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_7, __pyx_t_11) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PySet_Add(__pyx_t_7, __pyx_t_12) < 0) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_int_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_int_types, ((PyObject*)__pyx_t_6)); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_int_types, ((PyObject*)__pyx_t_7)); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "pyreadstat/_readstat_writer.pyx":40 + /* "pyreadstat/_readstat_writer.pyx":37 * cdef set int_types = {int, np.dtype('int32'), np.dtype('int16'), np.dtype('int8'), np.dtype('uint8'), np.dtype('uint16'), * np.int32, np.int16, np.int8, np.uint8, np.uint16} * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} # <<<<<<<<<<<<<< * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), * np.dtype('float32'), np.int64, np.uint64, np.uint32, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype(), */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Int8Dtype); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Int8Dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_pd); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_Int16Dtype); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pd); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_pd); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_Int16Dtype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_Int32Dtype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_Int32Dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_UInt8Dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pd); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pd); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_UInt8Dtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_UInt16Dtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_UInt16Dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_8 = PySet_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); + if (PySet_Add(__pyx_t_8, __pyx_t_7) < 0) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PySet_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PySet_Add(__pyx_t_7, __pyx_t_6) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PySet_Add(__pyx_t_7, __pyx_t_11) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + if (PySet_Add(__pyx_t_8, __pyx_t_12) < 0) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PySet_Add(__pyx_t_8, __pyx_t_11) < 0) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PySet_Add(__pyx_t_7, __pyx_t_10) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + if (PySet_Add(__pyx_t_8, __pyx_t_10) < 0) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PySet_Add(__pyx_t_7, __pyx_t_9) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + if (PySet_Add(__pyx_t_8, __pyx_t_9) < 0) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PySet_Add(__pyx_t_7, __pyx_t_8) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types, ((PyObject*)__pyx_t_7)); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_7 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types, ((PyObject*)__pyx_t_8)); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":41 + /* "pyreadstat/_readstat_writer.pyx":38 * np.int32, np.int16, np.int8, np.uint8, np.uint16} * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), # <<<<<<<<<<<<<< * np.dtype('float32'), np.int64, np.uint64, np.uint32, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype(), * pd.Float64Dtype(), pd.Float32Dtype()} */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_dtype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dtype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dtype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dtype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_dtype); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_dtype); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "pyreadstat/_readstat_writer.pyx":42 + /* "pyreadstat/_readstat_writer.pyx":39 * cdef set int_mixed_types = {pd.Int8Dtype(), pd.Int16Dtype(), pd.Int32Dtype(), pd.UInt8Dtype(), pd.UInt16Dtype()} * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), * np.dtype('float32'), np.int64, np.uint64, np.uint32, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype(), # <<<<<<<<<<<<<< * pd.Float64Dtype(), pd.Float32Dtype()} * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_uint64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_uint32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Int64Dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_UInt32Dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Int64Dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_UInt64Dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_UInt32Dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_UInt64Dtype); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "pyreadstat/_readstat_writer.pyx":43 + /* "pyreadstat/_readstat_writer.pyx":40 * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), * np.dtype('float32'), np.int64, np.uint64, np.uint32, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype(), * pd.Float64Dtype(), pd.Float32Dtype()} # <<<<<<<<<<<<<< * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) * cdef set datetime_types = {datetime.datetime}#, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, pd.DatetimeTZDtype, 'datetime64[ns, UTC]'} */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_pd); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_Float64Dtype); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pd); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pd); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_Float32Dtype); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_Float64Dtype); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PySet_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_pd); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - if (PySet_Add(__pyx_t_14, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - if (PySet_Add(__pyx_t_14, __pyx_t_7) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_8) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_Float32Dtype); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PySet_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (PySet_Add(__pyx_t_15, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_8) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_9) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_9) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_10) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_10) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_11) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_11) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_5) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_12) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PySet_Add(__pyx_t_15, __pyx_t_6) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PySet_Add(__pyx_t_15, __pyx_t_5) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_4) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_4) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_3) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_6) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_7) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PySet_Add(__pyx_t_15, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_12) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PySet_Add(__pyx_t_14, __pyx_t_13) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_15, __pyx_t_3) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PySet_Add(__pyx_t_15, __pyx_t_13) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PySet_Add(__pyx_t_15, __pyx_t_14) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_float_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_float_types, ((PyObject*)__pyx_t_14)); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_14 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_float_types, ((PyObject*)__pyx_t_15)); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; - /* "pyreadstat/_readstat_writer.pyx":44 + /* "pyreadstat/_readstat_writer.pyx":41 * np.dtype('float32'), np.int64, np.uint64, np.uint32, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype(), * pd.Float64Dtype(), pd.Float32Dtype()} * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) # <<<<<<<<<<<<<< * cdef set datetime_types = {datetime.datetime}#, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, pd.DatetimeTZDtype, 'datetime64[ns, UTC]'} * cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} */ - __pyx_t_14 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_union, __pyx_v_10pyreadstat_16_readstat_writer_int_types, __pyx_v_10pyreadstat_16_readstat_writer_float_types); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_15 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_union, __pyx_v_10pyreadstat_16_readstat_writer_int_types, __pyx_v_10pyreadstat_16_readstat_writer_float_types); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_union); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_union); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (!(likely(PySet_CheckExact(__pyx_t_14))||((__pyx_t_14) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_14)->tp_name), 0))) __PYX_ERR(0, 44, __pyx_L1_error) + if (!(likely(PySet_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None) || __Pyx_RaiseUnexpectedTypeError("set", __pyx_t_15))) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types, ((PyObject*)__pyx_t_14)); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_14 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types, ((PyObject*)__pyx_t_15)); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; - /* "pyreadstat/_readstat_writer.pyx":45 + /* "pyreadstat/_readstat_writer.pyx":42 * pd.Float64Dtype(), pd.Float32Dtype()} * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) * cdef set datetime_types = {datetime.datetime}#, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, pd.DatetimeTZDtype, 'datetime64[ns, UTC]'} # <<<<<<<<<<<<<< * cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} * cdef set pyrwriter_datetimelike_types = {PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64} */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_datetime); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_datetime); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_datetime); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_datetime); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PySet_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (PySet_Add(__pyx_t_15, __pyx_t_14) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PySet_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - if (PySet_Add(__pyx_t_14, __pyx_t_13) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_datetime_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_datetime_types, ((PyObject*)__pyx_t_14)); - __Pyx_GIVEREF(__pyx_t_14); - __pyx_t_14 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_datetime_types, ((PyObject*)__pyx_t_15)); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; - /* "pyreadstat/_readstat_writer.pyx":46 + /* "pyreadstat/_readstat_writer.pyx":43 * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) * cdef set datetime_types = {datetime.datetime}#, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, pd.DatetimeTZDtype, 'datetime64[ns, UTC]'} * cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} # <<<<<<<<<<<<<< * cdef set pyrwriter_datetimelike_types = {PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64} * cdef set pywriter_numeric_types = {PYWRITER_DOUBLE, PYWRITER_INTEGER, PYWRITER_LOGICAL, PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_datetime); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_datetime); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_datetime); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_datetime); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_datetime64); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_datetime64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_pd); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_libs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_timestamps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_pd); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_libs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_timestamps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_date); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PySet_Add(__pyx_t_3, __pyx_t_14) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_date); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PySet_Add(__pyx_t_2, __pyx_t_13) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + if (PySet_Add(__pyx_t_3, __pyx_t_13) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PySet_Add(__pyx_t_2, __pyx_t_12) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PySet_Add(__pyx_t_2, __pyx_t_14) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PySet_Add(__pyx_t_2, __pyx_t_1) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PySet_Add(__pyx_t_2, __pyx_t_6) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PySet_Add(__pyx_t_3, __pyx_t_15) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (PySet_Add(__pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PySet_Add(__pyx_t_3, __pyx_t_7) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_nat_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_nat_types, ((PyObject*)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_nat_types, ((PyObject*)__pyx_t_3)); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":47 + /* "pyreadstat/_readstat_writer.pyx":44 * cdef set datetime_types = {datetime.datetime}#, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, pd.DatetimeTZDtype, 'datetime64[ns, UTC]'} * cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} * cdef set pyrwriter_datetimelike_types = {PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64} # <<<<<<<<<<<<<< * cdef set pywriter_numeric_types = {PYWRITER_DOUBLE, PYWRITER_INTEGER, PYWRITER_LOGICAL, PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} * cdef dict pandas_to_readstat_types = {PYWRITER_DOUBLE: READSTAT_TYPE_DOUBLE, PYWRITER_INTEGER: READSTAT_TYPE_INT32, */ - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (PySet_Add(__pyx_t_12, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_13 = PySet_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PySet_Add(__pyx_t_13, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PySet_Add(__pyx_t_13, __pyx_t_7) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PySet_Add(__pyx_t_13, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PySet_Add(__pyx_t_12, __pyx_t_6) < 0) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PySet_Add(__pyx_t_12, __pyx_t_1) < 0) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PySet_Add(__pyx_t_12, __pyx_t_14) < 0) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PySet_Add(__pyx_t_13, __pyx_t_15) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, ((PyObject*)__pyx_t_12)); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, ((PyObject*)__pyx_t_13)); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; - /* "pyreadstat/_readstat_writer.pyx":48 + /* "pyreadstat/_readstat_writer.pyx":45 * cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} * cdef set pyrwriter_datetimelike_types = {PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64} * cdef set pywriter_numeric_types = {PYWRITER_DOUBLE, PYWRITER_INTEGER, PYWRITER_LOGICAL, PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} # <<<<<<<<<<<<<< * cdef dict pandas_to_readstat_types = {PYWRITER_DOUBLE: READSTAT_TYPE_DOUBLE, PYWRITER_INTEGER: READSTAT_TYPE_INT32, * PYWRITER_CHARACTER: READSTAT_TYPE_STRING, PYWRITER_LOGICAL: READSTAT_TYPE_INT32, */ - __pyx_t_12 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PySet_Add(__pyx_t_3, __pyx_t_12) < 0) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PySet_Add(__pyx_t_3, __pyx_t_14) < 0) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (PySet_Add(__pyx_t_3, __pyx_t_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PySet_Add(__pyx_t_3, __pyx_t_6) < 0) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PySet_Add(__pyx_t_3, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PySet_Add(__pyx_t_3, __pyx_t_13) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PySet_Add(__pyx_t_4, __pyx_t_13) < 0) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PySet_Add(__pyx_t_4, __pyx_t_15) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (PySet_Add(__pyx_t_4, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PySet_Add(__pyx_t_4, __pyx_t_7) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PySet_Add(__pyx_t_4, __pyx_t_3) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PySet_Add(__pyx_t_4, __pyx_t_14) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, ((PyObject*)__pyx_t_3)); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, ((PyObject*)__pyx_t_4)); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":49 + /* "pyreadstat/_readstat_writer.pyx":46 * cdef set pyrwriter_datetimelike_types = {PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME, PYWRITER_DATETIME64} * cdef set pywriter_numeric_types = {PYWRITER_DOUBLE, PYWRITER_INTEGER, PYWRITER_LOGICAL, PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} * cdef dict pandas_to_readstat_types = {PYWRITER_DOUBLE: READSTAT_TYPE_DOUBLE, PYWRITER_INTEGER: READSTAT_TYPE_INT32, # <<<<<<<<<<<<<< * PYWRITER_CHARACTER: READSTAT_TYPE_STRING, PYWRITER_LOGICAL: READSTAT_TYPE_INT32, * PYWRITER_OBJECT: READSTAT_TYPE_STRING, PYWRITER_DATE: READSTAT_TYPE_DOUBLE, */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_13, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_13) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_t_14, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_3, __pyx_t_14) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":50 + /* "pyreadstat/_readstat_writer.pyx":47 * cdef set pywriter_numeric_types = {PYWRITER_DOUBLE, PYWRITER_INTEGER, PYWRITER_LOGICAL, PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} * cdef dict pandas_to_readstat_types = {PYWRITER_DOUBLE: READSTAT_TYPE_DOUBLE, PYWRITER_INTEGER: READSTAT_TYPE_INT32, * PYWRITER_CHARACTER: READSTAT_TYPE_STRING, PYWRITER_LOGICAL: READSTAT_TYPE_INT32, # <<<<<<<<<<<<<< * PYWRITER_OBJECT: READSTAT_TYPE_STRING, PYWRITER_DATE: READSTAT_TYPE_DOUBLE, * PYWRITER_DATETIME: READSTAT_TYPE_DOUBLE, PYWRITER_TIME: READSTAT_TYPE_DOUBLE, */ - __pyx_t_13 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_13, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_13) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_14, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_3, __pyx_t_14) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":51 + /* "pyreadstat/_readstat_writer.pyx":48 * cdef dict pandas_to_readstat_types = {PYWRITER_DOUBLE: READSTAT_TYPE_DOUBLE, PYWRITER_INTEGER: READSTAT_TYPE_INT32, * PYWRITER_CHARACTER: READSTAT_TYPE_STRING, PYWRITER_LOGICAL: READSTAT_TYPE_INT32, * PYWRITER_OBJECT: READSTAT_TYPE_STRING, PYWRITER_DATE: READSTAT_TYPE_DOUBLE, # <<<<<<<<<<<<<< * PYWRITER_DATETIME: READSTAT_TYPE_DOUBLE, PYWRITER_TIME: READSTAT_TYPE_DOUBLE, * PYWRITER_DATETIME64: READSTAT_TYPE_DOUBLE} */ - __pyx_t_13 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_13, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_13) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_14, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_3, __pyx_t_14) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":52 + /* "pyreadstat/_readstat_writer.pyx":49 * PYWRITER_CHARACTER: READSTAT_TYPE_STRING, PYWRITER_LOGICAL: READSTAT_TYPE_INT32, * PYWRITER_OBJECT: READSTAT_TYPE_STRING, PYWRITER_DATE: READSTAT_TYPE_DOUBLE, * PYWRITER_DATETIME: READSTAT_TYPE_DOUBLE, PYWRITER_TIME: READSTAT_TYPE_DOUBLE, # <<<<<<<<<<<<<< * PYWRITER_DATETIME64: READSTAT_TYPE_DOUBLE} * */ - __pyx_t_13 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_13, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_2, __pyx_t_13) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_14, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_3, __pyx_t_14) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":53 + /* "pyreadstat/_readstat_writer.pyx":50 * PYWRITER_OBJECT: READSTAT_TYPE_STRING, PYWRITER_DATE: READSTAT_TYPE_DOUBLE, * PYWRITER_DATETIME: READSTAT_TYPE_DOUBLE, PYWRITER_TIME: READSTAT_TYPE_DOUBLE, * PYWRITER_DATETIME64: READSTAT_TYPE_DOUBLE} # <<<<<<<<<<<<<< * * cdef double spss_offset_secs = 12219379200 */ - __pyx_t_13 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, __pyx_t_13, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_14 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME64); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_14, __pyx_t_3) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, ((PyObject*)__pyx_t_3)); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, ((PyObject*)__pyx_t_4)); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":55 + /* "pyreadstat/_readstat_writer.pyx":52 * PYWRITER_DATETIME64: READSTAT_TYPE_DOUBLE} * * cdef double spss_offset_secs = 12219379200 # <<<<<<<<<<<<<< @@ -15230,7 +17146,7 @@ if (!__Pyx_RefNanny) { */ __pyx_v_10pyreadstat_16_readstat_writer_spss_offset_secs = 12219379200.0; - /* "pyreadstat/_readstat_writer.pyx":56 + /* "pyreadstat/_readstat_writer.pyx":53 * * cdef double spss_offset_secs = 12219379200 * cdef double sas_offset_secs = 315619200 # <<<<<<<<<<<<<< @@ -15239,7 +17155,7 @@ if (!__Pyx_RefNanny) { */ __pyx_v_10pyreadstat_16_readstat_writer_sas_offset_secs = 315619200.0; - /* "pyreadstat/_readstat_writer.pyx":57 + /* "pyreadstat/_readstat_writer.pyx":54 * cdef double spss_offset_secs = 12219379200 * cdef double sas_offset_secs = 315619200 * cdef double spss_offset_days = 141428 # <<<<<<<<<<<<<< @@ -15248,7 +17164,7 @@ if (!__Pyx_RefNanny) { */ __pyx_v_10pyreadstat_16_readstat_writer_spss_offset_days = 141428.0; - /* "pyreadstat/_readstat_writer.pyx":58 + /* "pyreadstat/_readstat_writer.pyx":55 * cdef double sas_offset_secs = 315619200 * cdef double spss_offset_days = 141428 * cdef double sas_offset_days = 3653 # <<<<<<<<<<<<<< @@ -15257,212 +17173,211 @@ if (!__Pyx_RefNanny) { */ __pyx_v_10pyreadstat_16_readstat_writer_sas_offset_days = 3653.0; - /* "pyreadstat/_readstat_writer.pyx":59 + /* "pyreadstat/_readstat_writer.pyx":56 * cdef double spss_offset_days = 141428 * cdef double sas_offset_days = 3653 * cdef object date_0 = datetime.datetime(1970,1,1).date() # <<<<<<<<<<<<<< * * cdef valid_user_missing_sas = [chr(x) for x in range(ord("A"), ord("Z")+1)] + ["_"] */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_date_0); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_date_0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_date_0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "pyreadstat/_readstat_writer.pyx":61 + /* "pyreadstat/_readstat_writer.pyx":58 * cdef object date_0 = datetime.datetime(1970,1,1).date() * * cdef valid_user_missing_sas = [chr(x) for x in range(ord("A"), ord("Z")+1)] + ["_"] # <<<<<<<<<<<<<< * cdef valid_user_missing_stata = [chr(x) for x in range(ord("a"), ord("z")+1)] * */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyInt_From_long((90 + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_long((90 + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(__pyx_int_65); __Pyx_GIVEREF(__pyx_int_65); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_int_65); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_13 = __pyx_t_2; __Pyx_INCREF(__pyx_t_13); __pyx_t_15 = 0; - __pyx_t_16 = NULL; + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_int_65); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_14 = __pyx_t_3; __Pyx_INCREF(__pyx_t_14); __pyx_t_16 = 0; + __pyx_t_17 = NULL; } else { - __pyx_t_15 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_16 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_16 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_17 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 58, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_13))) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_13)) break; + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_14))) { + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_14)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_15); __Pyx_INCREF(__pyx_t_2); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_3); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 58, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_13, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); #endif } else { - if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_13)) break; + if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_14)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_15); __Pyx_INCREF(__pyx_t_2); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_16); __Pyx_INCREF(__pyx_t_3); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 58, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_13, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); #endif } } else { - __pyx_t_2 = __pyx_t_16(__pyx_t_13); - if (unlikely(!__pyx_t_2)) { + __pyx_t_3 = __pyx_t_17(__pyx_t_14); + 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, 61, __pyx_L1_error) + else __PYX_ERR(0, 58, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_2) < 0) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_3) < 0) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyList_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_INCREF(__pyx_n_s__15); - __Pyx_GIVEREF(__pyx_n_s__15); - PyList_SET_ITEM(__pyx_t_13, 0, __pyx_n_s__15); - __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = PyList_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(__pyx_n_s__17); + __Pyx_GIVEREF(__pyx_n_s__17); + PyList_SET_ITEM(__pyx_t_14, 0, __pyx_n_s__17); + __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_sas); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_sas, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_sas, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; - /* "pyreadstat/_readstat_writer.pyx":62 + /* "pyreadstat/_readstat_writer.pyx":59 * * cdef valid_user_missing_sas = [chr(x) for x in range(ord("A"), ord("Z")+1)] + ["_"] * cdef valid_user_missing_stata = [chr(x) for x in range(ord("a"), ord("z")+1)] # <<<<<<<<<<<<<< * * */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = __Pyx_PyInt_From_long((0x7A + 1)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_14 = __Pyx_PyInt_From_long((0x7A + 1)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_97); __Pyx_GIVEREF(__pyx_int_97); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_97); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_13); - __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (likely(PyList_CheckExact(__pyx_t_13)) || PyTuple_CheckExact(__pyx_t_13)) { - __pyx_t_3 = __pyx_t_13; __Pyx_INCREF(__pyx_t_3); __pyx_t_15 = 0; - __pyx_t_16 = NULL; + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_97); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_14); + __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_t_14)) || PyTuple_CheckExact(__pyx_t_14)) { + __pyx_t_4 = __pyx_t_14; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0; + __pyx_t_17 = NULL; } else { - __pyx_t_15 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_16 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_16 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_17 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 59, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; for (;;) { - if (likely(!__pyx_t_16)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_15); __Pyx_INCREF(__pyx_t_13); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_14 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_14); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 59, __pyx_L1_error) #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_3, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); #endif } else { - if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_15); __Pyx_INCREF(__pyx_t_13); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_14); __pyx_t_16++; if (unlikely((0 < 0))) __PYX_ERR(0, 59, __pyx_L1_error) #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_3, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); #endif } } else { - __pyx_t_13 = __pyx_t_16(__pyx_t_3); - if (unlikely(!__pyx_t_13)) { + __pyx_t_14 = __pyx_t_17(__pyx_t_4); + if (unlikely(!__pyx_t_14)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 62, __pyx_L1_error) + else __PYX_ERR(0, 59, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_13); + __Pyx_GOTREF(__pyx_t_14); } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_13) < 0) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_x); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_14) < 0) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_x); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_stata); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_stata, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_stata, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; /* "pyreadstat/_readstat_writer.pyx":1 * # cython: c_string_type=unicode, c_string_encoding=utf8, language_level=2 # <<<<<<<<<<<<<< * # ###cython: profile=True * # ############################################################################# */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_6) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -15476,11 +17391,22 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init pyreadstat._readstat_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init pyreadstat._readstat_writer"); } @@ -15494,6 +17420,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -15513,6 +17455,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -15527,10 +17569,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject } #endif +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); @@ -15584,6 +17648,14 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) } else if (unlikely(PyErr_Occurred())) { return NULL; } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) @@ -15623,7 +17695,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #endif /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -15652,7 +17724,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -15668,7 +17739,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -15739,7 +17810,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON @@ -15761,123 +17831,86 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) #else - if (likely(PyCFunction_Check(func))) + if (PyCFunction_Check(func)) #endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } } } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } } } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} #endif - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); } #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); + #endif + #if CYTHON_VECTORCALL + vectorcallfunc f = _PyVectorcall_Function(func); + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); } #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } /* BytesEquals */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { @@ -15895,7 +17928,7 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq return (equals == Py_EQ); } else { int result; -#if CYTHON_USE_UNICODE_INTERNALS +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; @@ -15924,7 +17957,7 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq /* UnicodeEquals */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API return PyObject_RichCompareBool(s1, s2, equals); #else #if PY_MAJOR_VERSION < 3 @@ -16024,35 +18057,11 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #endif } -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - /* RaiseException */ #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); Py_XINCREF(type); if (!value || value == Py_None) value = NULL; @@ -16185,13 +18194,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -16199,6 +18204,12 @@ 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: @@ -16207,49 +18218,31 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; } /* UnpackUnboundCMethod */ +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + PyObject *result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), + METH_VARARGS | METH_KEYWORDS, + NULL +}; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); @@ -16259,13 +18252,43 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #else + if (likely(!PyCFunction_Check(method))) #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); - } + } else +#endif +#if defined(CYTHON_COMPILING_IN_PYPY) +#elif PY_VERSION_HEX >= 0x03090000 + if (PyCFunction_CheckExact(method)) +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); +#endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); #endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + target->method = unbound_method; + } + } return 0; } @@ -16276,13 +18299,13 @@ static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* 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) { + } 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 { + #else return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + #endif + } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } } @@ -16363,37 +18386,16 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* exc_type = tstate->curexc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); if (unlikely(exc_type)) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) return -1; - } + __Pyx_PyErr_Clear(); + return 0; } return 0; -#endif } /* UnpackItemEndCheck */ @@ -16402,23 +18404,23 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; - } else { - return __Pyx_IterFinish(); } - return 0; + return __Pyx_IterFinish(); } /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); + + x = (long)((unsigned long)a + (unsigned long)b); if (likely((x^a) >= 0 || (x^b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -16432,77 +18434,79 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -16521,8 +18525,13 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); +#endif double result; + PyFPE_START_PROTECT("add", return NULL) result = ((double)a) + (double)b; PyFPE_END_PROTECT(result) @@ -16535,7 +18544,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -16596,10 +18605,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, 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); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -16608,7 +18625,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -16619,32 +18636,57 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } key_value = __Pyx_PyIndex_AsSsize_t(index); if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return NULL; } -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); } - return __Pyx_PyObject_GetIndex(obj, key); + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); } #endif @@ -16707,7 +18749,7 @@ static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObje /* 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 +#if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (unlikely(PyErr_Occurred())) @@ -16871,8 +18913,11 @@ static long __Pyx__PyObject_Ord(PyObject* c) { } #endif } else { + __Pyx_TypeName c_type_name = __Pyx_PyType_GetName(Py_TYPE(c)); PyErr_Format(PyExc_TypeError, - "ord() expected string of length 1, but %.200s found", Py_TYPE(c)->tp_name); + "ord() expected string of length 1, but " __Pyx_FMT_TYPENAME " found", + c_type_name); + __Pyx_DECREF_TypeName(c_type_name); return (long)(Py_UCS4)-1; } PyErr_Format(PyExc_TypeError, @@ -16881,33 +18926,34 @@ static long __Pyx__PyObject_Ord(PyObject* c) { } /* PyIntCompare */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { +static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); if (op1 == op2) { - Py_RETURN_FALSE; + return 0; } #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; + return (a != b); } #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; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); if (intval == 0) { - if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + return (__Pyx_PyLong_IsZero(op1) != 1); } else if (intval < 0) { - if (size >= 0) - Py_RETURN_TRUE; + if (__Pyx_PyLong_IsNonNeg(op1)) + return 1; intval = -intval; - size = -size; } else { - if (size <= 0) - Py_RETURN_TRUE; + if (__Pyx_PyLong_IsNeg(op1)) + return 1; } uintval = (unsigned long) intval; #if PyLong_SHIFT * 4 < SIZEOF_LONG*8 @@ -16935,19 +18981,67 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, } else #endif unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + return (unequal != 0); } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); - if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; +#endif + return ((double)a != (double)b); } - return ( + return __Pyx_PyObject_IsTrueAndDecref( PyObject_RichCompare(op1, op2, Py_NE)); } -/* None */ +/* WriteUnraisableException */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); + else state = (PyGILState_STATE)0; +#endif + CYTHON_UNUSED_VAR(clineno); + CYTHON_UNUSED_VAR(lineno); + CYTHON_UNUSED_VAR(filename); + CYTHON_MAYBE_UNUSED_VAR(nogil); + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* RaiseUnboundLocalError */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } @@ -16974,7 +19068,7 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { return -1; } r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { + if (!r) { PyErr_Clear(); return 0; } else { @@ -16984,12 +19078,12 @@ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { } /* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE 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) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -17001,21 +19095,46 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* 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 + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -17027,40 +19146,16 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject 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); + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); + #endif } #endif @@ -17071,20 +19166,32 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -17106,12 +19213,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -17143,10 +19259,14 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { const double b = floatval; double a, result; - (void)inplace; - (void)zerodivision_check; + CYTHON_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); if (likely(PyFloat_CheckExact(op1))) { +#if CYTHON_COMPILING_IN_LIMITED_API + a = __pyx_PyFloat_AsDouble(op1); +#else a = PyFloat_AS_DOUBLE(op1); +#endif } else #if PY_MAJOR_VERSION < 3 @@ -17157,57 +19277,59 @@ static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double f #endif if (likely(PyLong_CheckExact(op1))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - switch (size) { - case 0: a = 0.0; break; - case -1: a = -(double) digits[0]; break; - case 1: a = (double) digits[0]; break; - case -2: - case 2: - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { - a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -2) - a = -a; - break; + if (__Pyx_PyLong_IsZero(op1)) { + a = 0.0; + + } else if (__Pyx_PyLong_IsCompact(op1)) { + a = (double) __Pyx_PyLong_CompactValue(op1); + } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); + switch (size) { + case -2: + case 2: + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) { + a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -2) + a = -a; + break; + } } - } - CYTHON_FALLTHROUGH; - case -3: - case 3: - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { - a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -3) - a = -a; - break; + CYTHON_FALLTHROUGH; + case -3: + case 3: + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) { + a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -3) + a = -a; + break; + } } - } - CYTHON_FALLTHROUGH; - case -4: - case 4: - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { - a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { - if (size == -4) - a = -a; - break; + CYTHON_FALLTHROUGH; + case -4: + case 4: + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) { + a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) { + if (size == -4) + a = -a; + break; + } } - } - CYTHON_FALLTHROUGH; - default: - #else - { + CYTHON_FALLTHROUGH; + default: #endif - a = PyLong_AsDouble(op1); - if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL; - + a = PyLong_AsDouble(op1); + if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL; + #if CYTHON_USE_PYLONG_INTERNALS + } } + #endif } else { return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)); } - PyFPE_START_PROTECT("divide", return NULL) result = a / b; PyFPE_END_PROTECT(result) @@ -17216,10 +19338,29 @@ static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double f #endif /* SwapException */ - #if CYTHON_FAST_THREAD_STATE +#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 + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; @@ -17227,14 +19368,14 @@ static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject * exc_info->exc_type = *type; exc_info->exc_value = *value; exc_info->exc_traceback = *tb; - #else + #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 + #endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; @@ -17251,16 +19392,18 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_0 +#define __PYX_HAVE_RT_ImportType_3_0_0 +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; -#ifdef Py_LIMITED_API + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; + PyObject *py_itemsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) @@ -17271,8 +19414,9 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) @@ -17282,22 +19426,38 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; #endif - if ((size_t)basicsize < size) { + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_0 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_0 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -17312,40 +19472,38 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, #endif /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *module = 0; - PyObject *global_dict = 0; PyObject *empty_dict = 0; - PyObject *list; + PyObject *empty_list = 0; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) + if (unlikely(!py_import)) goto bad; - #endif - if (from_list) - list = from_list; - else { + if (!from_list) { empty_list = PyList_New(0); - if (!empty_list) + if (unlikely(!empty_list)) goto bad; - list = empty_list; + from_list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; + #endif empty_dict = PyDict_New(); - if (!empty_dict) + if (unlikely(!empty_dict)) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + #if CYTHON_COMPILING_IN_LIMITED_API + module = PyImport_ImportModuleLevelObject( + name, empty_dict, empty_dict, from_list, 1); + #else module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) + name, __pyx_d, empty_dict, from_list, 1); + #endif + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) goto bad; PyErr_Clear(); } @@ -17356,30 +19514,220 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); - if (!py_level) + if (unlikely(!py_level)) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else + #if CYTHON_COMPILING_IN_LIMITED_API module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); + name, empty_dict, empty_dict, from_list, level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif #endif } } bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); return module; } +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__4; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* ImportDottedModuleRelFirst */ +static PyObject *__Pyx_ImportDottedModuleRelFirst(PyObject *name, PyObject *parts_tuple) { + PyObject *module; + PyObject *from_list = NULL; +#if PY_MAJOR_VERSION < 3 + PyObject *star = __pyx_n_s__4; + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); +#endif + module = __Pyx_Import(name, from_list, -1); + Py_XDECREF(from_list); + if (module) { + #if PY_MAJOR_VERSION >= 3 + if (parts_tuple) { + module = __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); + } + #endif + return module; + } + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + return NULL; + PyErr_Clear(); + return __Pyx_ImportDottedModule(name, parts_tuple); +} + /* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__5); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); @@ -17390,14 +19738,21 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, return value; } +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -17411,7 +19766,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -17422,7 +19777,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -17433,7 +19788,8 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -17511,44 +19867,63 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ - #include "compile.h" +#include "compile.h" #include "frameobject.h" #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + _PyTraceback_Add(funcname, filename, py_line); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -17561,11 +19936,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -17573,14 +19953,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); - if (!py_code) goto bad; + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( @@ -17596,9 +19986,10 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -17620,7 +20011,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type value) { +static CYTHON_INLINE PyObject* __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -17658,7 +20049,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_readstat_type_t(readstat_type_t value) { +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_readstat_type_t(readstat_type_t value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -17696,7 +20087,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -17734,7 +20125,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -17772,7 +20163,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE readstat_type_t __Pyx_PyInt_As_readstat_type_t(PyObject *x) { +static CYTHON_INLINE readstat_type_t __Pyx_PyInt_As_readstat_type_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -17784,7 +20175,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(readstat_type_t) < sizeof(long)) { + if ((sizeof(readstat_type_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(readstat_type_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -17798,40 +20189,45 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, 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 (readstat_type_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(readstat_type_t, digit, digits[0]) - case 2: - if (8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) >= 2 * PyLong_SHIFT) { - return (readstat_type_t) (((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) >= 2 * PyLong_SHIFT)) { + return (readstat_type_t) (((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) >= 3 * PyLong_SHIFT) { - return (readstat_type_t) (((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + break; + case 3: + if ((8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) >= 3 * PyLong_SHIFT)) { + return (readstat_type_t) (((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) >= 4 * PyLong_SHIFT) { - return (readstat_type_t) (((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + break; + case 4: + if ((8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) >= 4 * PyLong_SHIFT)) { + return (readstat_type_t) (((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -17844,111 +20240,89 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, goto raise_neg_overflow; } #endif - if (sizeof(readstat_type_t) <= sizeof(unsigned long)) { + if ((sizeof(readstat_type_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(readstat_type_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(readstat_type_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, 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 (readstat_type_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(readstat_type_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(readstat_type_t, digit, +digits[0]) - case -2: - if (8 * sizeof(readstat_type_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT) { - return (readstat_type_t) (((readstat_type_t)-1)*(((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(readstat_type_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT)) { + return (readstat_type_t) (((readstat_type_t)-1)*(((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT) { - return (readstat_type_t) ((((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(readstat_type_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT)) { + return (readstat_type_t) ((((((readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT) { - return (readstat_type_t) (((readstat_type_t)-1)*(((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(readstat_type_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT)) { + return (readstat_type_t) (((readstat_type_t)-1)*(((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT) { - return (readstat_type_t) ((((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(readstat_type_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT)) { + return (readstat_type_t) ((((((((readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT) { - return (readstat_type_t) (((readstat_type_t)-1)*(((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(readstat_type_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT)) { + return (readstat_type_t) (((readstat_type_t)-1)*(((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT) { - return (readstat_type_t) ((((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(readstat_type_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(readstat_type_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(readstat_type_t) - 1 > 4 * PyLong_SHIFT)) { + return (readstat_type_t) ((((((((((readstat_type_t)digits[3]) << PyLong_SHIFT) | (readstat_type_t)digits[2]) << PyLong_SHIFT) | (readstat_type_t)digits[1]) << PyLong_SHIFT) | (readstat_type_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(readstat_type_t) <= sizeof(long)) { + if ((sizeof(readstat_type_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(readstat_type_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(readstat_type_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(readstat_type_t, 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 - readstat_type_t 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 (readstat_type_t) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (readstat_type_t) -1; } else { readstat_type_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -17968,7 +20342,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { +static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -17980,7 +20354,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int32_t) < sizeof(long)) { + if ((sizeof(int32_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -17994,40 +20368,45 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, 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 (int32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0]) - case 2: - if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) { - return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) { + return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) { - return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) { + return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 4 * PyLong_SHIFT) { - return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 4 * PyLong_SHIFT)) { + return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -18040,109 +20419,181 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, goto raise_neg_overflow; } #endif - if (sizeof(int32_t) <= sizeof(unsigned long)) { + if ((sizeof(int32_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, 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 (int32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, +digits[0]) - case -2: - if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT) { - return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } + } + break; + } } #endif - if (sizeof(int32_t) <= sizeof(long)) { + if ((sizeof(int32_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, 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 int32_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int32_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int32_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int32_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int32_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int32_t) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int32_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int32_t) 1) << (sizeof(int32_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int32_t) -1; } } else { @@ -18164,7 +20615,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_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" @@ -18176,7 +20627,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -18190,40 +20641,45 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -18236,109 +20692,181 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -18360,7 +20888,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type __Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(PyObject *x) { +static CYTHON_INLINE __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type __Pyx_PyInt_As___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -18372,7 +20900,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) < sizeof(long)) { + if ((sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -18386,40 +20914,45 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, 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 (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) 0; - case 1: __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, digit, digits[0]) - case 2: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) >= 2 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) >= 2 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) >= 3 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0])); + break; + case 3: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) >= 3 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) >= 4 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0])); + break; + case 4: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) >= 4 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -18432,111 +20965,89 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, goto raise_neg_overflow; } #endif - if (sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(unsigned long)) { + if ((sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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 (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) 0; - case -1: __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, digit, +digits[0]) - case -2: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 2 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)-1)*(((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 2 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)-1)*(((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 2 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) ((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + break; + case 2: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 2 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) ((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 3 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)-1)*(((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + break; + case -3: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 3 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)-1)*(((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 3 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) ((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + break; + case 3: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 3 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) ((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 4 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)-1)*(((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + break; + case -4: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 4 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) (((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)-1)*(((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 4 * PyLong_SHIFT) { - return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) ((((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + break; + case 4: + if ((8 * sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) - 1 > 4 * PyLong_SHIFT)) { + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) ((((((((((__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[3]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[2]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[1]) << PyLong_SHIFT) | (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(long)) { + if ((sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type, 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 - __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type 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 (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) -1; } else { __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -18555,8 +21066,23 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, return (__pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type) -1; } +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name_2); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__18)); + } + return name; +} +#endif + /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" @@ -18568,7 +21094,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -18582,40 +21108,45 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -18628,109 +21159,181 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -18752,10 +21355,10 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -18776,6 +21379,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } return __Pyx_InBases(a, b); } +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; @@ -18800,11 +21419,11 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc } #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); + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } - return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { @@ -18852,14 +21471,36 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj #endif /* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { +static int __Pyx_check_binary_version(void) { + char ctversion[5]; + int same=1, i, found_dot; + const char* rt_from_call = Py_GetVersion(); + PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + found_dot = 0; + for (i = 0; i < 4; i++) { + if (!ctversion[i]) { + same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); + break; + } + if (rt_from_call[i] != ctversion[i]) { + same = 0; + break; + } + } + if (!same) { + char rtversion[5] = {'\0'}; char message[200]; + for (i=0; i<4; ++i) { + if (rt_from_call[i] == '.') { + if (found_dot) break; + found_dot = 1; + } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { + break; + } + rtversion[i] = rt_from_call[i]; + } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -18868,7 +21509,7 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj } /* FunctionExport */ - static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { @@ -18886,11 +21527,7 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj goto bad; } tmp.fp = f; -#if PY_VERSION_HEX >= 0x02070000 cobj = PyCapsule_New(tmp.p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); -#endif if (!cobj) goto bad; if (PyDict_SetItemString(d, name, cobj) < 0) @@ -18905,9 +21542,9 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj } /* VoidPtrImport */ - #ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_0_0 +#define __PYX_HAVE_RT_ImportVoidPtr_3_0_0 +static int __Pyx_ImportVoidPtr_3_0_0(PyObject *module, const char *name, void **p, const char *sig) { PyObject *d = 0; PyObject *cobj = 0; d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); @@ -18920,7 +21557,6 @@ static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, con PyModule_GetName(module), name); goto bad; } -#if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", @@ -18928,21 +21564,6 @@ static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, con goto bad; } *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif if (!(*p)) goto bad; Py_DECREF(d); @@ -18954,9 +21575,9 @@ static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, con #endif /* FunctionImport */ - #ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_0 +#define __PYX_HAVE_RT_ImportFunction_3_0_0 +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { @@ -18973,7 +21594,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** PyModule_GetName(module), funcname); goto bad; } -#if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", @@ -18981,21 +21601,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** goto bad; } tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif *f = tmp.fp; if (!(*f)) goto bad; @@ -19008,9 +21613,31 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** #endif /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -19018,23 +21645,11 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -19096,7 +21711,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -19125,22 +21740,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -19206,13 +21825,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -19255,6 +21872,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } @@ -19263,4 +21897,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/pyreadstat/_readstat_writer.pxd b/pyreadstat/_readstat_writer.pxd index cc1910c..729955d 100644 --- a/pyreadstat/_readstat_writer.pxd +++ b/pyreadstat/_readstat_writer.pxd @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # ############################################################################# - from libc.stddef cimport wchar_t from readstat_api cimport * @@ -45,15 +44,14 @@ cdef extern from "conditional_includes.h": int open(const char *path, int oflag, int mode) int _close(int fd) -IF PY_MAJOR_VERSION >2: - cdef extern from "Python.h": - wchar_t* PyUnicode_AsWideCharString(object, Py_ssize_t *) except NULL - -IF UNAME_SYSNAME == 'Windows': +cdef extern from "Python.h": + wchar_t* PyUnicode_AsWideCharString(object, Py_ssize_t *) except NULL - cdef extern from '': - cdef int _close(int fd) - ssize_t _write(int fd, const void *buf, size_t nbyte) +cdef extern from "conditional_includes.h": + int _close(int fd) + ssize_t _write(int fd, const void *buf, size_t nbyte) + int close(int fd) + ssize_t write(int fd, const void *buf, size_t nbyte) ctypedef enum dst_file_format: FILE_FORMAT_SAS7BDAT diff --git a/pyreadstat/_readstat_writer.pyx b/pyreadstat/_readstat_writer.pyx index 3fda751..fa04b97 100644 --- a/pyreadstat/_readstat_writer.pyx +++ b/pyreadstat/_readstat_writer.pyx @@ -25,10 +25,7 @@ import pandas as pd from pandas.api.types import is_datetime64_any_dtype, is_datetime64_ns_dtype import datetime import calendar -IF PY_MAJOR_VERSION >2: - from datetime import timezone as _timezone -ELSE: # not available on python 2 - import pytz as _timezone +from datetime import timezone as _timezone from libc.math cimport round, NAN from readstat_api cimport * @@ -495,15 +492,15 @@ cdef void set_variable_measure(readstat_variable_t *variable, str measure_str, s readstat_variable_set_measure(variable, measure); -cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx): +cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx) noexcept: """ for the writer an explicit function to write must be defined """ cdef int fd fd = (ctx)[0] - IF UNAME_SYSNAME == 'Windows': + if os.name=='nt': return _write(fd, data, _len) - ELSE: + else: return write(fd, data, _len) cdef void _check_exit_status(readstat_error_t retcode) except *: @@ -527,34 +524,23 @@ cdef int open_file(bytes filename_path): cdef bytes filename_bytes cdef char *path - IF PY_MAJOR_VERSION >2: - - if os.name == "nt": - filename_str = os.fsdecode(filename_path) - u16_path = PyUnicode_AsWideCharString(filename_str, &length) - flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC - fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) - else: - #filename_bytes = filename_path.encode("utf-8") - path = filename_path - flags = O_WRONLY | O_CREAT | O_TRUNC - fd = open(path, flags, 0644) - - ELSE: - if os.name == "nt": - return -1 - else: - filename_bytes = filename_path.encode("utf-8") - path = filename_bytes - flags = O_WRONLY | O_CREAT | O_TRUNC - fd = open(path, flags, 0644) + if os.name == "nt": + filename_str = os.fsdecode(filename_path) + u16_path = PyUnicode_AsWideCharString(filename_str, &length) + flags = _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC + fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) + else: + #filename_bytes = filename_path.encode("utf-8") + path = filename_path + flags = O_WRONLY | O_CREAT | O_TRUNC + fd = open(path, flags, 0644) return fd cdef int close_file(int fd): - IF UNAME_SYSNAME == 'Windows': + if os.name == "nt": return _close(fd) - ELSE: + else: return close(fd) cdef int run_write(df, object filename_path, dst_file_format file_format, str file_label, object column_labels, @@ -567,10 +553,6 @@ cdef int run_write(df, object filename_path, dst_file_format file_format, str fi combination of parameters, not checking them otherwise. """ - IF PY_MAJOR_VERSION <3: - if os.name == "nt": - raise PyreadstatError("Writing API not supported on python 2 on windows") - if not isinstance(df, pd.DataFrame): raise PyreadstatError("first argument must be a pandas data frame") @@ -655,17 +637,12 @@ cdef int run_write(df, object filename_path, dst_file_format file_format, str fi warnings.warn("file path could not be encoded with %s which is set as your system encoding, trying to encode it as utf-8. Please set your system encoding correctly." % sys.getfilesystemencoding()) filename_bytes = os.fsdecode(filename_path).encode("utf-8", "surrogateescape") else: - IF PY_MAJOR_VERSION >2: - if type(filename_path) == str: - filename_bytes = filename_path.encode('utf-8') - elif type(filename_path) == bytes: - filename_bytes = filename_path - else: - raise PyreadstatError("path must be either str or bytes") - ELSE: - if type(filename_path) not in (str, bytes, unicode): - raise PyreadstatError("path must be str, bytes or unicode") + if type(filename_path) == str: filename_bytes = filename_path.encode('utf-8') + elif type(filename_path) == bytes: + filename_bytes = filename_path + else: + raise PyreadstatError("path must be either str or bytes") filename_path = os.path.expanduser(filename_path) cdef int fd = open_file(filename_path) diff --git a/pyreadstat/conditional_includes.h b/pyreadstat/conditional_includes.h index 7158c47..072ddeb 100644 --- a/pyreadstat/conditional_includes.h +++ b/pyreadstat/conditional_includes.h @@ -12,6 +12,8 @@ // Stuff for handling paths with international characters on windows void assign_fd(void *io_ctx, int fd) { ((unistd_io_ctx_t*)io_ctx)->fd = fd; } + //ssize_t write(int fd, const void *buf, size_t nbyte){return 0;}; + //int close(int fd); #else @@ -35,5 +37,6 @@ int _S_IREAD; void assign_fd(void *io_ctx, int fd){}; int _close(int fd){ return 0; }; + ssize_t _write(int fd, const void *buf, size_t nbyte){return 0;}; #endif diff --git a/pyreadstat/pyreadstat.c b/pyreadstat/pyreadstat.c index 9bf276d..65b82ed 100644 --- a/pyreadstat/pyreadstat.c +++ b/pyreadstat/pyreadstat.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 3.0.0 */ /* BEGIN: Cython Metadata { @@ -13,12 +13,11 @@ "-DHAVE_ZLIB=1" ], "include_dirs": [ - "./pyreadstat", + "pyreadstat", "src", "src/stata", "src/spss", "src/sas", - "pyreadstat", "." ], "libraries": [ @@ -78,20 +77,32 @@ END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_24" -#define CYTHON_HEX_VERSION 0x001D18F0 +#define CYTHON_ABI "3_0_0" +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030000F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -110,9 +121,7 @@ END: Cython Metadata */ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -120,12 +129,18 @@ END: Cython Metadata */ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -150,27 +165,159 @@ END: Cython Metadata */ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 -#elif defined(PYSTON_VERSION) + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(CYTHON_LIMITED_API) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #endif + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS @@ -193,25 +340,29 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 - #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -220,10 +371,7 @@ END: Cython Metadata */ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS @@ -232,7 +380,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -250,27 +398,60 @@ END: Cython Metadata */ #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) #endif - #ifndef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #if PY_VERSION_HEX < 0x030700A3 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -295,6 +476,17 @@ END: Cython Metadata */ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -308,13 +500,16 @@ END: Cython Metadata */ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -326,24 +521,47 @@ END: Cython Metadata */ #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; + #else + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -353,13 +571,26 @@ END: Cython Metadata */ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -375,26 +606,113 @@ END: Cython Metadata */ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject *co=NULL, *result=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(p))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; + if (!(empty = PyTuple_New(0))) goto end; + result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); + end: + Py_XDECREF((PyObject*) co); + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -408,6 +726,12 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -422,30 +746,53 @@ END: Cython Metadata */ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() @@ -454,6 +801,22 @@ END: Cython Metadata */ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -484,6 +847,28 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -496,34 +881,86 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE(obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_PEP393_ENABLED 1 - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #endif #else #define CYTHON_PEP393_ENABLED 0 @@ -533,11 +970,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -548,14 +985,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -584,8 +1027,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -604,6 +1053,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -615,6 +1066,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -627,15 +1081,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 @@ -655,8 +1104,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { } __Pyx_PyAsyncMethodsStruct; #endif -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif #endif #include #ifdef NAN @@ -679,7 +1130,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -690,11 +1150,10 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_HAVE__pyreadstat__pyreadstat #define __PYX_HAVE_API__pyreadstat__pyreadstat /* Early includes */ +#include #include #include -#include #include "readstat.h" -#include #include "readstat_io_unistd.h" #include "conditional_includes.h" #ifdef _OPENMP @@ -765,9 +1224,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -775,11 +1234,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -793,6 +1263,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -804,7 +1275,52 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { @@ -826,7 +1342,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -891,31 +1407,49 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { "pyreadstat/pyreadstat.pyx", "pyreadstat/_readstat_parser.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container; struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels; struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks; -/* "_readstat_parser.pxd":23 +/* "_readstat_parser.pxd":22 + * * # Definitions of enum types + * ctypedef enum py_file_extension: # <<<<<<<<<<<<<< + * FILE_EXT_SAV + * FILE_EXT_SAS7BDAT + */ +enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension { + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAV, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BDAT, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_DTA, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_XPORT, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_POR, + __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BCAT +}; +typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension; + +/* "_readstat_parser.pxd":30 + * FILE_EXT_SAS7BCAT * * ctypedef enum py_file_format: # <<<<<<<<<<<<<< * FILE_FORMAT_SAS @@ -928,7 +1462,7 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_t_10pyreadstat_16_readstat_parser_py_file_format; -/* "_readstat_parser.pxd":28 +/* "_readstat_parser.pxd":35 * FILE_FORMAT_STATA * * ctypedef enum py_datetime_format: # <<<<<<<<<<<<<< @@ -943,7 +1477,7 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format __pyx_t_10pyreadstat_16_readstat_parser_py_datetime_format; -/* "_readstat_parser.pxd":34 +/* "_readstat_parser.pxd":41 * DATE_FORMAT_TIME * * ctypedef enum py_variable_format: # <<<<<<<<<<<<<< @@ -958,8 +1492,8 @@ enum __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format __pyx_t_10pyreadstat_16_readstat_parser_py_variable_format; -/* "_readstat_writer.pxd":58 - * ssize_t _write(int fd, const void *buf, size_t nbyte) +/* "_readstat_writer.pxd":56 + * ssize_t write(int fd, const void *buf, size_t nbyte) * * ctypedef enum dst_file_format: # <<<<<<<<<<<<<< * FILE_FORMAT_SAS7BDAT @@ -975,7 +1509,7 @@ enum __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format { }; typedef enum __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format; -/* "_readstat_writer.pxd":66 +/* "_readstat_writer.pxd":64 * FILE_FORMAT_POR * * ctypedef enum pywriter_variable_type: # <<<<<<<<<<<<<< @@ -995,7 +1529,7 @@ enum __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type { }; typedef enum __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type __pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type; -/* "_readstat_parser.pxd":42 +/* "_readstat_parser.pxd":49 * # Definitions of extension types * * cdef class data_container: # <<<<<<<<<<<<<< @@ -1042,7 +1576,7 @@ struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container { }; -/* "pyreadstat/pyreadstat.pyx":534 +/* "pyreadstat/pyreadstat.pyx":540 * * * def set_value_labels(dataframe, metadata, formats_as_category=True, formats_as_ordered_category=False): # <<<<<<<<<<<<<< @@ -1055,7 +1589,7 @@ struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels }; -/* "pyreadstat/pyreadstat.pyx":642 +/* "pyreadstat/pyreadstat.pyx":648 * # convenience functions to read in chunks * * def read_file_in_chunks(read_function, file_path, chunksize=100000, offset=0, limit=0, # <<<<<<<<<<<<<< @@ -1079,6 +1613,7 @@ struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chu PyObject *__pyx_v_read_function; }; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1087,11 +1622,11 @@ struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chu #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1101,28 +1636,40 @@ struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chu #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1133,6 +1680,10 @@ struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chu #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1144,22 +1695,119 @@ struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chu #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /* RaiseArgTupleInvalid.proto */ @@ -1168,7 +1816,7 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ - ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); @@ -1221,18 +1869,18 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ +#define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} +} while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) @@ -1247,23 +1895,33 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* None.proto */ +/* RaiseClosureNameError.proto */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1272,12 +1930,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif #endif /* PyObjectCallMethO.proto */ @@ -1285,18 +1938,9 @@ static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObje static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); /* PySequenceContains.proto */ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { @@ -1326,31 +1970,81 @@ 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); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + /* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif /* CythonFunctionShared.proto */ -#define __Pyx_CyFunction_USED 1 +#define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) +#if PY_VERSION_HEX < 0x030900B1 + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { +#if PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif #if PY_VERSION_HEX < 0x030500A0 PyObject *func_weakreflist; #endif @@ -1361,7 +2055,9 @@ typedef struct { PyObject *func_globals; PyObject *func_code; PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 PyObject *func_classobj; +#endif void *defaults; int defaults_pyobjects; size_t defaults_size; // used by FusedFunction for copying defaults @@ -1370,14 +2066,17 @@ typedef struct { PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; + PyObject *func_is_coroutine; } __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *self, + PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); @@ -1387,7 +2086,18 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); -static int __pyx_CyFunction_init(void); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, @@ -1424,42 +2134,6 @@ static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction * #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); @@ -1472,6 +2146,9 @@ static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, /* py_dict_pop.proto */ static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyObject *default_value); +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + /* PyObjectGetMethod.proto */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); @@ -1505,8 +2182,156 @@ static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t /* MergeKeywords.proto */ static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping); +/* pybytes_as_double.proto */ +static double __Pyx_SlowPyString_AsDouble(PyObject *obj); +static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length); +static CYTHON_INLINE double __Pyx_PyBytes_AsDouble(PyObject *obj) { + return __Pyx__PyBytes_AsDouble(obj, PyBytes_AS_STRING(obj), PyBytes_GET_SIZE(obj)); +} +static CYTHON_INLINE double __Pyx_PyByteArray_AsDouble(PyObject *obj) { + return __Pyx__PyBytes_AsDouble(obj, PyByteArray_AS_STRING(obj), PyByteArray_GET_SIZE(obj)); +} + +/* pyunicode_as_double.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static const char* __Pyx__PyUnicode_AsDouble_Copy(const void* data, const int kind, char* buffer, Py_ssize_t start, Py_ssize_t end) { + int last_was_punctuation; + Py_ssize_t i; + last_was_punctuation = 1; + for (i=start; i <= end; i++) { + Py_UCS4 chr = PyUnicode_READ(kind, data, i); + int is_punctuation = (chr == '_') | (chr == '.'); + *buffer = (char)chr; + buffer += (chr != '_'); + if (unlikely(chr > 127)) goto parse_failure; + if (unlikely(last_was_punctuation & is_punctuation)) goto parse_failure; + last_was_punctuation = is_punctuation; + } + if (unlikely(last_was_punctuation)) goto parse_failure; + *buffer = '\0'; + return buffer; +parse_failure: + return NULL; +} +static double __Pyx__PyUnicode_AsDouble_inf_nan(const void* data, int kind, Py_ssize_t start, Py_ssize_t length) { + int matches = 1; + Py_UCS4 chr; + Py_UCS4 sign = PyUnicode_READ(kind, data, start); + int is_signed = (sign == '-') | (sign == '+'); + start += is_signed; + length -= is_signed; + switch (PyUnicode_READ(kind, data, start)) { + #ifdef Py_NAN + case 'n': + case 'N': + if (unlikely(length != 3)) goto parse_failure; + chr = PyUnicode_READ(kind, data, start+1); + matches &= (chr == 'a') | (chr == 'A'); + chr = PyUnicode_READ(kind, data, start+2); + matches &= (chr == 'n') | (chr == 'N'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_NAN : Py_NAN; + #endif + case 'i': + case 'I': + if (unlikely(length < 3)) goto parse_failure; + chr = PyUnicode_READ(kind, data, start+1); + matches &= (chr == 'n') | (chr == 'N'); + chr = PyUnicode_READ(kind, data, start+2); + matches &= (chr == 'f') | (chr == 'F'); + if (likely(length == 3 && matches)) + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + if (unlikely(length != 8)) goto parse_failure; + chr = PyUnicode_READ(kind, data, start+3); + matches &= (chr == 'i') | (chr == 'I'); + chr = PyUnicode_READ(kind, data, start+4); + matches &= (chr == 'n') | (chr == 'N'); + chr = PyUnicode_READ(kind, data, start+5); + matches &= (chr == 'i') | (chr == 'I'); + chr = PyUnicode_READ(kind, data, start+6); + matches &= (chr == 't') | (chr == 'T'); + chr = PyUnicode_READ(kind, data, start+7); + matches &= (chr == 'y') | (chr == 'Y'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + break; + default: + goto parse_failure; + } + return 0.0; +parse_failure: + return -1.0; +} +static double __Pyx_PyUnicode_AsDouble_WithSpaces(PyObject *obj) { + double value; + const char *last; + char *end; + Py_ssize_t start, length = PyUnicode_GET_LENGTH(obj); + const int kind = PyUnicode_KIND(obj); + const void* data = PyUnicode_DATA(obj); + start = 0; + while (Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, start))) + start++; + while (start < length - 1 && Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, length - 1))) + length--; + length -= start; + if (unlikely(length <= 0)) goto fallback; + value = __Pyx__PyUnicode_AsDouble_inf_nan(data, kind, start, length); + if (unlikely(value == -1.0)) goto fallback; + if (value != 0.0) return value; + if (length < 40) { + char number[40]; + last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length); + if (unlikely(!last)) goto fallback; + value = PyOS_string_to_double(number, &end, NULL); + } else { + char *number = (char*) PyMem_Malloc((length + 1) * sizeof(char)); + if (unlikely(!number)) goto fallback; + last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length); + if (unlikely(!last)) { + PyMem_Free(number); + goto fallback; + } + value = PyOS_string_to_double(number, &end, NULL); + PyMem_Free(number); + } + if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) { + return value; + } +fallback: + return __Pyx_SlowPyString_AsDouble(obj); +} +#endif +static CYTHON_INLINE double __Pyx_PyUnicode_AsDouble(PyObject *obj) { +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + if (unlikely(__Pyx_PyUnicode_READY(obj) == -1)) + return (double)-1; + if (likely(PyUnicode_IS_ASCII(obj))) { + const char *s; + Py_ssize_t length; + s = PyUnicode_AsUTF8AndSize(obj, &length); + return __Pyx__PyBytes_AsDouble(obj, s, length); + } + return __Pyx_PyUnicode_AsDouble_WithSpaces(obj); +#else + return __Pyx_SlowPyString_AsDouble(obj); +#endif +} + +/* pystring_as_double.proto */ +static CYTHON_INLINE double __Pyx_PyString_AsDouble(PyObject *obj) { + #if PY_MAJOR_VERSION >= 3 + (void)__Pyx_PyBytes_AsDouble; + return __Pyx_PyUnicode_AsDouble(obj); + #else + (void)__Pyx_PyUnicode_AsDouble; + return __Pyx_PyBytes_AsDouble(obj); + #endif +} + /* PyIntCompare.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); +static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS @@ -1551,7 +2376,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #endif /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif @@ -1608,6 +2433,13 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje /* py_dict_keys.proto */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); +/* PyObject_Str.proto */ +#define __Pyx_PyObject_Str(obj)\ + (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); @@ -1619,8 +2451,13 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif -/* IncludeStringH.proto */ -#include +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 @@ -1630,19 +2467,36 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj #endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_0 +#define __PYX_HAVE_RT_ImportType_proto_3_0_0 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_0(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_0 { + __Pyx_ImportType_CheckSize_Error_3_0_0 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_0 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_0 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size); #endif /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + +/* ImportDottedModuleRelFirst.proto */ +static PyObject *__Pyx_ImportDottedModuleRelFirst(PyObject *name, PyObject *parts_tuple); + /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); @@ -1654,6 +2508,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1667,43 +2522,68 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +/* PyObjectCall2Args.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /* CoroutineBase.proto */ -typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *); +struct __pyx_CoroutineObject; +typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); #if CYTHON_USE_EXC_INFO_STACK #define __Pyx_ExcInfoStruct _PyErr_StackItem #else @@ -1713,7 +2593,7 @@ typedef struct { PyObject *exc_traceback; } __Pyx_ExcInfoStruct; #endif -typedef struct { +typedef struct __pyx_CoroutineObject { PyObject_HEAD __pyx_coroutine_body_t body; PyObject *closure; @@ -1771,32 +2651,31 @@ 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_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_GeneratorType) #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\ __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name) static PyObject *__Pyx_Generator_Next(PyObject *self); -static int __pyx_Generator_init(void); +static int __pyx_Generator_init(PyObject *module); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); +static int __Pyx_ImportVoidPtr_3_0_0(PyObject *module, const char *name, void **p, const char *sig); /* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ -/* Module declarations from 'pyreadstat.readstat_api' */ +/* Module declarations from "libc.stddef" */ -/* Module declarations from 'libc.stddef' */ +/* Module declarations from "pyreadstat.readstat_api" */ -/* Module declarations from 'pyreadstat._readstat_parser' */ -static PyTypeObject *__pyx_ptype_10pyreadstat_16_readstat_parser_data_container = 0; +/* Module declarations from "pyreadstat._readstat_parser" */ static PyObject **__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types = 0; #define __pyx_v_10pyreadstat_16_readstat_parser_readstat_to_numpy_types (*__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types) static PyObject **__pyx_vp_10pyreadstat_16_readstat_parser_sas_date_formats = 0; @@ -1829,28 +2708,34 @@ static PyObject **__pyx_vp_10pyreadstat_16_readstat_parser_stata_all_formats = 0 #define __pyx_v_10pyreadstat_16_readstat_parser_stata_all_formats (*__pyx_vp_10pyreadstat_16_readstat_parser_stata_all_formats) static PyObject **__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin = 0; #define __pyx_v_10pyreadstat_16_readstat_parser_stata_origin (*__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin) -static PyObject *(*__pyx_f_10pyreadstat_16_readstat_parser_run_conversion)(PyObject *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format, readstat_error_t (readstat_parser_t *, char const *, void *), PyObject *, int, int, PyObject *, int, int, long, long, PyObject *, PyObject *, PyObject *); /*proto*/ +static PyObject *(*__pyx_f_10pyreadstat_16_readstat_parser_run_conversion)(PyObject *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format, __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension, PyObject *, int, int, PyObject *, int, int, long, long, PyObject *, PyObject *, PyObject *); /*proto*/ -/* Module declarations from 'pyreadstat._readstat_writer' */ +/* Module declarations from "pyreadstat._readstat_writer" */ static int (*__pyx_f_10pyreadstat_16_readstat_writer_run_write)(PyObject *, PyObject *, __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format, PyObject *, PyObject *, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int); /*proto*/ -/* Module declarations from 'pyreadstat.pyreadstat' */ -static PyTypeObject *__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels = 0; -static PyTypeObject *__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks = 0; +/* Module declarations from "pyreadstat.pyreadstat" */ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "pyreadstat.pyreadstat" extern int __pyx_module_is_main_pyreadstat__pyreadstat; int __pyx_module_is_main_pyreadstat__pyreadstat = 0; -/* Implementation of 'pyreadstat.pyreadstat' */ +/* Implementation of "pyreadstat.pyreadstat" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_max; +/* #### Code section: string_decls ### */ static const char __pyx_k_x[] = "x"; static const char __pyx_k__6[] = ""; -static const char __pyx_k__8[] = "_"; +static const char __pyx_k__8[] = "*"; +static const char __pyx_k__9[] = "."; static const char __pyx_k_df[] = "df"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_mp[] = "mp"; static const char __pyx_k_pd[] = "pd"; +static const char __pyx_k__10[] = "_"; +static const char __pyx_k__44[] = "?"; static const char __pyx_k_div[] = "div"; static const char __pyx_k_dta[] = "dta"; static const char __pyx_k_get[] = "get"; @@ -1875,6 +2760,7 @@ static const char __pyx_k_note[] = "note"; static const char __pyx_k_pool[] = "pool"; static const char __pyx_k_send[] = "send"; static const char __pyx_k_sort[] = "sort"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_apply[] = "apply"; static const char __pyx_k_close[] = "close"; @@ -1888,6 +2774,7 @@ static const char __pyx_k_astype[] = "astype"; static const char __pyx_k_chunks[] = "chunks"; static const char __pyx_k_concat[] = "concat"; static const char __pyx_k_curcat[] = "curcat"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_kwargs[] = "kwargs"; @@ -1900,6 +2787,7 @@ static const char __pyx_k_worker[] = "worker"; static const char __pyx_k_catalog[] = "catalog"; static const char __pyx_k_columns[] = "columns"; static const char __pyx_k_df_copy[] = "df_copy"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_integer[] = "integer"; static const char __pyx_k_numrows[] = "numrows"; static const char __pyx_k_offsets[] = "offsets"; @@ -1930,6 +2818,7 @@ static const char __pyx_k_cpu_count[] = "cpu_count"; static const char __pyx_k_dataframe[] = "dataframe"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_file_path[] = "file_path"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_processes[] = "processes"; static const char __pyx_k_row_limit[] = "row_limit"; static const char __pyx_k_var_label[] = "var_label"; @@ -1953,6 +2842,8 @@ static const char __pyx_k_prev_offset[] = "prev_offset"; static const char __pyx_k_write_xport[] = "write_xport"; static const char __pyx_k_catalog_file[] = "catalog_file"; static const char __pyx_k_ignore_index[] = "ignore_index"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; static const char __pyx_k_metadataonly[] = "metadataonly"; static const char __pyx_k_multiprocess[] = "multiprocess"; static const char __pyx_k_row_compress[] = "row_compress"; @@ -1960,6 +2851,7 @@ static const char __pyx_k_sas_metadata[] = "sas_metadata"; static const char __pyx_k_user_missing[] = "user_missing"; static const char __pyx_k_value_labels[] = "value_labels"; static const char __pyx_k_F_var_width_0[] = "F{var_width}.0"; +static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_column_labels[] = "column_labels"; static const char __pyx_k_filename_path[] = "filename_path"; static const char __pyx_k_num_processes[] = "num_processes"; @@ -1969,6 +2861,7 @@ static const char __pyx_k_read_sas7bcat[] = "read_sas7bcat"; static const char __pyx_k_read_sas7bdat[] = "read_sas7bdat"; static const char __pyx_k_sas_dataframe[] = "sas_dataframe"; static const char __pyx_k_current_labels[] = "current_labels"; +static const char __pyx_k_file_extension[] = "file_extension"; static const char __pyx_k_missing_ranges[] = "missing_ranges"; static const char __pyx_k_PyreadstatError[] = "PyreadstatError"; static const char __pyx_k_dates_as_pandas[] = "dates_as_pandas"; @@ -1982,6 +2875,7 @@ static const char __pyx_k_catalog_metadata[] = "catalog_metadata"; static const char __pyx_k_set_value_labels[] = "set_value_labels"; static const char __pyx_k_variable_measure[] = "variable_measure"; static const char __pyx_k_variable_to_label[] = "variable_to_label"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_extra_date_formats[] = "extra_date_formats"; static const char __pyx_k_restricted_integer[] = "restricted_integer"; @@ -2010,171 +2904,7 @@ static const char __pyx_k_set_value_labels_locals_lambda[] = "set_value_labels.< static const char __pyx_k_The_number_of_rows_of_the_file_c[] = "The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data"; static const char __pyx_k_compress_and_row_compress_cannot[] = "compress and row_compress cannot be both True"; static const char __pyx_k_num_rows_must_be_specified_for_r[] = "num_rows must be specified for read_xport and read_por to be a number equal or larger than the number of rows in the dataset."; -static PyObject *__pyx_n_s_Categorical; -static PyObject *__pyx_kp_s_F_var_width_0; -static PyObject *__pyx_kp_s_N_var_width; -static PyObject *__pyx_n_s_Pool; -static PyObject *__pyx_n_s_PyreadstatError; -static PyObject *__pyx_kp_s_The_number_of_rows_of_the_file_c; -static PyObject *__pyx_kp_s_Version_not_supported; -static PyObject *__pyx_kp_s__6; -static PyObject *__pyx_n_s__8; -static PyObject *__pyx_n_s_apply; -static PyObject *__pyx_n_s_apply_value_formats; -static PyObject *__pyx_n_s_args; -static PyObject *__pyx_n_s_astype; -static PyObject *__pyx_n_s_axis; -static PyObject *__pyx_n_s_catalog; -static PyObject *__pyx_n_s_catalog_file; -static PyObject *__pyx_n_s_catalog_metadata; -static PyObject *__pyx_n_s_catalog_metadata_copy; -static PyObject *__pyx_n_s_categories; -static PyObject *__pyx_n_s_category; -static PyObject *__pyx_n_s_chunks; -static PyObject *__pyx_n_s_chunksize; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_close; -static PyObject *__pyx_n_s_col_format; -static PyObject *__pyx_n_s_col_name; -static PyObject *__pyx_n_s_column_labels; -static PyObject *__pyx_n_s_columns; -static PyObject *__pyx_n_s_compress; -static PyObject *__pyx_kp_s_compress_and_row_compress_cannot; -static PyObject *__pyx_n_s_concat; -static PyObject *__pyx_n_s_copy; -static PyObject *__pyx_n_s_cpu_count; -static PyObject *__pyx_n_s_curcat; -static PyObject *__pyx_n_s_current_labels; -static PyObject *__pyx_n_s_data_frame; -static PyObject *__pyx_n_s_dataframe; -static PyObject *__pyx_n_s_dates_as_pandas; -static PyObject *__pyx_n_s_dates_as_pandas_datetime; -static PyObject *__pyx_n_s_deepcopy; -static PyObject *__pyx_n_s_df; -static PyObject *__pyx_n_s_df_copy; -static PyObject *__pyx_n_s_disable_datetime_conversion; -static PyObject *__pyx_n_s_div; -static PyObject *__pyx_n_s_divs; -static PyObject *__pyx_n_s_dst_path; -static PyObject *__pyx_n_s_dta; -static PyObject *__pyx_n_s_encoding; -static PyObject *__pyx_n_s_enumerate; -static PyObject *__pyx_n_s_extra_date_formats; -static PyObject *__pyx_n_s_extra_datetime_formats; -static PyObject *__pyx_n_s_file_format; -static PyObject *__pyx_n_s_file_format_version; -static PyObject *__pyx_n_s_file_label; -static PyObject *__pyx_n_s_file_path; -static PyObject *__pyx_n_s_filename_path; -static PyObject *__pyx_n_s_final; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_formats_as_category; -static PyObject *__pyx_n_s_formats_as_ordered_category; -static PyObject *__pyx_n_s_formats_presets; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_ignore_index; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_indx; -static PyObject *__pyx_n_s_inf; -static PyObject *__pyx_n_s_integer; -static PyObject *__pyx_n_s_items; -static PyObject *__pyx_n_s_jobs; -static PyObject *__pyx_n_s_key; -static PyObject *__pyx_n_s_keys; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_label_name; -static PyObject *__pyx_n_s_labels; -static PyObject *__pyx_n_s_limit; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_map; -static PyObject *__pyx_n_s_max; -static PyObject *__pyx_n_s_meta; -static PyObject *__pyx_n_s_metadata; -static PyObject *__pyx_n_s_metadataonly; -static PyObject *__pyx_n_s_metaonly; -static PyObject *__pyx_n_s_missing_ranges; -static PyObject *__pyx_n_s_missing_user_values; -static PyObject *__pyx_n_s_mp; -static PyObject *__pyx_n_s_multiprocess; -static PyObject *__pyx_n_s_multiprocessing; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_no_datetime_conversion; -static PyObject *__pyx_n_s_note; -static PyObject *__pyx_n_s_num_processes; -static PyObject *__pyx_n_s_num_rows; -static PyObject *__pyx_kp_s_num_rows_must_be_specified_for_r; -static PyObject *__pyx_n_s_number_rows; -static PyObject *__pyx_n_s_numrows; -static PyObject *__pyx_n_s_offset; -static PyObject *__pyx_n_s_offsets; -static PyObject *__pyx_n_s_ordered; -static PyObject *__pyx_n_s_original_values; -static PyObject *__pyx_n_s_orival; -static PyObject *__pyx_n_s_output_format; -static PyObject *__pyx_n_s_pandas; -static PyObject *__pyx_n_s_pd; -static PyObject *__pyx_n_s_pool; -static PyObject *__pyx_n_s_pop; -static PyObject *__pyx_n_s_por; -static PyObject *__pyx_n_s_prev_div; -static PyObject *__pyx_n_s_prev_offset; -static PyObject *__pyx_n_s_processes; -static PyObject *__pyx_n_s_pyreadstat_pyreadstat; -static PyObject *__pyx_kp_s_pyreadstat_pyreadstat_pyx; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_read_dta; -static PyObject *__pyx_n_s_read_file_in_chunks; -static PyObject *__pyx_n_s_read_file_multiprocessing; -static PyObject *__pyx_n_s_read_function; -static PyObject *__pyx_n_s_read_por; -static PyObject *__pyx_n_s_read_sas7bcat; -static PyObject *__pyx_kp_s_read_sas7bcat_is_not_supported; -static PyObject *__pyx_kp_s_read_sas7bcat_not_supported; -static PyObject *__pyx_n_s_read_sas7bdat; -static PyObject *__pyx_n_s_read_sav; -static PyObject *__pyx_n_s_read_xport; -static PyObject *__pyx_n_s_readstat_parser; -static PyObject *__pyx_n_s_restricted_integer; -static PyObject *__pyx_n_s_revdict; -static PyObject *__pyx_n_s_row_compress; -static PyObject *__pyx_n_s_row_compression; -static PyObject *__pyx_n_s_row_limit; -static PyObject *__pyx_n_s_row_offset; -static PyObject *__pyx_n_s_sas7bcat; -static PyObject *__pyx_n_s_sas7bdat; -static PyObject *__pyx_n_s_sas_dataframe; -static PyObject *__pyx_n_s_sas_metadata; -static PyObject *__pyx_kp_s_sav_zsav; -static PyObject *__pyx_n_s_send; -static PyObject *__pyx_n_s_set_catalog_to_sas; -static PyObject *__pyx_n_s_set_value_labels; -static PyObject *__pyx_n_s_set_value_labels_locals_lambda; -static PyObject *__pyx_n_s_sort; -static PyObject *__pyx_n_s_table_name; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_throw; -static PyObject *__pyx_n_s_usecols; -static PyObject *__pyx_n_s_user_missing; -static PyObject *__pyx_n_s_usernan; -static PyObject *__pyx_n_s_value_labels; -static PyObject *__pyx_n_s_values; -static PyObject *__pyx_n_s_var_label; -static PyObject *__pyx_n_s_var_name; -static PyObject *__pyx_n_s_var_width; -static PyObject *__pyx_n_s_variable_alignment; -static PyObject *__pyx_n_s_variable_display_width; -static PyObject *__pyx_n_s_variable_format; -static PyObject *__pyx_n_s_variable_measure; -static PyObject *__pyx_n_s_variable_to_label; -static PyObject *__pyx_n_s_variable_value_labels; -static PyObject *__pyx_n_s_version; -static PyObject *__pyx_n_s_worker; -static PyObject *__pyx_n_s_write_dta; -static PyObject *__pyx_n_s_write_por; -static PyObject *__pyx_n_s_write_sav; -static PyObject *__pyx_n_s_write_xport; -static PyObject *__pyx_n_s_x; -static PyObject *__pyx_n_s_xport; +/* #### Code section: decls ### */ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_path, PyObject *__pyx_v_metadataonly, PyObject *__pyx_v_dates_as_pandas_datetime, PyObject *__pyx_v_catalog_file, PyObject *__pyx_v_formats_as_category, PyObject *__pyx_v_formats_as_ordered_category, PyObject *__pyx_v_encoding, PyObject *__pyx_v_usecols, PyObject *__pyx_v_user_missing, PyObject *__pyx_v_disable_datetime_conversion, int __pyx_v_row_limit, int __pyx_v_row_offset, PyObject *__pyx_v_output_format, PyObject *__pyx_v_extra_datetime_formats, PyObject *__pyx_v_extra_date_formats); /* proto */ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_path, PyObject *__pyx_v_metadataonly, PyObject *__pyx_v_dates_as_pandas_datetime, PyObject *__pyx_v_encoding, PyObject *__pyx_v_usecols, PyObject *__pyx_v_disable_datetime_conversion, int __pyx_v_row_limit, int __pyx_v_row_offset, PyObject *__pyx_v_output_format, PyObject *__pyx_v_extra_datetime_formats, PyObject *__pyx_v_extra_date_formats); /* proto */ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename_path, PyObject *__pyx_v_metadataonly, PyObject *__pyx_v_dates_as_pandas_datetime, PyObject *__pyx_v_apply_value_formats, PyObject *__pyx_v_formats_as_category, PyObject *__pyx_v_formats_as_ordered_category, PyObject *__pyx_v_encoding, PyObject *__pyx_v_usecols, PyObject *__pyx_v_user_missing, PyObject *__pyx_v_disable_datetime_conversion, int __pyx_v_row_limit, int __pyx_v_row_offset, PyObject *__pyx_v_output_format, PyObject *__pyx_v_extra_datetime_formats, PyObject *__pyx_v_extra_date_formats); /* proto */ @@ -2192,48 +2922,1052 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_df, PyObject *__pyx_v_dst_path, PyObject *__pyx_v_file_label, PyObject *__pyx_v_column_labels, PyObject *__pyx_v_variable_format); /* proto */ static PyObject *__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0}; -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop = {0, &__pyx_n_s_pop, 0, 0, 0}; -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_100000; -static PyObject *__pyx_codeobj_; -static PyObject *__pyx_tuple__2; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__34; -static PyObject *__pyx_codeobj__10; -static PyObject *__pyx_codeobj__12; -static PyObject *__pyx_codeobj__14; -static PyObject *__pyx_codeobj__16; -static PyObject *__pyx_codeobj__18; -static PyObject *__pyx_codeobj__20; -static PyObject *__pyx_codeobj__22; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__27; -static PyObject *__pyx_codeobj__29; -static PyObject *__pyx_codeobj__31; -static PyObject *__pyx_codeobj__33; -static PyObject *__pyx_codeobj__35; -/* Late includes */ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, 0, 0, 0, 0}; +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop = {0, 0, 0, 0, 0}; +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_10pyreadstat_16_readstat_parser_data_container; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels; + PyObject *__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks; + #endif + PyTypeObject *__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels; + PyTypeObject *__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks; + PyObject *__pyx_n_s_Categorical; + PyObject *__pyx_kp_s_F_var_width_0; + PyObject *__pyx_kp_s_N_var_width; + PyObject *__pyx_n_s_Pool; + PyObject *__pyx_n_s_PyreadstatError; + PyObject *__pyx_kp_s_The_number_of_rows_of_the_file_c; + PyObject *__pyx_kp_s_Version_not_supported; + PyObject *__pyx_n_s__10; + PyObject *__pyx_n_s__44; + PyObject *__pyx_kp_s__6; + PyObject *__pyx_n_s__8; + PyObject *__pyx_kp_u__9; + PyObject *__pyx_n_s_apply; + PyObject *__pyx_n_s_apply_value_formats; + PyObject *__pyx_n_s_args; + PyObject *__pyx_n_s_astype; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_axis; + PyObject *__pyx_n_s_catalog; + PyObject *__pyx_n_s_catalog_file; + PyObject *__pyx_n_s_catalog_metadata; + PyObject *__pyx_n_s_catalog_metadata_copy; + PyObject *__pyx_n_s_categories; + PyObject *__pyx_n_s_category; + PyObject *__pyx_n_s_chunks; + PyObject *__pyx_n_s_chunksize; + PyObject *__pyx_n_s_class_getitem; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_close; + PyObject *__pyx_n_s_col_format; + PyObject *__pyx_n_s_col_name; + PyObject *__pyx_n_s_column_labels; + PyObject *__pyx_n_s_columns; + PyObject *__pyx_n_s_compress; + PyObject *__pyx_kp_s_compress_and_row_compress_cannot; + PyObject *__pyx_n_s_concat; + PyObject *__pyx_n_s_copy; + PyObject *__pyx_n_s_cpu_count; + PyObject *__pyx_n_s_curcat; + PyObject *__pyx_n_s_current_labels; + PyObject *__pyx_n_s_data_frame; + PyObject *__pyx_n_s_dataframe; + PyObject *__pyx_n_s_dates_as_pandas; + PyObject *__pyx_n_s_dates_as_pandas_datetime; + PyObject *__pyx_n_s_deepcopy; + PyObject *__pyx_n_s_df; + PyObject *__pyx_n_s_df_copy; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_disable_datetime_conversion; + PyObject *__pyx_n_s_div; + PyObject *__pyx_n_s_divs; + PyObject *__pyx_n_s_dst_path; + PyObject *__pyx_n_s_dta; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encoding; + PyObject *__pyx_n_s_enumerate; + PyObject *__pyx_n_s_extra_date_formats; + PyObject *__pyx_n_s_extra_datetime_formats; + PyObject *__pyx_n_s_file_extension; + PyObject *__pyx_n_s_file_format; + PyObject *__pyx_n_s_file_format_version; + PyObject *__pyx_n_s_file_label; + PyObject *__pyx_n_s_file_path; + PyObject *__pyx_n_s_filename_path; + PyObject *__pyx_n_s_final; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_formats_as_category; + PyObject *__pyx_n_s_formats_as_ordered_category; + PyObject *__pyx_n_s_formats_presets; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_get; + PyObject *__pyx_n_s_ignore_index; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_indx; + PyObject *__pyx_n_s_inf; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_integer; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_items; + PyObject *__pyx_n_s_jobs; + PyObject *__pyx_n_s_key; + PyObject *__pyx_n_s_keys; + PyObject *__pyx_n_s_kwargs; + PyObject *__pyx_n_s_label_name; + PyObject *__pyx_n_s_labels; + PyObject *__pyx_n_s_limit; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_map; + PyObject *__pyx_n_s_max; + PyObject *__pyx_n_s_meta; + PyObject *__pyx_n_s_metadata; + PyObject *__pyx_n_s_metadataonly; + PyObject *__pyx_n_s_metaonly; + PyObject *__pyx_n_s_missing_ranges; + PyObject *__pyx_n_s_missing_user_values; + PyObject *__pyx_n_s_mp; + PyObject *__pyx_n_s_multiprocess; + PyObject *__pyx_n_s_multiprocessing; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_no_datetime_conversion; + PyObject *__pyx_n_s_note; + PyObject *__pyx_n_s_num_processes; + PyObject *__pyx_n_s_num_rows; + PyObject *__pyx_kp_s_num_rows_must_be_specified_for_r; + PyObject *__pyx_n_s_number_rows; + PyObject *__pyx_n_s_numrows; + PyObject *__pyx_n_s_offset; + PyObject *__pyx_n_s_offsets; + PyObject *__pyx_n_s_ordered; + PyObject *__pyx_n_s_original_values; + PyObject *__pyx_n_s_orival; + PyObject *__pyx_n_s_output_format; + PyObject *__pyx_n_s_pandas; + PyObject *__pyx_n_s_pd; + PyObject *__pyx_n_s_pool; + PyObject *__pyx_n_s_pop; + PyObject *__pyx_n_s_por; + PyObject *__pyx_n_s_prev_div; + PyObject *__pyx_n_s_prev_offset; + PyObject *__pyx_n_s_processes; + PyObject *__pyx_n_s_pyreadstat_pyreadstat; + PyObject *__pyx_kp_s_pyreadstat_pyreadstat_pyx; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_read_dta; + PyObject *__pyx_n_s_read_file_in_chunks; + PyObject *__pyx_n_s_read_file_multiprocessing; + PyObject *__pyx_n_s_read_function; + PyObject *__pyx_n_s_read_por; + PyObject *__pyx_n_s_read_sas7bcat; + PyObject *__pyx_kp_s_read_sas7bcat_is_not_supported; + PyObject *__pyx_kp_s_read_sas7bcat_not_supported; + PyObject *__pyx_n_s_read_sas7bdat; + PyObject *__pyx_n_s_read_sav; + PyObject *__pyx_n_s_read_xport; + PyObject *__pyx_n_s_readstat_parser; + PyObject *__pyx_n_s_restricted_integer; + PyObject *__pyx_n_s_revdict; + PyObject *__pyx_n_s_row_compress; + PyObject *__pyx_n_s_row_compression; + PyObject *__pyx_n_s_row_limit; + PyObject *__pyx_n_s_row_offset; + PyObject *__pyx_n_s_sas7bcat; + PyObject *__pyx_n_s_sas7bdat; + PyObject *__pyx_n_s_sas_dataframe; + PyObject *__pyx_n_s_sas_metadata; + PyObject *__pyx_kp_s_sav_zsav; + PyObject *__pyx_n_s_send; + PyObject *__pyx_n_s_set_catalog_to_sas; + PyObject *__pyx_n_s_set_value_labels; + PyObject *__pyx_n_s_set_value_labels_locals_lambda; + PyObject *__pyx_n_s_sort; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_table_name; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_throw; + PyObject *__pyx_n_s_usecols; + PyObject *__pyx_n_s_user_missing; + PyObject *__pyx_n_s_usernan; + PyObject *__pyx_n_s_value_labels; + PyObject *__pyx_n_s_values; + PyObject *__pyx_n_s_var_label; + PyObject *__pyx_n_s_var_name; + PyObject *__pyx_n_s_var_width; + PyObject *__pyx_n_s_variable_alignment; + PyObject *__pyx_n_s_variable_display_width; + PyObject *__pyx_n_s_variable_format; + PyObject *__pyx_n_s_variable_measure; + PyObject *__pyx_n_s_variable_to_label; + PyObject *__pyx_n_s_variable_value_labels; + PyObject *__pyx_n_s_version; + PyObject *__pyx_n_s_worker; + PyObject *__pyx_n_s_write_dta; + PyObject *__pyx_n_s_write_por; + PyObject *__pyx_n_s_write_sav; + PyObject *__pyx_n_s_write_xport; + PyObject *__pyx_n_s_x; + PyObject *__pyx_n_s_xport; + PyObject *__pyx_int_0; + PyObject *__pyx_int_1; + PyObject *__pyx_int_4; + PyObject *__pyx_int_100000; + PyObject *__pyx_codeobj_; + PyObject *__pyx_tuple__2; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__5; + PyObject *__pyx_tuple__7; + PyObject *__pyx_tuple__11; + PyObject *__pyx_tuple__13; + PyObject *__pyx_tuple__15; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__23; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__26; + PyObject *__pyx_tuple__28; + PyObject *__pyx_tuple__29; + PyObject *__pyx_tuple__30; + PyObject *__pyx_tuple__31; + PyObject *__pyx_tuple__33; + PyObject *__pyx_tuple__34; + PyObject *__pyx_tuple__36; + PyObject *__pyx_tuple__37; + PyObject *__pyx_tuple__39; + PyObject *__pyx_tuple__41; + PyObject *__pyx_tuple__43; + PyObject *__pyx_codeobj__12; + PyObject *__pyx_codeobj__14; + PyObject *__pyx_codeobj__16; + PyObject *__pyx_codeobj__17; + PyObject *__pyx_codeobj__19; + PyObject *__pyx_codeobj__21; + PyObject *__pyx_codeobj__24; + PyObject *__pyx_codeobj__27; + PyObject *__pyx_codeobj__32; + PyObject *__pyx_codeobj__35; + PyObject *__pyx_codeobj__38; + PyObject *__pyx_codeobj__40; + PyObject *__pyx_codeobj__42; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif + +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container); + Py_CLEAR(clear_module_state->__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels); + Py_CLEAR(clear_module_state->__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels); + Py_CLEAR(clear_module_state->__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks); + Py_CLEAR(clear_module_state->__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks); + Py_CLEAR(clear_module_state->__pyx_n_s_Categorical); + Py_CLEAR(clear_module_state->__pyx_kp_s_F_var_width_0); + Py_CLEAR(clear_module_state->__pyx_kp_s_N_var_width); + Py_CLEAR(clear_module_state->__pyx_n_s_Pool); + Py_CLEAR(clear_module_state->__pyx_n_s_PyreadstatError); + Py_CLEAR(clear_module_state->__pyx_kp_s_The_number_of_rows_of_the_file_c); + Py_CLEAR(clear_module_state->__pyx_kp_s_Version_not_supported); + Py_CLEAR(clear_module_state->__pyx_n_s__10); + Py_CLEAR(clear_module_state->__pyx_n_s__44); + Py_CLEAR(clear_module_state->__pyx_kp_s__6); + Py_CLEAR(clear_module_state->__pyx_n_s__8); + Py_CLEAR(clear_module_state->__pyx_kp_u__9); + Py_CLEAR(clear_module_state->__pyx_n_s_apply); + Py_CLEAR(clear_module_state->__pyx_n_s_apply_value_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_args); + Py_CLEAR(clear_module_state->__pyx_n_s_astype); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_axis); + Py_CLEAR(clear_module_state->__pyx_n_s_catalog); + Py_CLEAR(clear_module_state->__pyx_n_s_catalog_file); + Py_CLEAR(clear_module_state->__pyx_n_s_catalog_metadata); + Py_CLEAR(clear_module_state->__pyx_n_s_catalog_metadata_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_categories); + Py_CLEAR(clear_module_state->__pyx_n_s_category); + Py_CLEAR(clear_module_state->__pyx_n_s_chunks); + Py_CLEAR(clear_module_state->__pyx_n_s_chunksize); + Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_close); + Py_CLEAR(clear_module_state->__pyx_n_s_col_format); + Py_CLEAR(clear_module_state->__pyx_n_s_col_name); + Py_CLEAR(clear_module_state->__pyx_n_s_column_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_columns); + Py_CLEAR(clear_module_state->__pyx_n_s_compress); + Py_CLEAR(clear_module_state->__pyx_kp_s_compress_and_row_compress_cannot); + Py_CLEAR(clear_module_state->__pyx_n_s_concat); + Py_CLEAR(clear_module_state->__pyx_n_s_copy); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_count); + Py_CLEAR(clear_module_state->__pyx_n_s_curcat); + Py_CLEAR(clear_module_state->__pyx_n_s_current_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_data_frame); + Py_CLEAR(clear_module_state->__pyx_n_s_dataframe); + Py_CLEAR(clear_module_state->__pyx_n_s_dates_as_pandas); + Py_CLEAR(clear_module_state->__pyx_n_s_dates_as_pandas_datetime); + Py_CLEAR(clear_module_state->__pyx_n_s_deepcopy); + Py_CLEAR(clear_module_state->__pyx_n_s_df); + Py_CLEAR(clear_module_state->__pyx_n_s_df_copy); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_disable_datetime_conversion); + Py_CLEAR(clear_module_state->__pyx_n_s_div); + Py_CLEAR(clear_module_state->__pyx_n_s_divs); + Py_CLEAR(clear_module_state->__pyx_n_s_dst_path); + Py_CLEAR(clear_module_state->__pyx_n_s_dta); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encoding); + Py_CLEAR(clear_module_state->__pyx_n_s_enumerate); + Py_CLEAR(clear_module_state->__pyx_n_s_extra_date_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_extra_datetime_formats); + Py_CLEAR(clear_module_state->__pyx_n_s_file_extension); + Py_CLEAR(clear_module_state->__pyx_n_s_file_format); + Py_CLEAR(clear_module_state->__pyx_n_s_file_format_version); + Py_CLEAR(clear_module_state->__pyx_n_s_file_label); + Py_CLEAR(clear_module_state->__pyx_n_s_file_path); + Py_CLEAR(clear_module_state->__pyx_n_s_filename_path); + Py_CLEAR(clear_module_state->__pyx_n_s_final); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_formats_as_category); + Py_CLEAR(clear_module_state->__pyx_n_s_formats_as_ordered_category); + Py_CLEAR(clear_module_state->__pyx_n_s_formats_presets); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_get); + Py_CLEAR(clear_module_state->__pyx_n_s_ignore_index); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_indx); + Py_CLEAR(clear_module_state->__pyx_n_s_inf); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_integer); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_items); + Py_CLEAR(clear_module_state->__pyx_n_s_jobs); + Py_CLEAR(clear_module_state->__pyx_n_s_key); + Py_CLEAR(clear_module_state->__pyx_n_s_keys); + Py_CLEAR(clear_module_state->__pyx_n_s_kwargs); + Py_CLEAR(clear_module_state->__pyx_n_s_label_name); + Py_CLEAR(clear_module_state->__pyx_n_s_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_limit); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_map); + Py_CLEAR(clear_module_state->__pyx_n_s_max); + Py_CLEAR(clear_module_state->__pyx_n_s_meta); + Py_CLEAR(clear_module_state->__pyx_n_s_metadata); + Py_CLEAR(clear_module_state->__pyx_n_s_metadataonly); + Py_CLEAR(clear_module_state->__pyx_n_s_metaonly); + Py_CLEAR(clear_module_state->__pyx_n_s_missing_ranges); + Py_CLEAR(clear_module_state->__pyx_n_s_missing_user_values); + Py_CLEAR(clear_module_state->__pyx_n_s_mp); + Py_CLEAR(clear_module_state->__pyx_n_s_multiprocess); + Py_CLEAR(clear_module_state->__pyx_n_s_multiprocessing); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_no_datetime_conversion); + Py_CLEAR(clear_module_state->__pyx_n_s_note); + Py_CLEAR(clear_module_state->__pyx_n_s_num_processes); + Py_CLEAR(clear_module_state->__pyx_n_s_num_rows); + Py_CLEAR(clear_module_state->__pyx_kp_s_num_rows_must_be_specified_for_r); + Py_CLEAR(clear_module_state->__pyx_n_s_number_rows); + Py_CLEAR(clear_module_state->__pyx_n_s_numrows); + Py_CLEAR(clear_module_state->__pyx_n_s_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_offsets); + Py_CLEAR(clear_module_state->__pyx_n_s_ordered); + Py_CLEAR(clear_module_state->__pyx_n_s_original_values); + Py_CLEAR(clear_module_state->__pyx_n_s_orival); + Py_CLEAR(clear_module_state->__pyx_n_s_output_format); + Py_CLEAR(clear_module_state->__pyx_n_s_pandas); + Py_CLEAR(clear_module_state->__pyx_n_s_pd); + Py_CLEAR(clear_module_state->__pyx_n_s_pool); + Py_CLEAR(clear_module_state->__pyx_n_s_pop); + Py_CLEAR(clear_module_state->__pyx_n_s_por); + Py_CLEAR(clear_module_state->__pyx_n_s_prev_div); + Py_CLEAR(clear_module_state->__pyx_n_s_prev_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_processes); + Py_CLEAR(clear_module_state->__pyx_n_s_pyreadstat_pyreadstat); + Py_CLEAR(clear_module_state->__pyx_kp_s_pyreadstat_pyreadstat_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_range); + Py_CLEAR(clear_module_state->__pyx_n_s_read_dta); + Py_CLEAR(clear_module_state->__pyx_n_s_read_file_in_chunks); + Py_CLEAR(clear_module_state->__pyx_n_s_read_file_multiprocessing); + Py_CLEAR(clear_module_state->__pyx_n_s_read_function); + Py_CLEAR(clear_module_state->__pyx_n_s_read_por); + Py_CLEAR(clear_module_state->__pyx_n_s_read_sas7bcat); + Py_CLEAR(clear_module_state->__pyx_kp_s_read_sas7bcat_is_not_supported); + Py_CLEAR(clear_module_state->__pyx_kp_s_read_sas7bcat_not_supported); + Py_CLEAR(clear_module_state->__pyx_n_s_read_sas7bdat); + Py_CLEAR(clear_module_state->__pyx_n_s_read_sav); + Py_CLEAR(clear_module_state->__pyx_n_s_read_xport); + Py_CLEAR(clear_module_state->__pyx_n_s_readstat_parser); + Py_CLEAR(clear_module_state->__pyx_n_s_restricted_integer); + Py_CLEAR(clear_module_state->__pyx_n_s_revdict); + Py_CLEAR(clear_module_state->__pyx_n_s_row_compress); + Py_CLEAR(clear_module_state->__pyx_n_s_row_compression); + Py_CLEAR(clear_module_state->__pyx_n_s_row_limit); + Py_CLEAR(clear_module_state->__pyx_n_s_row_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_sas7bcat); + Py_CLEAR(clear_module_state->__pyx_n_s_sas7bdat); + Py_CLEAR(clear_module_state->__pyx_n_s_sas_dataframe); + Py_CLEAR(clear_module_state->__pyx_n_s_sas_metadata); + Py_CLEAR(clear_module_state->__pyx_kp_s_sav_zsav); + Py_CLEAR(clear_module_state->__pyx_n_s_send); + Py_CLEAR(clear_module_state->__pyx_n_s_set_catalog_to_sas); + Py_CLEAR(clear_module_state->__pyx_n_s_set_value_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_set_value_labels_locals_lambda); + Py_CLEAR(clear_module_state->__pyx_n_s_sort); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_table_name); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_throw); + Py_CLEAR(clear_module_state->__pyx_n_s_usecols); + Py_CLEAR(clear_module_state->__pyx_n_s_user_missing); + Py_CLEAR(clear_module_state->__pyx_n_s_usernan); + Py_CLEAR(clear_module_state->__pyx_n_s_value_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_values); + Py_CLEAR(clear_module_state->__pyx_n_s_var_label); + Py_CLEAR(clear_module_state->__pyx_n_s_var_name); + Py_CLEAR(clear_module_state->__pyx_n_s_var_width); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_alignment); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_display_width); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_format); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_measure); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_to_label); + Py_CLEAR(clear_module_state->__pyx_n_s_variable_value_labels); + Py_CLEAR(clear_module_state->__pyx_n_s_version); + Py_CLEAR(clear_module_state->__pyx_n_s_worker); + Py_CLEAR(clear_module_state->__pyx_n_s_write_dta); + Py_CLEAR(clear_module_state->__pyx_n_s_write_por); + Py_CLEAR(clear_module_state->__pyx_n_s_write_sav); + Py_CLEAR(clear_module_state->__pyx_n_s_write_xport); + Py_CLEAR(clear_module_state->__pyx_n_s_x); + Py_CLEAR(clear_module_state->__pyx_n_s_xport); + Py_CLEAR(clear_module_state->__pyx_int_0); + Py_CLEAR(clear_module_state->__pyx_int_1); + Py_CLEAR(clear_module_state->__pyx_int_4); + Py_CLEAR(clear_module_state->__pyx_int_100000); + Py_CLEAR(clear_module_state->__pyx_codeobj_); + Py_CLEAR(clear_module_state->__pyx_tuple__2); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__5); + Py_CLEAR(clear_module_state->__pyx_tuple__7); + Py_CLEAR(clear_module_state->__pyx_tuple__11); + Py_CLEAR(clear_module_state->__pyx_tuple__13); + Py_CLEAR(clear_module_state->__pyx_tuple__15); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__23); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__26); + Py_CLEAR(clear_module_state->__pyx_tuple__28); + Py_CLEAR(clear_module_state->__pyx_tuple__29); + Py_CLEAR(clear_module_state->__pyx_tuple__30); + Py_CLEAR(clear_module_state->__pyx_tuple__31); + Py_CLEAR(clear_module_state->__pyx_tuple__33); + Py_CLEAR(clear_module_state->__pyx_tuple__34); + Py_CLEAR(clear_module_state->__pyx_tuple__36); + Py_CLEAR(clear_module_state->__pyx_tuple__37); + Py_CLEAR(clear_module_state->__pyx_tuple__39); + Py_CLEAR(clear_module_state->__pyx_tuple__41); + Py_CLEAR(clear_module_state->__pyx_tuple__43); + Py_CLEAR(clear_module_state->__pyx_codeobj__12); + Py_CLEAR(clear_module_state->__pyx_codeobj__14); + Py_CLEAR(clear_module_state->__pyx_codeobj__16); + Py_CLEAR(clear_module_state->__pyx_codeobj__17); + Py_CLEAR(clear_module_state->__pyx_codeobj__19); + Py_CLEAR(clear_module_state->__pyx_codeobj__21); + Py_CLEAR(clear_module_state->__pyx_codeobj__24); + Py_CLEAR(clear_module_state->__pyx_codeobj__27); + Py_CLEAR(clear_module_state->__pyx_codeobj__32); + Py_CLEAR(clear_module_state->__pyx_codeobj__35); + Py_CLEAR(clear_module_state->__pyx_codeobj__38); + Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__42); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container); + Py_VISIT(traverse_module_state->__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels); + Py_VISIT(traverse_module_state->__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels); + Py_VISIT(traverse_module_state->__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks); + Py_VISIT(traverse_module_state->__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks); + Py_VISIT(traverse_module_state->__pyx_n_s_Categorical); + Py_VISIT(traverse_module_state->__pyx_kp_s_F_var_width_0); + Py_VISIT(traverse_module_state->__pyx_kp_s_N_var_width); + Py_VISIT(traverse_module_state->__pyx_n_s_Pool); + Py_VISIT(traverse_module_state->__pyx_n_s_PyreadstatError); + Py_VISIT(traverse_module_state->__pyx_kp_s_The_number_of_rows_of_the_file_c); + Py_VISIT(traverse_module_state->__pyx_kp_s_Version_not_supported); + Py_VISIT(traverse_module_state->__pyx_n_s__10); + Py_VISIT(traverse_module_state->__pyx_n_s__44); + Py_VISIT(traverse_module_state->__pyx_kp_s__6); + Py_VISIT(traverse_module_state->__pyx_n_s__8); + Py_VISIT(traverse_module_state->__pyx_kp_u__9); + Py_VISIT(traverse_module_state->__pyx_n_s_apply); + Py_VISIT(traverse_module_state->__pyx_n_s_apply_value_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_args); + Py_VISIT(traverse_module_state->__pyx_n_s_astype); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_axis); + Py_VISIT(traverse_module_state->__pyx_n_s_catalog); + Py_VISIT(traverse_module_state->__pyx_n_s_catalog_file); + Py_VISIT(traverse_module_state->__pyx_n_s_catalog_metadata); + Py_VISIT(traverse_module_state->__pyx_n_s_catalog_metadata_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_categories); + Py_VISIT(traverse_module_state->__pyx_n_s_category); + Py_VISIT(traverse_module_state->__pyx_n_s_chunks); + Py_VISIT(traverse_module_state->__pyx_n_s_chunksize); + Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_close); + Py_VISIT(traverse_module_state->__pyx_n_s_col_format); + Py_VISIT(traverse_module_state->__pyx_n_s_col_name); + Py_VISIT(traverse_module_state->__pyx_n_s_column_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_columns); + Py_VISIT(traverse_module_state->__pyx_n_s_compress); + Py_VISIT(traverse_module_state->__pyx_kp_s_compress_and_row_compress_cannot); + Py_VISIT(traverse_module_state->__pyx_n_s_concat); + Py_VISIT(traverse_module_state->__pyx_n_s_copy); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_count); + Py_VISIT(traverse_module_state->__pyx_n_s_curcat); + Py_VISIT(traverse_module_state->__pyx_n_s_current_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_data_frame); + Py_VISIT(traverse_module_state->__pyx_n_s_dataframe); + Py_VISIT(traverse_module_state->__pyx_n_s_dates_as_pandas); + Py_VISIT(traverse_module_state->__pyx_n_s_dates_as_pandas_datetime); + Py_VISIT(traverse_module_state->__pyx_n_s_deepcopy); + Py_VISIT(traverse_module_state->__pyx_n_s_df); + Py_VISIT(traverse_module_state->__pyx_n_s_df_copy); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_disable_datetime_conversion); + Py_VISIT(traverse_module_state->__pyx_n_s_div); + Py_VISIT(traverse_module_state->__pyx_n_s_divs); + Py_VISIT(traverse_module_state->__pyx_n_s_dst_path); + Py_VISIT(traverse_module_state->__pyx_n_s_dta); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encoding); + Py_VISIT(traverse_module_state->__pyx_n_s_enumerate); + Py_VISIT(traverse_module_state->__pyx_n_s_extra_date_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_extra_datetime_formats); + Py_VISIT(traverse_module_state->__pyx_n_s_file_extension); + Py_VISIT(traverse_module_state->__pyx_n_s_file_format); + Py_VISIT(traverse_module_state->__pyx_n_s_file_format_version); + Py_VISIT(traverse_module_state->__pyx_n_s_file_label); + Py_VISIT(traverse_module_state->__pyx_n_s_file_path); + Py_VISIT(traverse_module_state->__pyx_n_s_filename_path); + Py_VISIT(traverse_module_state->__pyx_n_s_final); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_formats_as_category); + Py_VISIT(traverse_module_state->__pyx_n_s_formats_as_ordered_category); + Py_VISIT(traverse_module_state->__pyx_n_s_formats_presets); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_get); + Py_VISIT(traverse_module_state->__pyx_n_s_ignore_index); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_indx); + Py_VISIT(traverse_module_state->__pyx_n_s_inf); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_integer); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_items); + Py_VISIT(traverse_module_state->__pyx_n_s_jobs); + Py_VISIT(traverse_module_state->__pyx_n_s_key); + Py_VISIT(traverse_module_state->__pyx_n_s_keys); + Py_VISIT(traverse_module_state->__pyx_n_s_kwargs); + Py_VISIT(traverse_module_state->__pyx_n_s_label_name); + Py_VISIT(traverse_module_state->__pyx_n_s_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_limit); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_map); + Py_VISIT(traverse_module_state->__pyx_n_s_max); + Py_VISIT(traverse_module_state->__pyx_n_s_meta); + Py_VISIT(traverse_module_state->__pyx_n_s_metadata); + Py_VISIT(traverse_module_state->__pyx_n_s_metadataonly); + Py_VISIT(traverse_module_state->__pyx_n_s_metaonly); + Py_VISIT(traverse_module_state->__pyx_n_s_missing_ranges); + Py_VISIT(traverse_module_state->__pyx_n_s_missing_user_values); + Py_VISIT(traverse_module_state->__pyx_n_s_mp); + Py_VISIT(traverse_module_state->__pyx_n_s_multiprocess); + Py_VISIT(traverse_module_state->__pyx_n_s_multiprocessing); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_no_datetime_conversion); + Py_VISIT(traverse_module_state->__pyx_n_s_note); + Py_VISIT(traverse_module_state->__pyx_n_s_num_processes); + Py_VISIT(traverse_module_state->__pyx_n_s_num_rows); + Py_VISIT(traverse_module_state->__pyx_kp_s_num_rows_must_be_specified_for_r); + Py_VISIT(traverse_module_state->__pyx_n_s_number_rows); + Py_VISIT(traverse_module_state->__pyx_n_s_numrows); + Py_VISIT(traverse_module_state->__pyx_n_s_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_offsets); + Py_VISIT(traverse_module_state->__pyx_n_s_ordered); + Py_VISIT(traverse_module_state->__pyx_n_s_original_values); + Py_VISIT(traverse_module_state->__pyx_n_s_orival); + Py_VISIT(traverse_module_state->__pyx_n_s_output_format); + Py_VISIT(traverse_module_state->__pyx_n_s_pandas); + Py_VISIT(traverse_module_state->__pyx_n_s_pd); + Py_VISIT(traverse_module_state->__pyx_n_s_pool); + Py_VISIT(traverse_module_state->__pyx_n_s_pop); + Py_VISIT(traverse_module_state->__pyx_n_s_por); + Py_VISIT(traverse_module_state->__pyx_n_s_prev_div); + Py_VISIT(traverse_module_state->__pyx_n_s_prev_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_processes); + Py_VISIT(traverse_module_state->__pyx_n_s_pyreadstat_pyreadstat); + Py_VISIT(traverse_module_state->__pyx_kp_s_pyreadstat_pyreadstat_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_range); + Py_VISIT(traverse_module_state->__pyx_n_s_read_dta); + Py_VISIT(traverse_module_state->__pyx_n_s_read_file_in_chunks); + Py_VISIT(traverse_module_state->__pyx_n_s_read_file_multiprocessing); + Py_VISIT(traverse_module_state->__pyx_n_s_read_function); + Py_VISIT(traverse_module_state->__pyx_n_s_read_por); + Py_VISIT(traverse_module_state->__pyx_n_s_read_sas7bcat); + Py_VISIT(traverse_module_state->__pyx_kp_s_read_sas7bcat_is_not_supported); + Py_VISIT(traverse_module_state->__pyx_kp_s_read_sas7bcat_not_supported); + Py_VISIT(traverse_module_state->__pyx_n_s_read_sas7bdat); + Py_VISIT(traverse_module_state->__pyx_n_s_read_sav); + Py_VISIT(traverse_module_state->__pyx_n_s_read_xport); + Py_VISIT(traverse_module_state->__pyx_n_s_readstat_parser); + Py_VISIT(traverse_module_state->__pyx_n_s_restricted_integer); + Py_VISIT(traverse_module_state->__pyx_n_s_revdict); + Py_VISIT(traverse_module_state->__pyx_n_s_row_compress); + Py_VISIT(traverse_module_state->__pyx_n_s_row_compression); + Py_VISIT(traverse_module_state->__pyx_n_s_row_limit); + Py_VISIT(traverse_module_state->__pyx_n_s_row_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_sas7bcat); + Py_VISIT(traverse_module_state->__pyx_n_s_sas7bdat); + Py_VISIT(traverse_module_state->__pyx_n_s_sas_dataframe); + Py_VISIT(traverse_module_state->__pyx_n_s_sas_metadata); + Py_VISIT(traverse_module_state->__pyx_kp_s_sav_zsav); + Py_VISIT(traverse_module_state->__pyx_n_s_send); + Py_VISIT(traverse_module_state->__pyx_n_s_set_catalog_to_sas); + Py_VISIT(traverse_module_state->__pyx_n_s_set_value_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_set_value_labels_locals_lambda); + Py_VISIT(traverse_module_state->__pyx_n_s_sort); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_table_name); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_throw); + Py_VISIT(traverse_module_state->__pyx_n_s_usecols); + Py_VISIT(traverse_module_state->__pyx_n_s_user_missing); + Py_VISIT(traverse_module_state->__pyx_n_s_usernan); + Py_VISIT(traverse_module_state->__pyx_n_s_value_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_values); + Py_VISIT(traverse_module_state->__pyx_n_s_var_label); + Py_VISIT(traverse_module_state->__pyx_n_s_var_name); + Py_VISIT(traverse_module_state->__pyx_n_s_var_width); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_alignment); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_display_width); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_format); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_measure); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_to_label); + Py_VISIT(traverse_module_state->__pyx_n_s_variable_value_labels); + Py_VISIT(traverse_module_state->__pyx_n_s_version); + Py_VISIT(traverse_module_state->__pyx_n_s_worker); + Py_VISIT(traverse_module_state->__pyx_n_s_write_dta); + Py_VISIT(traverse_module_state->__pyx_n_s_write_por); + Py_VISIT(traverse_module_state->__pyx_n_s_write_sav); + Py_VISIT(traverse_module_state->__pyx_n_s_write_xport); + Py_VISIT(traverse_module_state->__pyx_n_s_x); + Py_VISIT(traverse_module_state->__pyx_n_s_xport); + Py_VISIT(traverse_module_state->__pyx_int_0); + Py_VISIT(traverse_module_state->__pyx_int_1); + Py_VISIT(traverse_module_state->__pyx_int_4); + Py_VISIT(traverse_module_state->__pyx_int_100000); + Py_VISIT(traverse_module_state->__pyx_codeobj_); + Py_VISIT(traverse_module_state->__pyx_tuple__2); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__5); + Py_VISIT(traverse_module_state->__pyx_tuple__7); + Py_VISIT(traverse_module_state->__pyx_tuple__11); + Py_VISIT(traverse_module_state->__pyx_tuple__13); + Py_VISIT(traverse_module_state->__pyx_tuple__15); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__23); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__26); + Py_VISIT(traverse_module_state->__pyx_tuple__28); + Py_VISIT(traverse_module_state->__pyx_tuple__29); + Py_VISIT(traverse_module_state->__pyx_tuple__30); + Py_VISIT(traverse_module_state->__pyx_tuple__31); + Py_VISIT(traverse_module_state->__pyx_tuple__33); + Py_VISIT(traverse_module_state->__pyx_tuple__34); + Py_VISIT(traverse_module_state->__pyx_tuple__36); + Py_VISIT(traverse_module_state->__pyx_tuple__37); + Py_VISIT(traverse_module_state->__pyx_tuple__39); + Py_VISIT(traverse_module_state->__pyx_tuple__41); + Py_VISIT(traverse_module_state->__pyx_tuple__43); + Py_VISIT(traverse_module_state->__pyx_codeobj__12); + Py_VISIT(traverse_module_state->__pyx_codeobj__14); + Py_VISIT(traverse_module_state->__pyx_codeobj__16); + Py_VISIT(traverse_module_state->__pyx_codeobj__17); + Py_VISIT(traverse_module_state->__pyx_codeobj__19); + Py_VISIT(traverse_module_state->__pyx_codeobj__21); + Py_VISIT(traverse_module_state->__pyx_codeobj__24); + Py_VISIT(traverse_module_state->__pyx_codeobj__27); + Py_VISIT(traverse_module_state->__pyx_codeobj__32); + Py_VISIT(traverse_module_state->__pyx_codeobj__35); + Py_VISIT(traverse_module_state->__pyx_codeobj__38); + Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__42); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_10pyreadstat_16_readstat_parser_data_container __pyx_mstate_global->__pyx_ptype_10pyreadstat_16_readstat_parser_data_container +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels __pyx_mstate_global->__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels +#define __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks __pyx_mstate_global->__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks +#endif +#define __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels __pyx_mstate_global->__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels +#define __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks __pyx_mstate_global->__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks +#define __pyx_n_s_Categorical __pyx_mstate_global->__pyx_n_s_Categorical +#define __pyx_kp_s_F_var_width_0 __pyx_mstate_global->__pyx_kp_s_F_var_width_0 +#define __pyx_kp_s_N_var_width __pyx_mstate_global->__pyx_kp_s_N_var_width +#define __pyx_n_s_Pool __pyx_mstate_global->__pyx_n_s_Pool +#define __pyx_n_s_PyreadstatError __pyx_mstate_global->__pyx_n_s_PyreadstatError +#define __pyx_kp_s_The_number_of_rows_of_the_file_c __pyx_mstate_global->__pyx_kp_s_The_number_of_rows_of_the_file_c +#define __pyx_kp_s_Version_not_supported __pyx_mstate_global->__pyx_kp_s_Version_not_supported +#define __pyx_n_s__10 __pyx_mstate_global->__pyx_n_s__10 +#define __pyx_n_s__44 __pyx_mstate_global->__pyx_n_s__44 +#define __pyx_kp_s__6 __pyx_mstate_global->__pyx_kp_s__6 +#define __pyx_n_s__8 __pyx_mstate_global->__pyx_n_s__8 +#define __pyx_kp_u__9 __pyx_mstate_global->__pyx_kp_u__9 +#define __pyx_n_s_apply __pyx_mstate_global->__pyx_n_s_apply +#define __pyx_n_s_apply_value_formats __pyx_mstate_global->__pyx_n_s_apply_value_formats +#define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args +#define __pyx_n_s_astype __pyx_mstate_global->__pyx_n_s_astype +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_axis __pyx_mstate_global->__pyx_n_s_axis +#define __pyx_n_s_catalog __pyx_mstate_global->__pyx_n_s_catalog +#define __pyx_n_s_catalog_file __pyx_mstate_global->__pyx_n_s_catalog_file +#define __pyx_n_s_catalog_metadata __pyx_mstate_global->__pyx_n_s_catalog_metadata +#define __pyx_n_s_catalog_metadata_copy __pyx_mstate_global->__pyx_n_s_catalog_metadata_copy +#define __pyx_n_s_categories __pyx_mstate_global->__pyx_n_s_categories +#define __pyx_n_s_category __pyx_mstate_global->__pyx_n_s_category +#define __pyx_n_s_chunks __pyx_mstate_global->__pyx_n_s_chunks +#define __pyx_n_s_chunksize __pyx_mstate_global->__pyx_n_s_chunksize +#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close +#define __pyx_n_s_col_format __pyx_mstate_global->__pyx_n_s_col_format +#define __pyx_n_s_col_name __pyx_mstate_global->__pyx_n_s_col_name +#define __pyx_n_s_column_labels __pyx_mstate_global->__pyx_n_s_column_labels +#define __pyx_n_s_columns __pyx_mstate_global->__pyx_n_s_columns +#define __pyx_n_s_compress __pyx_mstate_global->__pyx_n_s_compress +#define __pyx_kp_s_compress_and_row_compress_cannot __pyx_mstate_global->__pyx_kp_s_compress_and_row_compress_cannot +#define __pyx_n_s_concat __pyx_mstate_global->__pyx_n_s_concat +#define __pyx_n_s_copy __pyx_mstate_global->__pyx_n_s_copy +#define __pyx_n_s_cpu_count __pyx_mstate_global->__pyx_n_s_cpu_count +#define __pyx_n_s_curcat __pyx_mstate_global->__pyx_n_s_curcat +#define __pyx_n_s_current_labels __pyx_mstate_global->__pyx_n_s_current_labels +#define __pyx_n_s_data_frame __pyx_mstate_global->__pyx_n_s_data_frame +#define __pyx_n_s_dataframe __pyx_mstate_global->__pyx_n_s_dataframe +#define __pyx_n_s_dates_as_pandas __pyx_mstate_global->__pyx_n_s_dates_as_pandas +#define __pyx_n_s_dates_as_pandas_datetime __pyx_mstate_global->__pyx_n_s_dates_as_pandas_datetime +#define __pyx_n_s_deepcopy __pyx_mstate_global->__pyx_n_s_deepcopy +#define __pyx_n_s_df __pyx_mstate_global->__pyx_n_s_df +#define __pyx_n_s_df_copy __pyx_mstate_global->__pyx_n_s_df_copy +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_disable_datetime_conversion __pyx_mstate_global->__pyx_n_s_disable_datetime_conversion +#define __pyx_n_s_div __pyx_mstate_global->__pyx_n_s_div +#define __pyx_n_s_divs __pyx_mstate_global->__pyx_n_s_divs +#define __pyx_n_s_dst_path __pyx_mstate_global->__pyx_n_s_dst_path +#define __pyx_n_s_dta __pyx_mstate_global->__pyx_n_s_dta +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encoding __pyx_mstate_global->__pyx_n_s_encoding +#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate +#define __pyx_n_s_extra_date_formats __pyx_mstate_global->__pyx_n_s_extra_date_formats +#define __pyx_n_s_extra_datetime_formats __pyx_mstate_global->__pyx_n_s_extra_datetime_formats +#define __pyx_n_s_file_extension __pyx_mstate_global->__pyx_n_s_file_extension +#define __pyx_n_s_file_format __pyx_mstate_global->__pyx_n_s_file_format +#define __pyx_n_s_file_format_version __pyx_mstate_global->__pyx_n_s_file_format_version +#define __pyx_n_s_file_label __pyx_mstate_global->__pyx_n_s_file_label +#define __pyx_n_s_file_path __pyx_mstate_global->__pyx_n_s_file_path +#define __pyx_n_s_filename_path __pyx_mstate_global->__pyx_n_s_filename_path +#define __pyx_n_s_final __pyx_mstate_global->__pyx_n_s_final +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_formats_as_category __pyx_mstate_global->__pyx_n_s_formats_as_category +#define __pyx_n_s_formats_as_ordered_category __pyx_mstate_global->__pyx_n_s_formats_as_ordered_category +#define __pyx_n_s_formats_presets __pyx_mstate_global->__pyx_n_s_formats_presets +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get +#define __pyx_n_s_ignore_index __pyx_mstate_global->__pyx_n_s_ignore_index +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_indx __pyx_mstate_global->__pyx_n_s_indx +#define __pyx_n_s_inf __pyx_mstate_global->__pyx_n_s_inf +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_integer __pyx_mstate_global->__pyx_n_s_integer +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_items __pyx_mstate_global->__pyx_n_s_items +#define __pyx_n_s_jobs __pyx_mstate_global->__pyx_n_s_jobs +#define __pyx_n_s_key __pyx_mstate_global->__pyx_n_s_key +#define __pyx_n_s_keys __pyx_mstate_global->__pyx_n_s_keys +#define __pyx_n_s_kwargs __pyx_mstate_global->__pyx_n_s_kwargs +#define __pyx_n_s_label_name __pyx_mstate_global->__pyx_n_s_label_name +#define __pyx_n_s_labels __pyx_mstate_global->__pyx_n_s_labels +#define __pyx_n_s_limit __pyx_mstate_global->__pyx_n_s_limit +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_map __pyx_mstate_global->__pyx_n_s_map +#define __pyx_n_s_max __pyx_mstate_global->__pyx_n_s_max +#define __pyx_n_s_meta __pyx_mstate_global->__pyx_n_s_meta +#define __pyx_n_s_metadata __pyx_mstate_global->__pyx_n_s_metadata +#define __pyx_n_s_metadataonly __pyx_mstate_global->__pyx_n_s_metadataonly +#define __pyx_n_s_metaonly __pyx_mstate_global->__pyx_n_s_metaonly +#define __pyx_n_s_missing_ranges __pyx_mstate_global->__pyx_n_s_missing_ranges +#define __pyx_n_s_missing_user_values __pyx_mstate_global->__pyx_n_s_missing_user_values +#define __pyx_n_s_mp __pyx_mstate_global->__pyx_n_s_mp +#define __pyx_n_s_multiprocess __pyx_mstate_global->__pyx_n_s_multiprocess +#define __pyx_n_s_multiprocessing __pyx_mstate_global->__pyx_n_s_multiprocessing +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_no_datetime_conversion __pyx_mstate_global->__pyx_n_s_no_datetime_conversion +#define __pyx_n_s_note __pyx_mstate_global->__pyx_n_s_note +#define __pyx_n_s_num_processes __pyx_mstate_global->__pyx_n_s_num_processes +#define __pyx_n_s_num_rows __pyx_mstate_global->__pyx_n_s_num_rows +#define __pyx_kp_s_num_rows_must_be_specified_for_r __pyx_mstate_global->__pyx_kp_s_num_rows_must_be_specified_for_r +#define __pyx_n_s_number_rows __pyx_mstate_global->__pyx_n_s_number_rows +#define __pyx_n_s_numrows __pyx_mstate_global->__pyx_n_s_numrows +#define __pyx_n_s_offset __pyx_mstate_global->__pyx_n_s_offset +#define __pyx_n_s_offsets __pyx_mstate_global->__pyx_n_s_offsets +#define __pyx_n_s_ordered __pyx_mstate_global->__pyx_n_s_ordered +#define __pyx_n_s_original_values __pyx_mstate_global->__pyx_n_s_original_values +#define __pyx_n_s_orival __pyx_mstate_global->__pyx_n_s_orival +#define __pyx_n_s_output_format __pyx_mstate_global->__pyx_n_s_output_format +#define __pyx_n_s_pandas __pyx_mstate_global->__pyx_n_s_pandas +#define __pyx_n_s_pd __pyx_mstate_global->__pyx_n_s_pd +#define __pyx_n_s_pool __pyx_mstate_global->__pyx_n_s_pool +#define __pyx_n_s_pop __pyx_mstate_global->__pyx_n_s_pop +#define __pyx_n_s_por __pyx_mstate_global->__pyx_n_s_por +#define __pyx_n_s_prev_div __pyx_mstate_global->__pyx_n_s_prev_div +#define __pyx_n_s_prev_offset __pyx_mstate_global->__pyx_n_s_prev_offset +#define __pyx_n_s_processes __pyx_mstate_global->__pyx_n_s_processes +#define __pyx_n_s_pyreadstat_pyreadstat __pyx_mstate_global->__pyx_n_s_pyreadstat_pyreadstat +#define __pyx_kp_s_pyreadstat_pyreadstat_pyx __pyx_mstate_global->__pyx_kp_s_pyreadstat_pyreadstat_pyx +#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range +#define __pyx_n_s_read_dta __pyx_mstate_global->__pyx_n_s_read_dta +#define __pyx_n_s_read_file_in_chunks __pyx_mstate_global->__pyx_n_s_read_file_in_chunks +#define __pyx_n_s_read_file_multiprocessing __pyx_mstate_global->__pyx_n_s_read_file_multiprocessing +#define __pyx_n_s_read_function __pyx_mstate_global->__pyx_n_s_read_function +#define __pyx_n_s_read_por __pyx_mstate_global->__pyx_n_s_read_por +#define __pyx_n_s_read_sas7bcat __pyx_mstate_global->__pyx_n_s_read_sas7bcat +#define __pyx_kp_s_read_sas7bcat_is_not_supported __pyx_mstate_global->__pyx_kp_s_read_sas7bcat_is_not_supported +#define __pyx_kp_s_read_sas7bcat_not_supported __pyx_mstate_global->__pyx_kp_s_read_sas7bcat_not_supported +#define __pyx_n_s_read_sas7bdat __pyx_mstate_global->__pyx_n_s_read_sas7bdat +#define __pyx_n_s_read_sav __pyx_mstate_global->__pyx_n_s_read_sav +#define __pyx_n_s_read_xport __pyx_mstate_global->__pyx_n_s_read_xport +#define __pyx_n_s_readstat_parser __pyx_mstate_global->__pyx_n_s_readstat_parser +#define __pyx_n_s_restricted_integer __pyx_mstate_global->__pyx_n_s_restricted_integer +#define __pyx_n_s_revdict __pyx_mstate_global->__pyx_n_s_revdict +#define __pyx_n_s_row_compress __pyx_mstate_global->__pyx_n_s_row_compress +#define __pyx_n_s_row_compression __pyx_mstate_global->__pyx_n_s_row_compression +#define __pyx_n_s_row_limit __pyx_mstate_global->__pyx_n_s_row_limit +#define __pyx_n_s_row_offset __pyx_mstate_global->__pyx_n_s_row_offset +#define __pyx_n_s_sas7bcat __pyx_mstate_global->__pyx_n_s_sas7bcat +#define __pyx_n_s_sas7bdat __pyx_mstate_global->__pyx_n_s_sas7bdat +#define __pyx_n_s_sas_dataframe __pyx_mstate_global->__pyx_n_s_sas_dataframe +#define __pyx_n_s_sas_metadata __pyx_mstate_global->__pyx_n_s_sas_metadata +#define __pyx_kp_s_sav_zsav __pyx_mstate_global->__pyx_kp_s_sav_zsav +#define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send +#define __pyx_n_s_set_catalog_to_sas __pyx_mstate_global->__pyx_n_s_set_catalog_to_sas +#define __pyx_n_s_set_value_labels __pyx_mstate_global->__pyx_n_s_set_value_labels +#define __pyx_n_s_set_value_labels_locals_lambda __pyx_mstate_global->__pyx_n_s_set_value_labels_locals_lambda +#define __pyx_n_s_sort __pyx_mstate_global->__pyx_n_s_sort +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_table_name __pyx_mstate_global->__pyx_n_s_table_name +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw +#define __pyx_n_s_usecols __pyx_mstate_global->__pyx_n_s_usecols +#define __pyx_n_s_user_missing __pyx_mstate_global->__pyx_n_s_user_missing +#define __pyx_n_s_usernan __pyx_mstate_global->__pyx_n_s_usernan +#define __pyx_n_s_value_labels __pyx_mstate_global->__pyx_n_s_value_labels +#define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values +#define __pyx_n_s_var_label __pyx_mstate_global->__pyx_n_s_var_label +#define __pyx_n_s_var_name __pyx_mstate_global->__pyx_n_s_var_name +#define __pyx_n_s_var_width __pyx_mstate_global->__pyx_n_s_var_width +#define __pyx_n_s_variable_alignment __pyx_mstate_global->__pyx_n_s_variable_alignment +#define __pyx_n_s_variable_display_width __pyx_mstate_global->__pyx_n_s_variable_display_width +#define __pyx_n_s_variable_format __pyx_mstate_global->__pyx_n_s_variable_format +#define __pyx_n_s_variable_measure __pyx_mstate_global->__pyx_n_s_variable_measure +#define __pyx_n_s_variable_to_label __pyx_mstate_global->__pyx_n_s_variable_to_label +#define __pyx_n_s_variable_value_labels __pyx_mstate_global->__pyx_n_s_variable_value_labels +#define __pyx_n_s_version __pyx_mstate_global->__pyx_n_s_version +#define __pyx_n_s_worker __pyx_mstate_global->__pyx_n_s_worker +#define __pyx_n_s_write_dta __pyx_mstate_global->__pyx_n_s_write_dta +#define __pyx_n_s_write_por __pyx_mstate_global->__pyx_n_s_write_por +#define __pyx_n_s_write_sav __pyx_mstate_global->__pyx_n_s_write_sav +#define __pyx_n_s_write_xport __pyx_mstate_global->__pyx_n_s_write_xport +#define __pyx_n_s_x __pyx_mstate_global->__pyx_n_s_x +#define __pyx_n_s_xport __pyx_mstate_global->__pyx_n_s_xport +#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 +#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 +#define __pyx_int_4 __pyx_mstate_global->__pyx_int_4 +#define __pyx_int_100000 __pyx_mstate_global->__pyx_int_100000 +#define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_ +#define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2 +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 +#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 +#define __pyx_tuple__13 __pyx_mstate_global->__pyx_tuple__13 +#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26 +#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28 +#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29 +#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30 +#define __pyx_tuple__31 __pyx_mstate_global->__pyx_tuple__31 +#define __pyx_tuple__33 __pyx_mstate_global->__pyx_tuple__33 +#define __pyx_tuple__34 __pyx_mstate_global->__pyx_tuple__34 +#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36 +#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 +#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 +#define __pyx_tuple__41 __pyx_mstate_global->__pyx_tuple__41 +#define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43 +#define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12 +#define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14 +#define __pyx_codeobj__16 __pyx_mstate_global->__pyx_codeobj__16 +#define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17 +#define __pyx_codeobj__19 __pyx_mstate_global->__pyx_codeobj__19 +#define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21 +#define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24 +#define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27 +#define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32 +#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35 +#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42 +/* #### Code section: module_code ### */ /* "pyreadstat/pyreadstat.pyx":41 * # Parsing functions @@ -2244,10 +3978,22 @@ static PyObject *__pyx_codeobj__35; */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_read_sas7bdat[] = "\n Read a SAS sas7bdat file.\n It accepts the path to a sas7bcat.\n \n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In python 2.7 the string is assumed to be utf-8 encoded.\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n catalog_file : str, optional\n path to a sas7bcat file. By default is None. If not None, will parse the catalog file and replace the values\n by the formats in the catalog, if any appropiate is found. If this is not the behavior you are looking for,\n Use read_sas7bcat to parse the catalog independently\n of the sas7bdat and set_catalog_to_sas to apply the resulting format into sas7bdat files.\n formats_as_category : bool, optional\n Will take effect only if the catalog_file was specified. If True the variables whose values were replaced\n by the formats will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns wil""l be imported. Case sensitive!\n user_missing : bool, optional\n by default False, in this case user defined missing values are delivered as nan. If true, the missing values\n will be deliver as is, and an extra piece of information will be set in the metadata (missing_user_values)\n to be able to interpret those values as missing.\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n \n\n Returns\n -------\n data_frame : pandas d""ataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata\n object with metadata. The members variables_value_labels will be empty unless a valid catalog file is\n supplied.\n Look at the documentation for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_1read_sas7bdat = {"read_sas7bdat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_read_sas7bdat}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_read_sas7bdat, "\n Read a SAS sas7bdat file.\n It accepts the path to a sas7bcat.\n \n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In python 2.7 the string is assumed to be utf-8 encoded.\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n catalog_file : str, optional\n path to a sas7bcat file. By default is None. If not None, will parse the catalog file and replace the values\n by the formats in the catalog, if any appropiate is found. If this is not the behavior you are looking for,\n Use read_sas7bcat to parse the catalog independently\n of the sas7bdat and set_catalog_to_sas to apply the resulting format into sas7bdat files.\n formats_as_category : bool, optional\n Will take effect only if the catalog_file was specified. If True the variables whose values were replaced\n by the formats will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns wil""l be imported. Case sensitive!\n user_missing : bool, optional\n by default False, in this case user defined missing values are delivered as nan. If true, the missing values\n will be deliver as is, and an extra piece of information will be set in the metadata (missing_user_values)\n to be able to interpret those values as missing.\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n \n\n Returns\n -------\n data_frame : pandas d""ataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata\n object with metadata. The members variables_value_labels will be empty unless a valid catalog file is\n supplied.\n Look at the documentation for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_1read_sas7bdat = {"read_sas7bdat", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_read_sas7bdat}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_filename_path = 0; PyObject *__pyx_v_metadataonly = 0; PyObject *__pyx_v_dates_as_pandas_datetime = 0; @@ -2263,6 +4009,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__p PyObject *__pyx_v_output_format = 0; PyObject *__pyx_v_extra_datetime_formats = 0; PyObject *__pyx_v_extra_date_formats = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2270,11 +4020,11 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_sas7bdat (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_catalog_file,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_user_missing,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_catalog_file,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_user_missing,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)Py_False); - values[2] = ((PyObject *)Py_False); - values[3] = ((PyObject *)Py_None); + values[1] = ((PyObject *)((PyObject *)Py_False)); + values[2] = ((PyObject *)((PyObject *)Py_False)); + values[3] = ((PyObject *)((PyObject *)Py_None)); /* "pyreadstat/pyreadstat.pyx":42 * @@ -2283,11 +4033,11 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__p * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, * list extra_datetime_formats=None, list extra_date_formats=None): */ - values[4] = ((PyObject *)Py_True); - values[5] = ((PyObject *)Py_False); - values[6] = ((PyObject*)Py_None); - values[7] = ((PyObject*)Py_None); - values[8] = ((PyObject *)Py_False); + values[4] = ((PyObject *)((PyObject *)Py_True)); + values[5] = ((PyObject *)((PyObject *)Py_False)); + values[6] = ((PyObject*)((PyObject *)Py_None)); + values[7] = ((PyObject*)((PyObject *)Py_None)); + values[8] = ((PyObject *)((PyObject *)Py_False)); /* "pyreadstat/pyreadstat.pyx":43 * def read_sas7bdat(filename_path, metadataonly=False, dates_as_pandas_datetime=False, catalog_file=None, @@ -2296,8 +4046,8 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__p * list extra_datetime_formats=None, list extra_date_formats=None): * r""" */ - values[9] = ((PyObject *)Py_False); - values[12] = ((PyObject*)Py_None); + values[9] = ((PyObject *)((PyObject *)Py_False)); + values[12] = ((PyObject*)((PyObject *)Py_None)); /* "pyreadstat/pyreadstat.pyx":44 * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, @@ -2306,169 +4056,184 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__p * r""" * Read a SAS sas7bdat file. */ - values[13] = ((PyObject*)Py_None); - values[14] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[13] = ((PyObject*)((PyObject *)Py_None)); + values[14] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + switch (__pyx_nargs) { + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename_path)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadataonly); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_metadataonly); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dates_as_pandas_datetime); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dates_as_pandas_datetime); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_catalog_file); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_catalog_file); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_category); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_ordered_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_ordered_category); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_usecols); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_usecols); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_missing); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_user_missing); if (value) { values[8] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_disable_datetime_conversion); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_disable_datetime_conversion); if (value) { values[9] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_limit); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_limit); if (value) { values[10] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_offset); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_offset); if (value) { values[11] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_format); if (value) { values[12] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_datetime_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_datetime_formats); if (value) { values[13] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_date_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_date_formats); if (value) { values[14] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_sas7bdat") < 0)) __PYX_ERR(0, 41, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read_sas7bdat") < 0)) __PYX_ERR(0, 41, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + switch (__pyx_nargs) { + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -2486,12 +4251,12 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__p if (values[10]) { __pyx_v_row_limit = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L3_error) } else { - __pyx_v_row_limit = ((int)0); + __pyx_v_row_limit = ((int)((int)0)); } if (values[11]) { __pyx_v_row_offset = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L3_error) } else { - __pyx_v_row_offset = ((int)0); + __pyx_v_row_offset = ((int)((int)0)); } __pyx_v_output_format = ((PyObject*)values[12]); __pyx_v_extra_datetime_formats = ((PyObject*)values[13]); @@ -2499,7 +4264,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_1read_sas7bdat(PyObject *__p } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_sas7bdat", 0, 1, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 41, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_sas7bdat", 0, 1, 15, __pyx_nargs); __PYX_ERR(0, 41, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_sas7bdat", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2535,6 +4300,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED int __pyx_v_usernan; int __pyx_v_no_datetime_conversion; __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension; PyObject *__pyx_v_data_frame = NULL; PyObject *__pyx_v_metadata = NULL; CYTHON_UNUSED PyObject *__pyx_v__ = NULL; @@ -2568,7 +4334,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED * metaonly = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 111, __pyx_L1_error) if (__pyx_t_1) { /* "pyreadstat/pyreadstat.pyx":112 @@ -2605,7 +4371,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED * dates_as_pandas = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 115, __pyx_L1_error) if (__pyx_t_1) { /* "pyreadstat/pyreadstat.pyx":116 @@ -2642,7 +4408,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED * usernan = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_user_missing); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_user_missing); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 119, __pyx_L1_error) if (__pyx_t_1) { /* "pyreadstat/pyreadstat.pyx":120 @@ -2679,7 +4445,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED * no_datetime_conversion = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 123, __pyx_L1_error) if (__pyx_t_1) { /* "pyreadstat/pyreadstat.pyx":124 @@ -2704,19 +4470,28 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED * no_datetime_conversion = 1 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS # <<<<<<<<<<<<<< - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sas7bdat, encoding, metaonly, - * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BDAT + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, */ __pyx_v_file_format = __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS; /* "pyreadstat/pyreadstat.pyx":127 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sas7bdat, encoding, metaonly, # <<<<<<<<<<<<<< + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BDAT # <<<<<<<<<<<<<< + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, + * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + */ + __pyx_v_file_extension = __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BDAT; + + /* "pyreadstat/pyreadstat.pyx":128 + * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BDAT + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, # <<<<<<<<<<<<<< * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) */ - __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, readstat_parse_sas7bdat, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, __pyx_v_file_extension, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; @@ -2724,7 +4499,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 127, __pyx_L1_error) + __PYX_ERR(0, 128, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -2737,23 +4512,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 128, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L8_unpacking_done; @@ -2761,7 +4536,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 127, __pyx_L1_error) + __PYX_ERR(0, 128, __pyx_L1_error) __pyx_L8_unpacking_done:; } __pyx_v_data_frame = __pyx_t_3; @@ -2769,43 +4544,43 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __pyx_v_metadata = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":130 + /* "pyreadstat/pyreadstat.pyx":131 * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "sas7bdat" # <<<<<<<<<<<<<< * * if catalog_file: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_sas7bdat) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_sas7bdat) < 0) __PYX_ERR(0, 131, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":132 + /* "pyreadstat/pyreadstat.pyx":133 * metadata.file_format = "sas7bdat" * * if catalog_file: # <<<<<<<<<<<<<< * _ , catalog = read_sas7bcat(catalog_file, encoding=encoding) * data_frame, metadata = set_catalog_to_sas(data_frame, metadata, catalog, formats_as_category=formats_as_category, */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_catalog_file); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_catalog_file); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 133, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":133 + /* "pyreadstat/pyreadstat.pyx":134 * * if catalog_file: * _ , catalog = read_sas7bcat(catalog_file, encoding=encoding) # <<<<<<<<<<<<<< * data_frame, metadata = set_catalog_to_sas(data_frame, metadata, catalog, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_sas7bcat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_sas7bcat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_catalog_file); __Pyx_GIVEREF(__pyx_v_catalog_file); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_catalog_file); - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 133, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -2816,7 +4591,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 133, __pyx_L1_error) + __PYX_ERR(0, 134, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -2829,23 +4604,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; - __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 133, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 134, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L11_unpacking_done; @@ -2853,7 +4628,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 133, __pyx_L1_error) + __PYX_ERR(0, 134, __pyx_L1_error) __pyx_L11_unpacking_done:; } __pyx_v__ = __pyx_t_3; @@ -2861,16 +4636,16 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __pyx_v_catalog = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":134 + /* "pyreadstat/pyreadstat.pyx":135 * if catalog_file: * _ , catalog = read_sas7bcat(catalog_file, encoding=encoding) * data_frame, metadata = set_catalog_to_sas(data_frame, metadata, catalog, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_set_catalog_to_sas); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_set_catalog_to_sas); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -2881,27 +4656,27 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_INCREF(__pyx_v_catalog); __Pyx_GIVEREF(__pyx_v_catalog); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_catalog); - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":135 + /* "pyreadstat/pyreadstat.pyx":136 * _ , catalog = read_sas7bcat(catalog_file, encoding=encoding) * data_frame, metadata = set_catalog_to_sas(data_frame, metadata, catalog, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) # <<<<<<<<<<<<<< * * return data_frame, metadata */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":134 + /* "pyreadstat/pyreadstat.pyx":135 * if catalog_file: * _ , catalog = read_sas7bcat(catalog_file, encoding=encoding) * data_frame, metadata = set_catalog_to_sas(data_frame, metadata, catalog, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -2912,7 +4687,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 134, __pyx_L1_error) + __PYX_ERR(0, 135, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -2925,23 +4700,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 135, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L13_unpacking_done; @@ -2949,7 +4724,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 134, __pyx_L1_error) + __PYX_ERR(0, 135, __pyx_L1_error) __pyx_L13_unpacking_done:; } __Pyx_DECREF_SET(__pyx_v_data_frame, __pyx_t_3); @@ -2957,7 +4732,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED __Pyx_DECREF_SET(__pyx_v_metadata, __pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":132 + /* "pyreadstat/pyreadstat.pyx":133 * metadata.file_format = "sas7bdat" * * if catalog_file: # <<<<<<<<<<<<<< @@ -2966,7 +4741,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED */ } - /* "pyreadstat/pyreadstat.pyx":137 + /* "pyreadstat/pyreadstat.pyx":138 * formats_as_ordered_category=formats_as_ordered_category) * * return data_frame, metadata # <<<<<<<<<<<<<< @@ -2974,7 +4749,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -3012,7 +4787,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":140 +/* "pyreadstat/pyreadstat.pyx":141 * * * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, # <<<<<<<<<<<<<< @@ -3021,10 +4796,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_read_sas7bdat(CYTHON_UNUSED */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_2read_xport[] = "\n Read a SAS xport file.\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n Notice that number_rows will be None as xport files do not have the number of rows recorded in the file metadata.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this ""offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_3read_xport = {"read_xport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_3read_xport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_2read_xport}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_2read_xport, "\n Read a SAS xport file.\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n Notice that number_rows will be None as xport files do not have the number of rows recorded in the file metadata.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this ""offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_3read_xport = {"read_xport", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_3read_xport, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_2read_xport}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_filename_path = 0; PyObject *__pyx_v_metadataonly = 0; PyObject *__pyx_v_dates_as_pandas_datetime = 0; @@ -3036,6 +4823,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_ PyObject *__pyx_v_output_format = 0; PyObject *__pyx_v_extra_datetime_formats = 0; PyObject *__pyx_v_extra_date_formats = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3043,153 +4834,164 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_xport (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)Py_False); - values[2] = ((PyObject *)Py_False); - values[3] = ((PyObject*)Py_None); + values[1] = ((PyObject *)((PyObject *)Py_False)); + values[2] = ((PyObject *)((PyObject *)Py_False)); + values[3] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":141 + /* "pyreadstat/pyreadstat.pyx":142 * * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, * list usecols=None, disable_datetime_conversion=False, int row_limit=0, int row_offset=0, # <<<<<<<<<<<<<< * str output_format=None, list extra_datetime_formats=None, list extra_date_formats=None): * r""" */ - values[4] = ((PyObject*)Py_None); - values[5] = ((PyObject *)Py_False); + values[4] = ((PyObject*)((PyObject *)Py_None)); + values[5] = ((PyObject *)((PyObject *)Py_False)); - /* "pyreadstat/pyreadstat.pyx":142 + /* "pyreadstat/pyreadstat.pyx":143 * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, * list usecols=None, disable_datetime_conversion=False, int row_limit=0, int row_offset=0, * str output_format=None, list extra_datetime_formats=None, list extra_date_formats=None): # <<<<<<<<<<<<<< * r""" * Read a SAS xport file. */ - values[8] = ((PyObject*)Py_None); - values[9] = ((PyObject*)Py_None); - values[10] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[8] = ((PyObject*)((PyObject *)Py_None)); + values[9] = ((PyObject*)((PyObject *)Py_None)); + values[10] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + switch (__pyx_nargs) { + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename_path)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadataonly); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_metadataonly); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dates_as_pandas_datetime); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dates_as_pandas_datetime); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_usecols); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_usecols); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_disable_datetime_conversion); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_disable_datetime_conversion); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_limit); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_limit); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_offset); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_offset); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_format); if (value) { values[8] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_datetime_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_datetime_formats); if (value) { values[9] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_date_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_date_formats); if (value) { values[10] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_xport") < 0)) __PYX_ERR(0, 140, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read_xport") < 0)) __PYX_ERR(0, 141, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + switch (__pyx_nargs) { + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -3201,14 +5003,14 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_ __pyx_v_usecols = ((PyObject*)values[4]); __pyx_v_disable_datetime_conversion = values[5]; if (values[6]) { - __pyx_v_row_limit = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) + __pyx_v_row_limit = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L3_error) } else { - __pyx_v_row_limit = ((int)0); + __pyx_v_row_limit = ((int)((int)0)); } if (values[7]) { - __pyx_v_row_offset = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L3_error) + __pyx_v_row_offset = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L3_error) } else { - __pyx_v_row_offset = ((int)0); + __pyx_v_row_offset = ((int)((int)0)); } __pyx_v_output_format = ((PyObject*)values[8]); __pyx_v_extra_datetime_formats = ((PyObject*)values[9]); @@ -3216,20 +5018,20 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_3read_xport(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_xport", 0, 1, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 140, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_xport", 0, 1, 11, __pyx_nargs); __PYX_ERR(0, 141, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_xport", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 140, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 141, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 142, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 142, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 142, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 141, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 142, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 143, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_2read_xport(__pyx_self, __pyx_v_filename_path, __pyx_v_metadataonly, __pyx_v_dates_as_pandas_datetime, __pyx_v_encoding, __pyx_v_usecols, __pyx_v_disable_datetime_conversion, __pyx_v_row_limit, __pyx_v_row_offset, __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); - /* "pyreadstat/pyreadstat.pyx":140 + /* "pyreadstat/pyreadstat.pyx":141 * * * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, # <<<<<<<<<<<<<< @@ -3252,6 +5054,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py int __pyx_v_usernan; int __pyx_v_no_datetime_conversion; __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension; PyObject *__pyx_v_data_frame = NULL; PyObject *__pyx_v_metadata = NULL; PyObject *__pyx_r = NULL; @@ -3267,7 +5070,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_xport", 0); - /* "pyreadstat/pyreadstat.pyx":189 + /* "pyreadstat/pyreadstat.pyx":190 * """ * * cdef bint metaonly = 0 # <<<<<<<<<<<<<< @@ -3276,17 +5079,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ __pyx_v_metaonly = 0; - /* "pyreadstat/pyreadstat.pyx":190 + /* "pyreadstat/pyreadstat.pyx":191 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< * metaonly = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 191, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":191 + /* "pyreadstat/pyreadstat.pyx":192 * cdef bint metaonly = 0 * if metadataonly: * metaonly = 1 # <<<<<<<<<<<<<< @@ -3295,7 +5098,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ __pyx_v_metaonly = 1; - /* "pyreadstat/pyreadstat.pyx":190 + /* "pyreadstat/pyreadstat.pyx":191 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< @@ -3304,7 +5107,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":193 + /* "pyreadstat/pyreadstat.pyx":194 * metaonly = 1 * * cdef bint dates_as_pandas = 0 # <<<<<<<<<<<<<< @@ -3313,17 +5116,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ __pyx_v_dates_as_pandas = 0; - /* "pyreadstat/pyreadstat.pyx":194 + /* "pyreadstat/pyreadstat.pyx":195 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< * dates_as_pandas = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 195, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":195 + /* "pyreadstat/pyreadstat.pyx":196 * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: * dates_as_pandas = 1 # <<<<<<<<<<<<<< @@ -3332,7 +5135,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ __pyx_v_dates_as_pandas = 1; - /* "pyreadstat/pyreadstat.pyx":194 + /* "pyreadstat/pyreadstat.pyx":195 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< @@ -3341,7 +5144,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":197 + /* "pyreadstat/pyreadstat.pyx":198 * dates_as_pandas = 1 * * cdef bint usernan = 0 # <<<<<<<<<<<<<< @@ -3350,7 +5153,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ __pyx_v_usernan = 0; - /* "pyreadstat/pyreadstat.pyx":199 + /* "pyreadstat/pyreadstat.pyx":200 * cdef bint usernan = 0 * * cdef bint no_datetime_conversion = 0 # <<<<<<<<<<<<<< @@ -3359,17 +5162,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ __pyx_v_no_datetime_conversion = 0; - /* "pyreadstat/pyreadstat.pyx":200 + /* "pyreadstat/pyreadstat.pyx":201 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< * no_datetime_conversion = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 201, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":201 + /* "pyreadstat/pyreadstat.pyx":202 * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: * no_datetime_conversion = 1 # <<<<<<<<<<<<<< @@ -3378,7 +5181,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ __pyx_v_no_datetime_conversion = 1; - /* "pyreadstat/pyreadstat.pyx":200 + /* "pyreadstat/pyreadstat.pyx":201 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< @@ -3387,23 +5190,32 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":203 + /* "pyreadstat/pyreadstat.pyx":204 * no_datetime_conversion = 1 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS # <<<<<<<<<<<<<< - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_xport, encoding, metaonly, - * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_XPORT + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, */ __pyx_v_file_format = __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS; - /* "pyreadstat/pyreadstat.pyx":204 + /* "pyreadstat/pyreadstat.pyx":205 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_xport, encoding, metaonly, # <<<<<<<<<<<<<< + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_XPORT # <<<<<<<<<<<<<< + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, + * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + */ + __pyx_v_file_extension = __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_XPORT; + + /* "pyreadstat/pyreadstat.pyx":206 + * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_XPORT + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, # <<<<<<<<<<<<<< * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) */ - __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, readstat_parse_xport, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, __pyx_v_file_extension, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; @@ -3411,7 +5223,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 204, __pyx_L1_error) + __PYX_ERR(0, 206, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -3424,23 +5236,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 204, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 206, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L7_unpacking_done; @@ -3448,7 +5260,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 204, __pyx_L1_error) + __PYX_ERR(0, 206, __pyx_L1_error) __pyx_L7_unpacking_done:; } __pyx_v_data_frame = __pyx_t_3; @@ -3456,16 +5268,16 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py __pyx_v_metadata = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":207 + /* "pyreadstat/pyreadstat.pyx":209 * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "xport" # <<<<<<<<<<<<<< * * return data_frame, metadata */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_xport) < 0) __PYX_ERR(0, 207, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_xport) < 0) __PYX_ERR(0, 209, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":209 + /* "pyreadstat/pyreadstat.pyx":211 * metadata.file_format = "xport" * * return data_frame, metadata # <<<<<<<<<<<<<< @@ -3473,7 +5285,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -3485,7 +5297,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py __pyx_t_2 = 0; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":140 + /* "pyreadstat/pyreadstat.pyx":141 * * * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, # <<<<<<<<<<<<<< @@ -3509,7 +5321,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":212 +/* "pyreadstat/pyreadstat.pyx":214 * * * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -3518,10 +5330,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_2read_xport(CYTHON_UNUSED Py */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_4read_dta[] = "\n Read a STATA dta file\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In Python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n apply_value_formats : bool, optional\n by default False. If true it will change values in the dataframe for they value labels in the metadata,\n if any appropiate are found.\n formats_as_category : bool, optional\n by default True. Takes effect only if apply_value_formats is True. If True, variables with values changed\n for their formatted version will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n user_missing : bool, optional\n by default False, in this case user defined missing values are delivered as nan. If true, the missing values\n will be deliver as is, and an extra piece of information will be set in the ""metadata (missing_user_values)\n to be able to interpret those values as missing.\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_5read_dta = {"read_dta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_5read_dta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_4read_dta}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_4read_dta, "\n Read a STATA dta file\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In Python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n apply_value_formats : bool, optional\n by default False. If true it will change values in the dataframe for they value labels in the metadata,\n if any appropiate are found.\n formats_as_category : bool, optional\n by default True. Takes effect only if apply_value_formats is True. If True, variables with values changed\n for their formatted version will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n user_missing : bool, optional\n by default False, in this case user defined missing values are delivered as nan. If true, the missing values\n will be deliver as is, and an extra piece of information will be set in the ""metadata (missing_user_values)\n to be able to interpret those values as missing.\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_5read_dta = {"read_dta", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_5read_dta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_4read_dta}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_filename_path = 0; PyObject *__pyx_v_metadataonly = 0; PyObject *__pyx_v_dates_as_pandas_datetime = 0; @@ -3537,6 +5361,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_se PyObject *__pyx_v_output_format = 0; PyObject *__pyx_v_extra_datetime_formats = 0; PyObject *__pyx_v_extra_date_formats = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3544,205 +5372,220 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_se __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_dta (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_apply_value_formats,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_user_missing,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_apply_value_formats,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_user_missing,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)Py_False); - values[2] = ((PyObject *)Py_False); - values[3] = ((PyObject *)Py_False); + values[1] = ((PyObject *)((PyObject *)Py_False)); + values[2] = ((PyObject *)((PyObject *)Py_False)); + values[3] = ((PyObject *)((PyObject *)Py_False)); - /* "pyreadstat/pyreadstat.pyx":213 + /* "pyreadstat/pyreadstat.pyx":215 * * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, # <<<<<<<<<<<<<< * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, * list extra_datetime_formats=None, list extra_date_formats=None): */ - values[4] = ((PyObject *)Py_True); - values[5] = ((PyObject *)Py_False); - values[6] = ((PyObject*)Py_None); - values[7] = ((PyObject*)Py_None); - values[8] = ((PyObject *)Py_False); + values[4] = ((PyObject *)((PyObject *)Py_True)); + values[5] = ((PyObject *)((PyObject *)Py_False)); + values[6] = ((PyObject*)((PyObject *)Py_None)); + values[7] = ((PyObject*)((PyObject *)Py_None)); + values[8] = ((PyObject *)((PyObject *)Py_False)); - /* "pyreadstat/pyreadstat.pyx":214 + /* "pyreadstat/pyreadstat.pyx":216 * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, # <<<<<<<<<<<<<< * list extra_datetime_formats=None, list extra_date_formats=None): * r""" */ - values[9] = ((PyObject *)Py_False); - values[12] = ((PyObject*)Py_None); + values[9] = ((PyObject *)((PyObject *)Py_False)); + values[12] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":215 + /* "pyreadstat/pyreadstat.pyx":217 * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, * list extra_datetime_formats=None, list extra_date_formats=None): # <<<<<<<<<<<<<< * r""" * Read a STATA dta file */ - values[13] = ((PyObject*)Py_None); - values[14] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[13] = ((PyObject*)((PyObject *)Py_None)); + values[14] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + switch (__pyx_nargs) { + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename_path)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadataonly); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_metadataonly); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dates_as_pandas_datetime); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dates_as_pandas_datetime); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apply_value_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apply_value_formats); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_category); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_ordered_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_ordered_category); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_usecols); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_usecols); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_missing); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_user_missing); if (value) { values[8] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_disable_datetime_conversion); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_disable_datetime_conversion); if (value) { values[9] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_limit); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_limit); if (value) { values[10] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_offset); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_offset); if (value) { values[11] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_format); if (value) { values[12] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_datetime_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_datetime_formats); if (value) { values[13] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_date_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_date_formats); if (value) { values[14] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_dta") < 0)) __PYX_ERR(0, 212, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read_dta") < 0)) __PYX_ERR(0, 214, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + switch (__pyx_nargs) { + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -3758,14 +5601,14 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_se __pyx_v_user_missing = values[8]; __pyx_v_disable_datetime_conversion = values[9]; if (values[10]) { - __pyx_v_row_limit = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) + __pyx_v_row_limit = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) } else { - __pyx_v_row_limit = ((int)0); + __pyx_v_row_limit = ((int)((int)0)); } if (values[11]) { - __pyx_v_row_offset = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) + __pyx_v_row_offset = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L3_error) } else { - __pyx_v_row_offset = ((int)0); + __pyx_v_row_offset = ((int)((int)0)); } __pyx_v_output_format = ((PyObject*)values[12]); __pyx_v_extra_datetime_formats = ((PyObject*)values[13]); @@ -3773,20 +5616,20 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_5read_dta(PyObject *__pyx_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_dta", 0, 1, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 212, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_dta", 0, 1, 15, __pyx_nargs); __PYX_ERR(0, 214, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_dta", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 213, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 213, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 214, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 215, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 215, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 215, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 215, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 216, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 217, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 217, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_4read_dta(__pyx_self, __pyx_v_filename_path, __pyx_v_metadataonly, __pyx_v_dates_as_pandas_datetime, __pyx_v_apply_value_formats, __pyx_v_formats_as_category, __pyx_v_formats_as_ordered_category, __pyx_v_encoding, __pyx_v_usecols, __pyx_v_user_missing, __pyx_v_disable_datetime_conversion, __pyx_v_row_limit, __pyx_v_row_offset, __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); - /* "pyreadstat/pyreadstat.pyx":212 + /* "pyreadstat/pyreadstat.pyx":214 * * * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -3809,6 +5652,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb int __pyx_v_usernan; int __pyx_v_no_datetime_conversion; __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension; PyObject *__pyx_v_data_frame = NULL; PyObject *__pyx_v_metadata = NULL; PyObject *__pyx_r = NULL; @@ -3824,7 +5668,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_dta", 0); - /* "pyreadstat/pyreadstat.pyx":275 + /* "pyreadstat/pyreadstat.pyx":277 * """ * * cdef bint metaonly = 0 # <<<<<<<<<<<<<< @@ -3833,17 +5677,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_metaonly = 0; - /* "pyreadstat/pyreadstat.pyx":276 + /* "pyreadstat/pyreadstat.pyx":278 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< * metaonly = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 276, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 278, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":277 + /* "pyreadstat/pyreadstat.pyx":279 * cdef bint metaonly = 0 * if metadataonly: * metaonly = 1 # <<<<<<<<<<<<<< @@ -3852,7 +5696,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_metaonly = 1; - /* "pyreadstat/pyreadstat.pyx":276 + /* "pyreadstat/pyreadstat.pyx":278 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< @@ -3861,7 +5705,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":279 + /* "pyreadstat/pyreadstat.pyx":281 * metaonly = 1 * * cdef bint dates_as_pandas = 0 # <<<<<<<<<<<<<< @@ -3870,17 +5714,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_dates_as_pandas = 0; - /* "pyreadstat/pyreadstat.pyx":280 + /* "pyreadstat/pyreadstat.pyx":282 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< * dates_as_pandas = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 282, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":281 + /* "pyreadstat/pyreadstat.pyx":283 * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: * dates_as_pandas = 1 # <<<<<<<<<<<<<< @@ -3889,7 +5733,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_dates_as_pandas = 1; - /* "pyreadstat/pyreadstat.pyx":280 + /* "pyreadstat/pyreadstat.pyx":282 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< @@ -3898,7 +5742,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":283 + /* "pyreadstat/pyreadstat.pyx":285 * dates_as_pandas = 1 * * cdef bint usernan = 0 # <<<<<<<<<<<<<< @@ -3907,17 +5751,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_usernan = 0; - /* "pyreadstat/pyreadstat.pyx":284 + /* "pyreadstat/pyreadstat.pyx":286 * * cdef bint usernan = 0 * if user_missing: # <<<<<<<<<<<<<< * usernan = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_user_missing); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 284, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_user_missing); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 286, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":285 + /* "pyreadstat/pyreadstat.pyx":287 * cdef bint usernan = 0 * if user_missing: * usernan = 1 # <<<<<<<<<<<<<< @@ -3926,7 +5770,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_usernan = 1; - /* "pyreadstat/pyreadstat.pyx":284 + /* "pyreadstat/pyreadstat.pyx":286 * * cdef bint usernan = 0 * if user_missing: # <<<<<<<<<<<<<< @@ -3935,7 +5779,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":287 + /* "pyreadstat/pyreadstat.pyx":289 * usernan = 1 * * cdef bint no_datetime_conversion = 0 # <<<<<<<<<<<<<< @@ -3944,17 +5788,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_no_datetime_conversion = 0; - /* "pyreadstat/pyreadstat.pyx":288 + /* "pyreadstat/pyreadstat.pyx":290 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< * no_datetime_conversion = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 290, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":289 + /* "pyreadstat/pyreadstat.pyx":291 * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: * no_datetime_conversion = 1 # <<<<<<<<<<<<<< @@ -3963,7 +5807,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ __pyx_v_no_datetime_conversion = 1; - /* "pyreadstat/pyreadstat.pyx":288 + /* "pyreadstat/pyreadstat.pyx":290 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< @@ -3972,23 +5816,32 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":291 + /* "pyreadstat/pyreadstat.pyx":293 * no_datetime_conversion = 1 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_STATA # <<<<<<<<<<<<<< - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_dta, encoding, metaonly, - * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_DTA + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, */ __pyx_v_file_format = __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_STATA; - /* "pyreadstat/pyreadstat.pyx":292 + /* "pyreadstat/pyreadstat.pyx":294 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_STATA - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_dta, encoding, metaonly, # <<<<<<<<<<<<<< + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_DTA # <<<<<<<<<<<<<< + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, + * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + */ + __pyx_v_file_extension = __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_DTA; + + /* "pyreadstat/pyreadstat.pyx":295 + * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_STATA + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_DTA + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, # <<<<<<<<<<<<<< * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) */ - __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, readstat_parse_dta, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, __pyx_v_file_extension, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; @@ -3996,7 +5849,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 292, __pyx_L1_error) + __PYX_ERR(0, 295, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4009,23 +5862,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 292, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 295, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L8_unpacking_done; @@ -4033,7 +5886,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 292, __pyx_L1_error) + __PYX_ERR(0, 295, __pyx_L1_error) __pyx_L8_unpacking_done:; } __pyx_v_data_frame = __pyx_t_3; @@ -4041,35 +5894,35 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb __pyx_v_metadata = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":295 + /* "pyreadstat/pyreadstat.pyx":298 * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "dta" # <<<<<<<<<<<<<< * * if apply_value_formats: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_dta) < 0) __PYX_ERR(0, 295, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_dta) < 0) __PYX_ERR(0, 298, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":297 + /* "pyreadstat/pyreadstat.pyx":300 * metadata.file_format = "dta" * * if apply_value_formats: # <<<<<<<<<<<<<< * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_apply_value_formats); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 297, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_apply_value_formats); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 300, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":298 + /* "pyreadstat/pyreadstat.pyx":301 * * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -4077,27 +5930,27 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_v_metadata); __Pyx_GIVEREF(__pyx_v_metadata); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_metadata); - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 298, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 301, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":299 + /* "pyreadstat/pyreadstat.pyx":302 * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) # <<<<<<<<<<<<<< * * return data_frame, metadata */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 298, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 301, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":298 + /* "pyreadstat/pyreadstat.pyx":301 * * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 298, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -4105,7 +5958,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb __Pyx_DECREF_SET(__pyx_v_data_frame, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/pyreadstat.pyx":297 + /* "pyreadstat/pyreadstat.pyx":300 * metadata.file_format = "dta" * * if apply_value_formats: # <<<<<<<<<<<<<< @@ -4114,7 +5967,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":301 + /* "pyreadstat/pyreadstat.pyx":304 * formats_as_ordered_category=formats_as_ordered_category) * * return data_frame, metadata # <<<<<<<<<<<<<< @@ -4122,7 +5975,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 301, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -4134,7 +5987,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb __pyx_t_5 = 0; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":212 + /* "pyreadstat/pyreadstat.pyx":214 * * * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -4158,7 +6011,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":304 +/* "pyreadstat/pyreadstat.pyx":307 * * * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -4167,10 +6020,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_4read_dta(CYTHON_UNUSED PyOb */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_6read_sav[] = "\n Read a SPSS sav or zsav (compressed) files\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In Python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n apply_value_formats : bool, optional\n by default False. If true it will change values in the dataframe for they value labels in the metadata,\n if any appropiate are found.\n formats_as_category : bool, optional\n by default True. Takes effect only if apply_value_formats is True. If True, variables with values changed\n for their formatted version will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n user_missing : bool, optional\n by default False, in this case user defined missing values are delivered as nan. If true, the missing values\n will be deliver as is, and an extra piece of informatio""n will be set in the metadata (missing_ranges)\n to be able to interpret those values as missing.\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_7read_sav = {"read_sav", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_7read_sav, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_6read_sav}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_6read_sav, "\n Read a SPSS sav or zsav (compressed) files\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In Python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n apply_value_formats : bool, optional\n by default False. If true it will change values in the dataframe for they value labels in the metadata,\n if any appropiate are found.\n formats_as_category : bool, optional\n by default True. Takes effect only if apply_value_formats is True. If True, variables with values changed\n for their formatted version will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n user_missing : bool, optional\n by default False, in this case user defined missing values are delivered as nan. If true, the missing values\n will be deliver as is, and an extra piece of informatio""n will be set in the metadata (missing_ranges)\n to be able to interpret those values as missing.\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datetimes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_7read_sav = {"read_sav", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_7read_sav, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_6read_sav}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_filename_path = 0; PyObject *__pyx_v_metadataonly = 0; PyObject *__pyx_v_dates_as_pandas_datetime = 0; @@ -4186,6 +6051,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_se PyObject *__pyx_v_output_format = 0; PyObject *__pyx_v_extra_datetime_formats = 0; PyObject *__pyx_v_extra_date_formats = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4193,205 +6062,220 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_se __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_sav (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_apply_value_formats,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_user_missing,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_apply_value_formats,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_user_missing,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; PyObject* values[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)Py_False); - values[2] = ((PyObject *)Py_False); - values[3] = ((PyObject *)Py_False); + values[1] = ((PyObject *)((PyObject *)Py_False)); + values[2] = ((PyObject *)((PyObject *)Py_False)); + values[3] = ((PyObject *)((PyObject *)Py_False)); - /* "pyreadstat/pyreadstat.pyx":305 + /* "pyreadstat/pyreadstat.pyx":308 * * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, # <<<<<<<<<<<<<< * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, list extra_datetime_formats=None, * list extra_date_formats=None): */ - values[4] = ((PyObject *)Py_True); - values[5] = ((PyObject *)Py_False); - values[6] = ((PyObject*)Py_None); - values[7] = ((PyObject*)Py_None); - values[8] = ((PyObject *)Py_False); + values[4] = ((PyObject *)((PyObject *)Py_True)); + values[5] = ((PyObject *)((PyObject *)Py_False)); + values[6] = ((PyObject*)((PyObject *)Py_None)); + values[7] = ((PyObject*)((PyObject *)Py_None)); + values[8] = ((PyObject *)((PyObject *)Py_False)); - /* "pyreadstat/pyreadstat.pyx":306 + /* "pyreadstat/pyreadstat.pyx":309 * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, list extra_datetime_formats=None, # <<<<<<<<<<<<<< * list extra_date_formats=None): * r""" */ - values[9] = ((PyObject *)Py_False); - values[12] = ((PyObject*)Py_None); - values[13] = ((PyObject*)Py_None); + values[9] = ((PyObject *)((PyObject *)Py_False)); + values[12] = ((PyObject*)((PyObject *)Py_None)); + values[13] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":307 + /* "pyreadstat/pyreadstat.pyx":310 * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, list extra_datetime_formats=None, * list extra_date_formats=None): # <<<<<<<<<<<<<< * r""" * Read a SPSS sav or zsav (compressed) files */ - values[14] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[14] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + switch (__pyx_nargs) { + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename_path)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadataonly); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_metadataonly); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dates_as_pandas_datetime); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dates_as_pandas_datetime); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apply_value_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apply_value_formats); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_category); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_ordered_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_ordered_category); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_usecols); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_usecols); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_missing); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_user_missing); if (value) { values[8] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_disable_datetime_conversion); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_disable_datetime_conversion); if (value) { values[9] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_limit); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_limit); if (value) { values[10] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_offset); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_offset); if (value) { values[11] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_format); if (value) { values[12] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_datetime_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_datetime_formats); if (value) { values[13] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_date_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_date_formats); if (value) { values[14] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_sav") < 0)) __PYX_ERR(0, 304, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read_sav") < 0)) __PYX_ERR(0, 307, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); + switch (__pyx_nargs) { + case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -4407,14 +6291,14 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_se __pyx_v_user_missing = values[8]; __pyx_v_disable_datetime_conversion = values[9]; if (values[10]) { - __pyx_v_row_limit = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L3_error) + __pyx_v_row_limit = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) } else { - __pyx_v_row_limit = ((int)0); + __pyx_v_row_limit = ((int)((int)0)); } if (values[11]) { - __pyx_v_row_offset = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L3_error) + __pyx_v_row_offset = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error) } else { - __pyx_v_row_offset = ((int)0); + __pyx_v_row_offset = ((int)((int)0)); } __pyx_v_output_format = ((PyObject*)values[12]); __pyx_v_extra_datetime_formats = ((PyObject*)values[13]); @@ -4422,20 +6306,20 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_7read_sav(PyObject *__pyx_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_sav", 0, 1, 15, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 304, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_sav", 0, 1, 15, __pyx_nargs); __PYX_ERR(0, 307, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_sav", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 305, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 305, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 306, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 306, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 307, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 308, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 308, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 309, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 309, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 310, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_6read_sav(__pyx_self, __pyx_v_filename_path, __pyx_v_metadataonly, __pyx_v_dates_as_pandas_datetime, __pyx_v_apply_value_formats, __pyx_v_formats_as_category, __pyx_v_formats_as_ordered_category, __pyx_v_encoding, __pyx_v_usecols, __pyx_v_user_missing, __pyx_v_disable_datetime_conversion, __pyx_v_row_limit, __pyx_v_row_offset, __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); - /* "pyreadstat/pyreadstat.pyx":304 + /* "pyreadstat/pyreadstat.pyx":307 * * * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -4458,6 +6342,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb int __pyx_v_usernan; int __pyx_v_no_datetime_conversion; __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension; PyObject *__pyx_v_data_frame = NULL; PyObject *__pyx_v_metadata = NULL; PyObject *__pyx_r = NULL; @@ -4473,7 +6358,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_sav", 0); - /* "pyreadstat/pyreadstat.pyx":367 + /* "pyreadstat/pyreadstat.pyx":370 * """ * * cdef bint metaonly = 0 # <<<<<<<<<<<<<< @@ -4482,17 +6367,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_metaonly = 0; - /* "pyreadstat/pyreadstat.pyx":368 + /* "pyreadstat/pyreadstat.pyx":371 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< * metaonly = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 368, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 371, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":369 + /* "pyreadstat/pyreadstat.pyx":372 * cdef bint metaonly = 0 * if metadataonly: * metaonly = 1 # <<<<<<<<<<<<<< @@ -4501,7 +6386,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_metaonly = 1; - /* "pyreadstat/pyreadstat.pyx":368 + /* "pyreadstat/pyreadstat.pyx":371 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< @@ -4510,7 +6395,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":371 + /* "pyreadstat/pyreadstat.pyx":374 * metaonly = 1 * * cdef bint dates_as_pandas = 0 # <<<<<<<<<<<<<< @@ -4519,17 +6404,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_dates_as_pandas = 0; - /* "pyreadstat/pyreadstat.pyx":372 + /* "pyreadstat/pyreadstat.pyx":375 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< * dates_as_pandas = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 375, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":373 + /* "pyreadstat/pyreadstat.pyx":376 * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: * dates_as_pandas = 1 # <<<<<<<<<<<<<< @@ -4538,7 +6423,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_dates_as_pandas = 1; - /* "pyreadstat/pyreadstat.pyx":372 + /* "pyreadstat/pyreadstat.pyx":375 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< @@ -4547,7 +6432,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":375 + /* "pyreadstat/pyreadstat.pyx":378 * dates_as_pandas = 1 * * cdef bint usernan = 0 # <<<<<<<<<<<<<< @@ -4556,17 +6441,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_usernan = 0; - /* "pyreadstat/pyreadstat.pyx":376 + /* "pyreadstat/pyreadstat.pyx":379 * * cdef bint usernan = 0 * if user_missing: # <<<<<<<<<<<<<< * usernan = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_user_missing); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 376, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_user_missing); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 379, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":377 + /* "pyreadstat/pyreadstat.pyx":380 * cdef bint usernan = 0 * if user_missing: * usernan = 1 # <<<<<<<<<<<<<< @@ -4575,7 +6460,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_usernan = 1; - /* "pyreadstat/pyreadstat.pyx":376 + /* "pyreadstat/pyreadstat.pyx":379 * * cdef bint usernan = 0 * if user_missing: # <<<<<<<<<<<<<< @@ -4584,7 +6469,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":379 + /* "pyreadstat/pyreadstat.pyx":382 * usernan = 1 * * cdef bint no_datetime_conversion = 0 # <<<<<<<<<<<<<< @@ -4593,17 +6478,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_no_datetime_conversion = 0; - /* "pyreadstat/pyreadstat.pyx":380 + /* "pyreadstat/pyreadstat.pyx":383 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< * no_datetime_conversion = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 383, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":381 + /* "pyreadstat/pyreadstat.pyx":384 * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: * no_datetime_conversion = 1 # <<<<<<<<<<<<<< @@ -4612,7 +6497,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ __pyx_v_no_datetime_conversion = 1; - /* "pyreadstat/pyreadstat.pyx":380 + /* "pyreadstat/pyreadstat.pyx":383 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< @@ -4621,23 +6506,32 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":383 + /* "pyreadstat/pyreadstat.pyx":386 * no_datetime_conversion = 1 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS # <<<<<<<<<<<<<< - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sav, encoding, metaonly, - * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAV + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, */ __pyx_v_file_format = __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS; - /* "pyreadstat/pyreadstat.pyx":384 + /* "pyreadstat/pyreadstat.pyx":387 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sav, encoding, metaonly, # <<<<<<<<<<<<<< + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAV # <<<<<<<<<<<<<< + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, + * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + */ + __pyx_v_file_extension = __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAV; + + /* "pyreadstat/pyreadstat.pyx":388 + * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAV + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, # <<<<<<<<<<<<<< * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) */ - __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, readstat_parse_sav, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, __pyx_v_file_extension, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; @@ -4645,7 +6539,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 384, __pyx_L1_error) + __PYX_ERR(0, 388, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4658,23 +6552,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error) + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 388, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 384, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 388, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L8_unpacking_done; @@ -4682,7 +6576,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 384, __pyx_L1_error) + __PYX_ERR(0, 388, __pyx_L1_error) __pyx_L8_unpacking_done:; } __pyx_v_data_frame = __pyx_t_3; @@ -4690,35 +6584,35 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb __pyx_v_metadata = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":387 + /* "pyreadstat/pyreadstat.pyx":391 * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "sav/zsav" # <<<<<<<<<<<<<< * * if apply_value_formats: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_kp_s_sav_zsav) < 0) __PYX_ERR(0, 387, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_kp_s_sav_zsav) < 0) __PYX_ERR(0, 391, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":389 + /* "pyreadstat/pyreadstat.pyx":393 * metadata.file_format = "sav/zsav" * * if apply_value_formats: # <<<<<<<<<<<<<< * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_apply_value_formats); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 389, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_apply_value_formats); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 393, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":390 + /* "pyreadstat/pyreadstat.pyx":394 * * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -4726,27 +6620,27 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_v_metadata); __Pyx_GIVEREF(__pyx_v_metadata); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_metadata); - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 390, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 394, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":391 + /* "pyreadstat/pyreadstat.pyx":395 * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) # <<<<<<<<<<<<<< * * return data_frame, metadata */ - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 390, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 394, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":390 + /* "pyreadstat/pyreadstat.pyx":394 * * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -4754,7 +6648,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb __Pyx_DECREF_SET(__pyx_v_data_frame, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/pyreadstat.pyx":389 + /* "pyreadstat/pyreadstat.pyx":393 * metadata.file_format = "sav/zsav" * * if apply_value_formats: # <<<<<<<<<<<<<< @@ -4763,7 +6657,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":393 + /* "pyreadstat/pyreadstat.pyx":397 * formats_as_ordered_category=formats_as_ordered_category) * * return data_frame, metadata # <<<<<<<<<<<<<< @@ -4771,7 +6665,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -4783,7 +6677,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb __pyx_t_5 = 0; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":304 + /* "pyreadstat/pyreadstat.pyx":307 * * * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -4807,7 +6701,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":396 +/* "pyreadstat/pyreadstat.pyx":400 * * * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -4816,10 +6710,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_6read_sav(CYTHON_UNUSED PyOb */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_8read_por[] = "\n Read a SPSS por file\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In Python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n Notice that number_rows will be None as por files do not have the number of rows recorded in the file metadata.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n apply_value_formats : bool, optional\n by default False. If true it will change values in the dataframe for they value labels in the metadata,\n if any appropiate are found.\n formats_as_category : bool, optional\n by default True. Takes effect only if apply_value_formats is True. If True, variables with values changed\n for their formatted version will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datet""imes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_9read_por = {"read_por", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_9read_por, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_8read_por}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_8read_por, "\n Read a SPSS por file\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. In Python 2.7 the string is assumed to be utf-8 encoded\n metadataonly : bool, optional\n by default False. IF true, no data will be read but only metadata, so that you can get all elements in the\n metadata object. The data frame will be set with the correct column names but no data.\n Notice that number_rows will be None as por files do not have the number of rows recorded in the file metadata.\n dates_as_pandas_datetime : bool, optional\n by default False. If true dates will be transformed to pandas datetime64 instead of date.\n apply_value_formats : bool, optional\n by default False. If true it will change values in the dataframe for they value labels in the metadata,\n if any appropiate are found.\n formats_as_category : bool, optional\n by default True. Takes effect only if apply_value_formats is True. If True, variables with values changed\n for their formatted version will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n usecols : list, optional\n a list with column names to read from the file. Only those columns will be imported. Case sensitive!\n disable_datetime_conversion : bool, optional\n if True pyreadstat will not attempt to convert dates, datet""imes and times to python objects but those columns\n will remain as numbers. In order to convert them later to an appropiate python object, the user can use the\n information about the original variable format stored in the metadata object in original_variable_types.\n Disabling datetime conversion speeds up reading files. In addition it helps to overcome situations where\n there are datetimes that are beyond the limits of python datetime (which is limited to year 10,000, dates\n beyond that will rise an Overflow error in pyreadstat).\n row_limit : int, optional\n maximum number of rows to read. The default is 0 meaning unlimited.\n row_offset : int, optional\n start reading rows after this offset. By default 0, meaning start with the first row not skipping anything.\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned, the\n user can then convert it to her preferred data format. Using dict is faster as the other types as the conversion to a pandas\n dataframe is avoided.\n extra_datetime_formats: list of str, optional\n formats to be parsed as python datetime objects\n extra_date_formats: list of str, optional\n formats to be parsed as python date objects\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data. If the output_format is other than 'pandas' the object type will change accordingly.\n metadata :\n object with metadata. Look at the documentation for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_9read_por = {"read_por", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_9read_por, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_8read_por}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_filename_path = 0; PyObject *__pyx_v_metadataonly = 0; PyObject *__pyx_v_dates_as_pandas_datetime = 0; @@ -4834,6 +6740,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_se PyObject *__pyx_v_output_format = 0; PyObject *__pyx_v_extra_datetime_formats = 0; PyObject *__pyx_v_extra_date_formats = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4841,194 +6751,208 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_se __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_por (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_apply_value_formats,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_metadataonly,&__pyx_n_s_dates_as_pandas_datetime,&__pyx_n_s_apply_value_formats,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,&__pyx_n_s_encoding,&__pyx_n_s_usecols,&__pyx_n_s_disable_datetime_conversion,&__pyx_n_s_row_limit,&__pyx_n_s_row_offset,&__pyx_n_s_output_format,&__pyx_n_s_extra_datetime_formats,&__pyx_n_s_extra_date_formats,0}; PyObject* values[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - values[1] = ((PyObject *)Py_False); - values[2] = ((PyObject *)Py_False); - values[3] = ((PyObject *)Py_False); + values[1] = ((PyObject *)((PyObject *)Py_False)); + values[2] = ((PyObject *)((PyObject *)Py_False)); + values[3] = ((PyObject *)((PyObject *)Py_False)); - /* "pyreadstat/pyreadstat.pyx":397 + /* "pyreadstat/pyreadstat.pyx":401 * * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, # <<<<<<<<<<<<<< * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, * list extra_datetime_formats=None, list extra_date_formats=None): */ - values[4] = ((PyObject *)Py_True); - values[5] = ((PyObject *)Py_False); - values[6] = ((PyObject*)Py_None); - values[7] = ((PyObject*)Py_None); + values[4] = ((PyObject *)((PyObject *)Py_True)); + values[5] = ((PyObject *)((PyObject *)Py_False)); + values[6] = ((PyObject*)((PyObject *)Py_None)); + values[7] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":398 + /* "pyreadstat/pyreadstat.pyx":402 * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, # <<<<<<<<<<<<<< * list extra_datetime_formats=None, list extra_date_formats=None): * r""" */ - values[8] = ((PyObject *)Py_False); - values[11] = ((PyObject*)Py_None); + values[8] = ((PyObject *)((PyObject *)Py_False)); + values[11] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":399 + /* "pyreadstat/pyreadstat.pyx":403 * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, * list extra_datetime_formats=None, list extra_date_formats=None): # <<<<<<<<<<<<<< * r""" * Read a SPSS por file */ - values[12] = ((PyObject*)Py_None); - values[13] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[12] = ((PyObject*)((PyObject *)Py_None)); + values[13] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + switch (__pyx_nargs) { + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename_path)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadataonly); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_metadataonly); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dates_as_pandas_datetime); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dates_as_pandas_datetime); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apply_value_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_apply_value_formats); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_category); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_ordered_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_ordered_category); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_usecols); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_usecols); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_disable_datetime_conversion); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_disable_datetime_conversion); if (value) { values[8] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_limit); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_limit); if (value) { values[9] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_offset); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_offset); if (value) { values[10] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_format); if (value) { values[11] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_datetime_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_datetime_formats); if (value) { values[12] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_extra_date_formats); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_extra_date_formats); if (value) { values[13] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_por") < 0)) __PYX_ERR(0, 396, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read_por") < 0)) __PYX_ERR(0, 400, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); + switch (__pyx_nargs) { + case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -5043,14 +6967,14 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_se __pyx_v_usecols = ((PyObject*)values[7]); __pyx_v_disable_datetime_conversion = values[8]; if (values[9]) { - __pyx_v_row_limit = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 398, __pyx_L3_error) + __pyx_v_row_limit = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_row_limit == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 402, __pyx_L3_error) } else { - __pyx_v_row_limit = ((int)0); + __pyx_v_row_limit = ((int)((int)0)); } if (values[10]) { - __pyx_v_row_offset = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 398, __pyx_L3_error) + __pyx_v_row_offset = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_row_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 402, __pyx_L3_error) } else { - __pyx_v_row_offset = ((int)0); + __pyx_v_row_offset = ((int)((int)0)); } __pyx_v_output_format = ((PyObject*)values[11]); __pyx_v_extra_datetime_formats = ((PyObject*)values[12]); @@ -5058,20 +6982,20 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_9read_por(PyObject *__pyx_se } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_por", 0, 1, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 396, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_por", 0, 1, 14, __pyx_nargs); __PYX_ERR(0, 400, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_por", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 397, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 397, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 398, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 399, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 399, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 401, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_usecols), (&PyList_Type), 1, "usecols", 1))) __PYX_ERR(0, 401, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 402, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_datetime_formats), (&PyList_Type), 1, "extra_datetime_formats", 1))) __PYX_ERR(0, 403, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_extra_date_formats), (&PyList_Type), 1, "extra_date_formats", 1))) __PYX_ERR(0, 403, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_8read_por(__pyx_self, __pyx_v_filename_path, __pyx_v_metadataonly, __pyx_v_dates_as_pandas_datetime, __pyx_v_apply_value_formats, __pyx_v_formats_as_category, __pyx_v_formats_as_ordered_category, __pyx_v_encoding, __pyx_v_usecols, __pyx_v_disable_datetime_conversion, __pyx_v_row_limit, __pyx_v_row_offset, __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); - /* "pyreadstat/pyreadstat.pyx":396 + /* "pyreadstat/pyreadstat.pyx":400 * * * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -5094,6 +7018,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb int __pyx_v_usernan; int __pyx_v_no_datetime_conversion; __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension; PyObject *__pyx_v_data_frame = NULL; PyObject *__pyx_v_metadata = NULL; PyObject *__pyx_r = NULL; @@ -5109,7 +7034,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_por", 0); - /* "pyreadstat/pyreadstat.pyx":456 + /* "pyreadstat/pyreadstat.pyx":460 * """ * * cdef bint metaonly = 0 # <<<<<<<<<<<<<< @@ -5118,17 +7043,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ __pyx_v_metaonly = 0; - /* "pyreadstat/pyreadstat.pyx":457 + /* "pyreadstat/pyreadstat.pyx":461 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< * metaonly = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_metadataonly); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 461, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":458 + /* "pyreadstat/pyreadstat.pyx":462 * cdef bint metaonly = 0 * if metadataonly: * metaonly = 1 # <<<<<<<<<<<<<< @@ -5137,7 +7062,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ __pyx_v_metaonly = 1; - /* "pyreadstat/pyreadstat.pyx":457 + /* "pyreadstat/pyreadstat.pyx":461 * * cdef bint metaonly = 0 * if metadataonly: # <<<<<<<<<<<<<< @@ -5146,7 +7071,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":460 + /* "pyreadstat/pyreadstat.pyx":464 * metaonly = 1 * * cdef bint dates_as_pandas = 0 # <<<<<<<<<<<<<< @@ -5155,17 +7080,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ __pyx_v_dates_as_pandas = 0; - /* "pyreadstat/pyreadstat.pyx":461 + /* "pyreadstat/pyreadstat.pyx":465 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< * dates_as_pandas = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_dates_as_pandas_datetime); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 465, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":462 + /* "pyreadstat/pyreadstat.pyx":466 * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: * dates_as_pandas = 1 # <<<<<<<<<<<<<< @@ -5174,7 +7099,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ __pyx_v_dates_as_pandas = 1; - /* "pyreadstat/pyreadstat.pyx":461 + /* "pyreadstat/pyreadstat.pyx":465 * * cdef bint dates_as_pandas = 0 * if dates_as_pandas_datetime: # <<<<<<<<<<<<<< @@ -5183,7 +7108,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":464 + /* "pyreadstat/pyreadstat.pyx":468 * dates_as_pandas = 1 * * cdef bint usernan = 0 # <<<<<<<<<<<<<< @@ -5192,7 +7117,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ __pyx_v_usernan = 0; - /* "pyreadstat/pyreadstat.pyx":466 + /* "pyreadstat/pyreadstat.pyx":470 * cdef bint usernan = 0 * * cdef bint no_datetime_conversion = 0 # <<<<<<<<<<<<<< @@ -5201,17 +7126,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ __pyx_v_no_datetime_conversion = 0; - /* "pyreadstat/pyreadstat.pyx":467 + /* "pyreadstat/pyreadstat.pyx":471 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< * no_datetime_conversion = 1 * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 467, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_disable_datetime_conversion); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 471, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":468 + /* "pyreadstat/pyreadstat.pyx":472 * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: * no_datetime_conversion = 1 # <<<<<<<<<<<<<< @@ -5220,7 +7145,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ __pyx_v_no_datetime_conversion = 1; - /* "pyreadstat/pyreadstat.pyx":467 + /* "pyreadstat/pyreadstat.pyx":471 * * cdef bint no_datetime_conversion = 0 * if disable_datetime_conversion: # <<<<<<<<<<<<<< @@ -5229,23 +7154,32 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":470 + /* "pyreadstat/pyreadstat.pyx":474 * no_datetime_conversion = 1 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS # <<<<<<<<<<<<<< - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_por, encoding, metaonly, - * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_POR + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, */ __pyx_v_file_format = __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SPSS; - /* "pyreadstat/pyreadstat.pyx":471 + /* "pyreadstat/pyreadstat.pyx":475 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_por, encoding, metaonly, # <<<<<<<<<<<<<< + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_POR # <<<<<<<<<<<<<< + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, + * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + */ + __pyx_v_file_extension = __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_POR; + + /* "pyreadstat/pyreadstat.pyx":476 + * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_POR + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, # <<<<<<<<<<<<<< * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) */ - __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, readstat_parse_por, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, __pyx_v_file_extension, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, ((long)__pyx_v_row_limit), ((long)__pyx_v_row_offset), __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; @@ -5253,7 +7187,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 471, __pyx_L1_error) + __PYX_ERR(0, 476, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5266,23 +7200,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 471, __pyx_L1_error) + __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 471, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 476, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L7_unpacking_done; @@ -5290,7 +7224,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 471, __pyx_L1_error) + __PYX_ERR(0, 476, __pyx_L1_error) __pyx_L7_unpacking_done:; } __pyx_v_data_frame = __pyx_t_3; @@ -5298,35 +7232,35 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb __pyx_v_metadata = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":474 + /* "pyreadstat/pyreadstat.pyx":479 * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "por" # <<<<<<<<<<<<<< * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_por) < 0) __PYX_ERR(0, 474, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_por) < 0) __PYX_ERR(0, 479, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":475 + /* "pyreadstat/pyreadstat.pyx":480 * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "por" * if apply_value_formats: # <<<<<<<<<<<<<< * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category) * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_apply_value_formats); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 475, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_apply_value_formats); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 480, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":476 + /* "pyreadstat/pyreadstat.pyx":481 * metadata.file_format = "por" * if apply_value_formats: * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category) # <<<<<<<<<<<<<< * * return data_frame, metadata */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -5334,10 +7268,10 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb __Pyx_INCREF(__pyx_v_metadata); __Pyx_GIVEREF(__pyx_v_metadata); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_metadata); - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 476, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -5345,7 +7279,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb __Pyx_DECREF_SET(__pyx_v_data_frame, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/pyreadstat.pyx":475 + /* "pyreadstat/pyreadstat.pyx":480 * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "por" * if apply_value_formats: # <<<<<<<<<<<<<< @@ -5354,7 +7288,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ } - /* "pyreadstat/pyreadstat.pyx":478 + /* "pyreadstat/pyreadstat.pyx":483 * data_frame = set_value_labels(data_frame, metadata, formats_as_category=formats_as_category) * * return data_frame, metadata # <<<<<<<<<<<<<< @@ -5362,7 +7296,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 478, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -5374,7 +7308,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb __pyx_t_5 = 0; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":396 + /* "pyreadstat/pyreadstat.pyx":400 * * * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< @@ -5398,7 +7332,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":482 +/* "pyreadstat/pyreadstat.pyx":487 * * * def read_sas7bcat(filename_path, str encoding=None, str output_format=None): # <<<<<<<<<<<<<< @@ -5407,13 +7341,29 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_8read_por(CYTHON_UNUSED PyOb */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_10read_sas7bcat[] = "\n Read a SAS sas7bcat file. The returning dataframe will be empty. The metadata object will contain a dictionary\n value_labels that contains the formats. When parsing the sas7bdat file, in the metadata, the dictionary\n variable_to_label contains a map from variable name to the formats.\n In order to apply the catalog to the sas7bdat file use set_catalog_to_sas or pass the catalog file as an argument\n to read_sas7bdat directly.\n SAS catalog files are difficult ones, some of them can be read only in specific SAS version, may contain strange\n encodings etc. Therefore it may be that many catalog files are not readable from this application.\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. The string is assumed to be utf-8 encoded\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned. \n Notice that for this function the resulting object is always empty, this is done for consistency with other functions\n but has no impact on performance.\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data (no data in this case, so will be empty). If the output_parameter is other\n than 'pandas' then the object type will change accordingly altough the object will always be empty\n metadata :\n object with metadata. The member value_labels is the one that contains the formats.\n Look at the documentation for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_11read_sas7bcat = {"read_sas7bcat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_10read_sas7bcat}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_10read_sas7bcat, "\n Read a SAS sas7bcat file. The returning dataframe will be empty. The metadata object will contain a dictionary\n value_labels that contains the formats. When parsing the sas7bdat file, in the metadata, the dictionary\n variable_to_label contains a map from variable name to the formats.\n In order to apply the catalog to the sas7bdat file use set_catalog_to_sas or pass the catalog file as an argument\n to read_sas7bdat directly.\n SAS catalog files are difficult ones, some of them can be read only in specific SAS version, may contain strange\n encodings etc. Therefore it may be that many catalog files are not readable from this application.\n\n Parameters\n ----------\n filename_path : str, bytes or Path-like object\n path to the file. The string is assumed to be utf-8 encoded\n encoding : str, optional\n Defaults to None. If set, the system will use the defined encoding instead of guessing it. It has to be an\n iconv-compatible name\n output_format : str, optional\n one of 'pandas' (default) or 'dict'. If 'dict' a dictionary with numpy arrays as values will be returned. \n Notice that for this function the resulting object is always empty, this is done for consistency with other functions\n but has no impact on performance.\n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data (no data in this case, so will be empty). If the output_parameter is other\n than 'pandas' then the object type will change accordingly altough the object will always be empty\n metadata :\n object with metadata. The member value_labels is the one that contains the formats.\n Look at the documentation for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_11read_sas7bcat = {"read_sas7bcat", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_10read_sas7bcat}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_filename_path = 0; PyObject *__pyx_v_encoding = 0; PyObject *__pyx_v_output_format = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5421,51 +7371,54 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat(PyObject *__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read_sas7bcat (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_encoding,&__pyx_n_s_output_format,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename_path,&__pyx_n_s_encoding,&__pyx_n_s_output_format,0}; PyObject* values[3] = {0,0,0}; - values[1] = ((PyObject*)Py_None); - values[2] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[1] = ((PyObject*)((PyObject *)Py_None)); + values[2] = ((PyObject*)((PyObject *)Py_None)); + if (__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); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename_path)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_encoding); if (value) { values[1] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_format); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read_sas7bcat") < 0)) __PYX_ERR(0, 482, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read_sas7bcat") < 0)) __PYX_ERR(0, 487, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -5476,14 +7429,14 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_11read_sas7bcat(PyObject *__ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_sas7bcat", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 482, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_sas7bcat", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 487, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_sas7bcat", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 482, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 482, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoding), (&PyString_Type), 1, "encoding", 1))) __PYX_ERR(0, 487, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_output_format), (&PyString_Type), 1, "output_format", 1))) __PYX_ERR(0, 487, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(__pyx_self, __pyx_v_filename_path, __pyx_v_encoding, __pyx_v_output_format); /* function exit code */ @@ -5506,6 +7459,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE PyObject *__pyx_v_extra_datetime_formats = 0; PyObject *__pyx_v_extra_date_formats = 0; __pyx_t_10pyreadstat_16_readstat_parser_py_file_format __pyx_v_file_format; + __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension __pyx_v_file_extension; PyObject *__pyx_v_data_frame = NULL; PyObject *__pyx_v_metadata = NULL; PyObject *__pyx_r = NULL; @@ -5520,7 +7474,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_sas7bcat", 0); - /* "pyreadstat/pyreadstat.pyx":513 + /* "pyreadstat/pyreadstat.pyx":518 * Look at the documentation for more information. * """ * cdef bint metaonly = 1 # <<<<<<<<<<<<<< @@ -5529,7 +7483,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE */ __pyx_v_metaonly = 1; - /* "pyreadstat/pyreadstat.pyx":514 + /* "pyreadstat/pyreadstat.pyx":519 * """ * cdef bint metaonly = 1 * cdef bint dates_as_pandas = 0 # <<<<<<<<<<<<<< @@ -5538,7 +7492,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE */ __pyx_v_dates_as_pandas = 0; - /* "pyreadstat/pyreadstat.pyx":515 + /* "pyreadstat/pyreadstat.pyx":520 * cdef bint metaonly = 1 * cdef bint dates_as_pandas = 0 * cdef list usecols = None # <<<<<<<<<<<<<< @@ -5548,7 +7502,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE __Pyx_INCREF(Py_None); __pyx_v_usecols = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":516 + /* "pyreadstat/pyreadstat.pyx":521 * cdef bint dates_as_pandas = 0 * cdef list usecols = None * cdef bint usernan = 0 # <<<<<<<<<<<<<< @@ -5557,7 +7511,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE */ __pyx_v_usernan = 0; - /* "pyreadstat/pyreadstat.pyx":517 + /* "pyreadstat/pyreadstat.pyx":522 * cdef list usecols = None * cdef bint usernan = 0 * cdef bint no_datetime_conversion = 0 # <<<<<<<<<<<<<< @@ -5566,7 +7520,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE */ __pyx_v_no_datetime_conversion = 0; - /* "pyreadstat/pyreadstat.pyx":518 + /* "pyreadstat/pyreadstat.pyx":523 * cdef bint usernan = 0 * cdef bint no_datetime_conversion = 0 * cdef long row_limit=0 # <<<<<<<<<<<<<< @@ -5575,7 +7529,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE */ __pyx_v_row_limit = 0; - /* "pyreadstat/pyreadstat.pyx":519 + /* "pyreadstat/pyreadstat.pyx":524 * cdef bint no_datetime_conversion = 0 * cdef long row_limit=0 * cdef long row_offset=0 # <<<<<<<<<<<<<< @@ -5584,7 +7538,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE */ __pyx_v_row_offset = 0; - /* "pyreadstat/pyreadstat.pyx":520 + /* "pyreadstat/pyreadstat.pyx":525 * cdef long row_limit=0 * cdef long row_offset=0 * cdef list extra_datetime_formats=None # <<<<<<<<<<<<<< @@ -5594,7 +7548,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE __Pyx_INCREF(Py_None); __pyx_v_extra_datetime_formats = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":521 + /* "pyreadstat/pyreadstat.pyx":526 * cdef long row_offset=0 * cdef list extra_datetime_formats=None * cdef list extra_date_formats=None # <<<<<<<<<<<<<< @@ -5604,23 +7558,32 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE __Pyx_INCREF(Py_None); __pyx_v_extra_date_formats = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":523 + /* "pyreadstat/pyreadstat.pyx":528 * cdef list extra_date_formats=None * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS # <<<<<<<<<<<<<< - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sas7bcat, encoding, metaonly, - * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BCAT + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, */ __pyx_v_file_format = __pyx_e_10pyreadstat_16_readstat_parser_FILE_FORMAT_SAS; - /* "pyreadstat/pyreadstat.pyx":524 + /* "pyreadstat/pyreadstat.pyx":529 * * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS - * data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sas7bcat, encoding, metaonly, # <<<<<<<<<<<<<< + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BCAT # <<<<<<<<<<<<<< + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, + * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, + */ + __pyx_v_file_extension = __pyx_e_10pyreadstat_16_readstat_parser_FILE_EXT_SAS7BCAT; + + /* "pyreadstat/pyreadstat.pyx":530 + * cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS + * cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BCAT + * data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, # <<<<<<<<<<<<<< * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) */ - __pyx_t_1 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, readstat_parse_sas7bcat, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, __pyx_v_row_limit, __pyx_v_row_offset, __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error) + __pyx_t_1 = __pyx_f_10pyreadstat_16_readstat_parser_run_conversion(__pyx_v_filename_path, __pyx_v_file_format, __pyx_v_file_extension, __pyx_v_encoding, __pyx_v_metaonly, __pyx_v_dates_as_pandas, __pyx_v_usecols, __pyx_v_usernan, __pyx_v_no_datetime_conversion, __pyx_v_row_limit, __pyx_v_row_offset, __pyx_v_output_format, __pyx_v_extra_datetime_formats, __pyx_v_extra_date_formats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; @@ -5628,7 +7591,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 524, __pyx_L1_error) + __PYX_ERR(0, 530, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5641,23 +7604,23 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; + __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 524, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 530, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -5665,7 +7628,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 524, __pyx_L1_error) + __PYX_ERR(0, 530, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_data_frame = __pyx_t_2; @@ -5673,16 +7636,16 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE __pyx_v_metadata = __pyx_t_3; __pyx_t_3 = 0; - /* "pyreadstat/pyreadstat.pyx":527 + /* "pyreadstat/pyreadstat.pyx":533 * dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, * output_format, extra_datetime_formats, extra_date_formats) * metadata.file_format = "sas7bcat" # <<<<<<<<<<<<<< * * return data_frame, metadata */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_sas7bcat) < 0) __PYX_ERR(0, 527, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_file_format, __pyx_n_s_sas7bcat) < 0) __PYX_ERR(0, 533, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":529 + /* "pyreadstat/pyreadstat.pyx":535 * metadata.file_format = "sas7bcat" * * return data_frame, metadata # <<<<<<<<<<<<<< @@ -5690,7 +7653,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE * # Functions to deal with value labels */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_data_frame); __Pyx_GIVEREF(__pyx_v_data_frame); @@ -5702,7 +7665,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE __pyx_t_1 = 0; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":482 + /* "pyreadstat/pyreadstat.pyx":487 * * * def read_sas7bcat(filename_path, str encoding=None, str output_format=None): # <<<<<<<<<<<<<< @@ -5729,7 +7692,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":534 +/* "pyreadstat/pyreadstat.pyx":540 * * * def set_value_labels(dataframe, metadata, formats_as_category=True, formats_as_ordered_category=False): # <<<<<<<<<<<<<< @@ -5738,14 +7701,30 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_10read_sas7bcat(CYTHON_UNUSE */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_12set_value_labels[] = "\n Changes the values in the dataframe according to the value formats in the metadata.\n It will return a copy of the dataframe. If no appropiate formats were found, the result will be an unchanged copy\n of the original dataframe.\n\n Parameters\n ----------\n dataframe : pandas dataframe\n resulting from parsing a file\n metadata : dictionary\n resulting from parsing a file\n formats_as_category : bool, optional\n defaults to True. If True the variables having formats will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n\n Returns\n -------\n df_copy : pandas dataframe\n a copy of the original dataframe with the values changed, if appropiate formats were found, unaltered\n otherwise\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_13set_value_labels = {"set_value_labels", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_12set_value_labels}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_12set_value_labels, "\n Changes the values in the dataframe according to the value formats in the metadata.\n It will return a copy of the dataframe. If no appropiate formats were found, the result will be an unchanged copy\n of the original dataframe.\n\n Parameters\n ----------\n dataframe : pandas dataframe\n resulting from parsing a file\n metadata : dictionary\n resulting from parsing a file\n formats_as_category : bool, optional\n defaults to True. If True the variables having formats will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n\n Returns\n -------\n df_copy : pandas dataframe\n a copy of the original dataframe with the values changed, if appropiate formats were found, unaltered\n otherwise\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_13set_value_labels = {"set_value_labels", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_12set_value_labels}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_dataframe = 0; PyObject *__pyx_v_metadata = 0; PyObject *__pyx_v_formats_as_category = 0; PyObject *__pyx_v_formats_as_ordered_category = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5753,60 +7732,64 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_value_labels (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dataframe,&__pyx_n_s_metadata,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dataframe,&__pyx_n_s_metadata,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,0}; PyObject* values[4] = {0,0,0,0}; - values[2] = ((PyObject *)Py_True); - values[3] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { + values[2] = ((PyObject *)((PyObject *)Py_True)); + values[3] = ((PyObject *)((PyObject *)Py_False)); + if (__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); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dataframe)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dataframe)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadata)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_metadata)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("set_value_labels", 0, 2, 4, 1); __PYX_ERR(0, 534, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_value_labels", 0, 2, 4, 1); __PYX_ERR(0, 540, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_category); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_ordered_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_ordered_category); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_value_labels") < 0)) __PYX_ERR(0, 534, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_value_labels") < 0)) __PYX_ERR(0, 540, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -5818,7 +7801,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_value_labels", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 534, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_value_labels", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 540, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.set_value_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5831,7 +7814,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":567 +/* "pyreadstat/pyreadstat.pyx":573 * if labels: * if var_name in df_copy.columns: * df_copy[var_name] = df_copy[var_name].apply(lambda x: labels.get(x, x)) # <<<<<<<<<<<<<< @@ -5840,13 +7823,70 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_13set_value_labels(PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_16set_value_labels_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_16set_value_labels_lambda = {"lambda", (PyCFunction)__pyx_pw_10pyreadstat_10pyreadstat_16set_value_labels_lambda, METH_O, 0}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_16set_value_labels_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_16set_value_labels_lambda(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_16set_value_labels_lambda = {"lambda", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_16set_value_labels_lambda, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_16set_value_labels_lambda(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { + PyObject *__pyx_v_x = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lambda (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, ((PyObject *)__pyx_v_x)); + { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0}; + PyObject* values[1] = {0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 573, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "lambda") < 0)) __PYX_ERR(0, 573, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_x = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 573, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("pyreadstat.pyreadstat.set_value_labels.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, __pyx_v_x); /* function exit code */ __Pyx_RefNannyFinishContext(); @@ -5862,7 +7902,6 @@ static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self, PyObject *__p PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5870,8 +7909,8 @@ static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self, PyObject *__p __pyx_outer_scope = (struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels *) __Pyx_CyFunction_GetClosure(__pyx_self); __pyx_cur_scope = __pyx_outer_scope; __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_cur_scope->__pyx_v_labels)) { __Pyx_RaiseClosureNameError("labels"); __PYX_ERR(0, 567, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error) + if (unlikely(!__pyx_cur_scope->__pyx_v_labels)) { __Pyx_RaiseClosureNameError("labels"); __PYX_ERR(0, 573, __pyx_L1_error) } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -5885,39 +7924,14 @@ static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self, PyObject *__p __pyx_t_4 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_x, __pyx_v_x}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_x, __pyx_v_x}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_x); - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_x); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error) + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_x, __pyx_v_x}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -5927,7 +7941,6 @@ static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self, PyObject *__p __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("pyreadstat.pyreadstat.set_value_labels.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5936,7 +7949,7 @@ static PyObject *__pyx_lambda_funcdef_lambda(PyObject *__pyx_self, PyObject *__p return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":534 +/* "pyreadstat/pyreadstat.pyx":540 * * * def set_value_labels(dataframe, metadata, formats_as_category=True, formats_as_ordered_category=False): # <<<<<<<<<<<<<< @@ -5961,13 +7974,14 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); PyObject *__pyx_t_9 = NULL; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_t_11; - Py_ssize_t __pyx_t_12; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_t_12; + Py_ssize_t __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5976,21 +7990,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 534, __pyx_L1_error) + __PYX_ERR(0, 540, __pyx_L1_error) } else { - __Pyx_GOTREF(__pyx_cur_scope); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } - /* "pyreadstat/pyreadstat.pyx":560 + /* "pyreadstat/pyreadstat.pyx":566 * """ * * df_copy = dataframe.copy() # <<<<<<<<<<<<<< * * if metadata.value_labels and metadata.variable_to_label: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataframe, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataframe, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { @@ -5998,53 +8013,58 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 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(0, 560, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_3, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __pyx_v_df_copy = __pyx_t_1; __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":562 + /* "pyreadstat/pyreadstat.pyx":568 * df_copy = dataframe.copy() * * if metadata.value_labels and metadata.variable_to_label: # <<<<<<<<<<<<<< * for var_name, label_name in metadata.variable_to_label.items(): * labels = metadata.value_labels.get(label_name) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __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, 562, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + if (__pyx_t_6) { } else { - __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __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, 562, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = __pyx_t_6; __pyx_L4_bool_binop_done:; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "pyreadstat/pyreadstat.pyx":563 + /* "pyreadstat/pyreadstat.pyx":569 * * if metadata.value_labels and metadata.variable_to_label: * for var_name, label_name in metadata.variable_to_label.items(): # <<<<<<<<<<<<<< * labels = metadata.value_labels.get(label_name) * if labels: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { @@ -6052,48 +8072,52 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; } } - __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, 563, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_2, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; - __pyx_t_7 = NULL; + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 569, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_7)) { + if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 569, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 569, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_1 = __pyx_t_7(__pyx_t_3); + __pyx_t_1 = __pyx_t_8(__pyx_t_3); 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, 563, __pyx_L1_error) + else __PYX_ERR(0, 569, __pyx_L1_error) } break; } @@ -6105,304 +8129,328 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 563, __pyx_L1_error) + __PYX_ERR(0, 569, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 563, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 563, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 569, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); + index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 563, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L8_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 569, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 563, __pyx_L1_error) + __PYX_ERR(0, 569, __pyx_L1_error) __pyx_L9_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_var_name, __pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_label_name, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_label_name, __pyx_t_9); + __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":564 + /* "pyreadstat/pyreadstat.pyx":570 * if metadata.value_labels and metadata.variable_to_label: * for var_name, label_name in metadata.variable_to_label.items(): * labels = metadata.value_labels.get(label_name) # <<<<<<<<<<<<<< * if labels: * if var_name in df_copy.columns: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 564, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_8)) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } } - __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_v_label_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_label_name); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_label_name}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_labels); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_labels, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":565 + /* "pyreadstat/pyreadstat.pyx":571 * for var_name, label_name in metadata.variable_to_label.items(): * labels = metadata.value_labels.get(label_name) * if labels: # <<<<<<<<<<<<<< * if var_name in df_copy.columns: * df_copy[var_name] = df_copy[var_name].apply(lambda x: labels.get(x, x)) */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_labels); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 565, __pyx_L1_error) - if (__pyx_t_4) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_labels); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 571, __pyx_L1_error) + if (__pyx_t_5) { - /* "pyreadstat/pyreadstat.pyx":566 + /* "pyreadstat/pyreadstat.pyx":572 * labels = metadata.value_labels.get(label_name) * if labels: * if var_name in df_copy.columns: # <<<<<<<<<<<<<< * df_copy[var_name] = df_copy[var_name].apply(lambda x: labels.get(x, x)) * if formats_as_ordered_category: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df_copy, __pyx_n_s_columns); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 566, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df_copy, __pyx_n_s_columns); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_name, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 566, __pyx_L1_error) + __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_var_name, __pyx_t_1, Py_EQ)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 572, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "pyreadstat/pyreadstat.pyx":567 + /* "pyreadstat/pyreadstat.pyx":573 * if labels: * if var_name in df_copy.columns: * df_copy[var_name] = df_copy[var_name].apply(lambda x: labels.get(x, x)) # <<<<<<<<<<<<<< * if formats_as_ordered_category: * categories = list(set(labels.values())) */ - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_df_copy, __pyx_v_var_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_df_copy, __pyx_v_var_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_apply); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 567, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_apply); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_16set_value_labels_lambda, 0, __pyx_n_s_set_value_labels_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_16set_value_labels_lambda, 0, __pyx_n_s_set_value_labels_locals_lambda, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); + __pyx_t_10 = NULL; + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && likely(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_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_df_copy, __pyx_v_var_name, __pyx_t_1) < 0)) __PYX_ERR(0, 567, __pyx_L1_error) + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + if (unlikely((PyObject_SetItem(__pyx_v_df_copy, __pyx_v_var_name, __pyx_t_1) < 0))) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":568 + /* "pyreadstat/pyreadstat.pyx":574 * if var_name in df_copy.columns: * df_copy[var_name] = df_copy[var_name].apply(lambda x: labels.get(x, x)) * if formats_as_ordered_category: # <<<<<<<<<<<<<< * categories = list(set(labels.values())) * original_values = list(labels.keys()) */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_formats_as_ordered_category); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 568, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_formats_as_ordered_category); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 574, __pyx_L1_error) if (__pyx_t_5) { - /* "pyreadstat/pyreadstat.pyx":569 + /* "pyreadstat/pyreadstat.pyx":575 * df_copy[var_name] = df_copy[var_name].apply(lambda x: labels.get(x, x)) * if formats_as_ordered_category: * categories = list(set(labels.values())) # <<<<<<<<<<<<<< * original_values = list(labels.keys()) * original_values.sort() */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_values); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 569, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + { + PyObject *__pyx_callargs[1] = {__pyx_t_2, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 575, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PySequence_List(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) + __pyx_t_1 = PySequence_List(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __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_XDECREF_SET(__pyx_v_categories, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":570 + /* "pyreadstat/pyreadstat.pyx":576 * if formats_as_ordered_category: * categories = list(set(labels.values())) * original_values = list(labels.keys()) # <<<<<<<<<<<<<< * original_values.sort() * revdict= dict() */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_keys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 570, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_keys); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 570, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + { + PyObject *__pyx_callargs[1] = {__pyx_t_2, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_9 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 576, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_original_values, ((PyObject*)__pyx_t_8)); - __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_original_values, ((PyObject*)__pyx_t_9)); + __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":571 + /* "pyreadstat/pyreadstat.pyx":577 * categories = list(set(labels.values())) * original_values = list(labels.keys()) * original_values.sort() # <<<<<<<<<<<<<< * revdict= dict() * for orival in original_values: */ - __pyx_t_11 = PyList_Sort(__pyx_v_original_values); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 571, __pyx_L1_error) + __pyx_t_12 = PyList_Sort(__pyx_v_original_values); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 577, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":572 + /* "pyreadstat/pyreadstat.pyx":578 * original_values = list(labels.keys()) * original_values.sort() * revdict= dict() # <<<<<<<<<<<<<< * for orival in original_values: * curcat = labels.get(orival) */ - __pyx_t_8 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_XDECREF_SET(__pyx_v_revdict, ((PyObject*)__pyx_t_8)); - __pyx_t_8 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_XDECREF_SET(__pyx_v_revdict, ((PyObject*)__pyx_t_9)); + __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":573 + /* "pyreadstat/pyreadstat.pyx":579 * original_values.sort() * revdict= dict() * for orival in original_values: # <<<<<<<<<<<<<< * curcat = labels.get(orival) * if not revdict.get(curcat): */ - __pyx_t_8 = __pyx_v_original_values; __Pyx_INCREF(__pyx_t_8); __pyx_t_12 = 0; + __pyx_t_9 = __pyx_v_original_values; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0; for (;;) { - if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_8)) break; + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 579, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif __Pyx_XDECREF_SET(__pyx_v_orival, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":574 + /* "pyreadstat/pyreadstat.pyx":580 * revdict= dict() * for orival in original_values: * curcat = labels.get(orival) # <<<<<<<<<<<<<< * if not revdict.get(curcat): * revdict[curcat] = orival */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_labels, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = NULL; + __pyx_t_10 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_9)) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } } - __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_9, __pyx_v_orival) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_orival); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_orival}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_XDECREF_SET(__pyx_v_curcat, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":575 + /* "pyreadstat/pyreadstat.pyx":581 * for orival in original_values: * curcat = labels.get(orival) * if not revdict.get(curcat): # <<<<<<<<<<<<<< * revdict[curcat] = orival * categories.sort(key=revdict.get) */ - __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_revdict, __pyx_v_curcat, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_revdict, __pyx_v_curcat, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __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, 575, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = ((!__pyx_t_5) != 0); - if (__pyx_t_4) { + __pyx_t_6 = (!__pyx_t_5); + if (__pyx_t_6) { - /* "pyreadstat/pyreadstat.pyx":576 + /* "pyreadstat/pyreadstat.pyx":582 * curcat = labels.get(orival) * if not revdict.get(curcat): * revdict[curcat] = orival # <<<<<<<<<<<<<< * categories.sort(key=revdict.get) * df_copy[var_name] = pd.Categorical( */ - if (unlikely(PyDict_SetItem(__pyx_v_revdict, __pyx_v_curcat, __pyx_v_orival) < 0)) __PYX_ERR(0, 576, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_revdict, __pyx_v_curcat, __pyx_v_orival) < 0))) __PYX_ERR(0, 582, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":575 + /* "pyreadstat/pyreadstat.pyx":581 * for orival in original_values: * curcat = labels.get(orival) * if not revdict.get(curcat): # <<<<<<<<<<<<<< @@ -6411,7 +8459,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN */ } - /* "pyreadstat/pyreadstat.pyx":573 + /* "pyreadstat/pyreadstat.pyx":579 * original_values.sort() * revdict= dict() * for orival in original_values: # <<<<<<<<<<<<<< @@ -6419,101 +8467,101 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN * if not revdict.get(curcat): */ } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":577 + /* "pyreadstat/pyreadstat.pyx":583 * if not revdict.get(curcat): * revdict[curcat] = orival * categories.sort(key=revdict.get) # <<<<<<<<<<<<<< * df_copy[var_name] = pd.Categorical( * df_copy[var_name], */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_categories, __pyx_n_s_sort); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 577, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_categories, __pyx_n_s_sort); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 583, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_revdict, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_revdict, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_2) < 0) __PYX_ERR(0, 577, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_2) < 0) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":578 + /* "pyreadstat/pyreadstat.pyx":584 * revdict[curcat] = orival * categories.sort(key=revdict.get) * df_copy[var_name] = pd.Categorical( # <<<<<<<<<<<<<< * df_copy[var_name], * ordered = True, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Categorical); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Categorical); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":579 + /* "pyreadstat/pyreadstat.pyx":585 * categories.sort(key=revdict.get) * df_copy[var_name] = pd.Categorical( * df_copy[var_name], # <<<<<<<<<<<<<< * ordered = True, * categories = categories */ - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_df_copy, __pyx_v_var_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_df_copy, __pyx_v_var_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 585, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "pyreadstat/pyreadstat.pyx":578 + /* "pyreadstat/pyreadstat.pyx":584 * revdict[curcat] = orival * categories.sort(key=revdict.get) * df_copy[var_name] = pd.Categorical( # <<<<<<<<<<<<<< * df_copy[var_name], * ordered = True, */ - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":580 + /* "pyreadstat/pyreadstat.pyx":586 * df_copy[var_name] = pd.Categorical( * df_copy[var_name], * ordered = True, # <<<<<<<<<<<<<< * categories = categories * ) */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ordered, Py_True) < 0) __PYX_ERR(0, 580, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ordered, Py_True) < 0) __PYX_ERR(0, 586, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":581 + /* "pyreadstat/pyreadstat.pyx":587 * df_copy[var_name], * ordered = True, * categories = categories # <<<<<<<<<<<<<< * ) * elif formats_as_category: */ - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_categories, __pyx_v_categories) < 0) __PYX_ERR(0, 580, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_categories, __pyx_v_categories) < 0) __PYX_ERR(0, 586, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":578 + /* "pyreadstat/pyreadstat.pyx":584 * revdict[curcat] = orival * categories.sort(key=revdict.get) * df_copy[var_name] = pd.Categorical( # <<<<<<<<<<<<<< * df_copy[var_name], * ordered = True, */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 578, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_df_copy, __pyx_v_var_name, __pyx_t_9) < 0)) __PYX_ERR(0, 578, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely((PyObject_SetItem(__pyx_v_df_copy, __pyx_v_var_name, __pyx_t_10) < 0))) __PYX_ERR(0, 584, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/pyreadstat.pyx":568 + /* "pyreadstat/pyreadstat.pyx":574 * if var_name in df_copy.columns: * df_copy[var_name] = df_copy[var_name].apply(lambda x: labels.get(x, x)) * if formats_as_ordered_category: # <<<<<<<<<<<<<< @@ -6523,47 +8571,52 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN goto __pyx_L12; } - /* "pyreadstat/pyreadstat.pyx":583 + /* "pyreadstat/pyreadstat.pyx":589 * categories = categories * ) * elif formats_as_category: # <<<<<<<<<<<<<< * df_copy[var_name] = df_copy[var_name].astype("category") * */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_formats_as_category); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 583, __pyx_L1_error) - if (__pyx_t_4) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_formats_as_category); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 589, __pyx_L1_error) + if (__pyx_t_6) { - /* "pyreadstat/pyreadstat.pyx":584 + /* "pyreadstat/pyreadstat.pyx":590 * ) * elif formats_as_category: * df_copy[var_name] = df_copy[var_name].astype("category") # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_df_copy, __pyx_v_var_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_df_copy, __pyx_v_var_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8); + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); + __Pyx_DECREF_SET(__pyx_t_9, function); + __pyx_t_4 = 1; } } - __pyx_t_9 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_n_s_category) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_n_s_category); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(PyObject_SetItem(__pyx_v_df_copy, __pyx_v_var_name, __pyx_t_9) < 0)) __PYX_ERR(0, 584, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_n_s_category}; + __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + if (unlikely((PyObject_SetItem(__pyx_v_df_copy, __pyx_v_var_name, __pyx_t_10) < 0))) __PYX_ERR(0, 590, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "pyreadstat/pyreadstat.pyx":583 + /* "pyreadstat/pyreadstat.pyx":589 * categories = categories * ) * elif formats_as_category: # <<<<<<<<<<<<<< @@ -6573,7 +8626,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN } __pyx_L12:; - /* "pyreadstat/pyreadstat.pyx":566 + /* "pyreadstat/pyreadstat.pyx":572 * labels = metadata.value_labels.get(label_name) * if labels: * if var_name in df_copy.columns: # <<<<<<<<<<<<<< @@ -6582,7 +8635,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN */ } - /* "pyreadstat/pyreadstat.pyx":565 + /* "pyreadstat/pyreadstat.pyx":571 * for var_name, label_name in metadata.variable_to_label.items(): * labels = metadata.value_labels.get(label_name) * if labels: # <<<<<<<<<<<<<< @@ -6591,7 +8644,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN */ } - /* "pyreadstat/pyreadstat.pyx":563 + /* "pyreadstat/pyreadstat.pyx":569 * * if metadata.value_labels and metadata.variable_to_label: * for var_name, label_name in metadata.variable_to_label.items(): # <<<<<<<<<<<<<< @@ -6601,7 +8654,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/pyreadstat.pyx":562 + /* "pyreadstat/pyreadstat.pyx":568 * df_copy = dataframe.copy() * * if metadata.value_labels and metadata.variable_to_label: # <<<<<<<<<<<<<< @@ -6610,7 +8663,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN */ } - /* "pyreadstat/pyreadstat.pyx":587 + /* "pyreadstat/pyreadstat.pyx":593 * * * return df_copy # <<<<<<<<<<<<<< @@ -6622,7 +8675,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN __pyx_r = __pyx_v_df_copy; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":534 + /* "pyreadstat/pyreadstat.pyx":540 * * * def set_value_labels(dataframe, metadata, formats_as_category=True, formats_as_ordered_category=False): # <<<<<<<<<<<<<< @@ -6635,8 +8688,8 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("pyreadstat.pyreadstat.set_value_labels", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -6648,13 +8701,13 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN __Pyx_XDECREF(__pyx_v_revdict); __Pyx_XDECREF(__pyx_v_orival); __Pyx_XDECREF(__pyx_v_curcat); - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":589 +/* "pyreadstat/pyreadstat.pyx":595 * return df_copy * * def set_catalog_to_sas(sas_dataframe, sas_metadata, catalog_metadata, formats_as_category=True, # <<<<<<<<<<<<<< @@ -6663,15 +8716,31 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_12set_value_labels(CYTHON_UN */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_14set_catalog_to_sas[] = "\n Changes the values in the dataframe and sas_metadata according to the formats in the catalog.\n It will return a copy of the dataframe and metadata. If no appropriate formats were found, the result will\n be an unchanged copy of the original dataframe.\n\n Parameters\n ----------\n sas_dataframe : pandas dataframe\n resulting from parsing a sas7bdat file\n sas_metadata : pyreadstat metadata object\n resulting from parsing a sas7bdat file\n catalog_metadata : pyreadstat metadata object\n resulting from parsing a sas7bcat (catalog) file\n formats_as_category : bool, optional\n defaults to True. If True the variables having formats will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n\n Returns\n -------\n df_copy : pandas dataframe\n a copy of the original dataframe with the values changed, if appropriate formats were found, unaltered\n otherwise\n metadata : dict\n a copy of the original sas_metadata enriched with catalog information if found, otherwise unaltered\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_15set_catalog_to_sas = {"set_catalog_to_sas", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_14set_catalog_to_sas}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_14set_catalog_to_sas, "\n Changes the values in the dataframe and sas_metadata according to the formats in the catalog.\n It will return a copy of the dataframe and metadata. If no appropriate formats were found, the result will\n be an unchanged copy of the original dataframe.\n\n Parameters\n ----------\n sas_dataframe : pandas dataframe\n resulting from parsing a sas7bdat file\n sas_metadata : pyreadstat metadata object\n resulting from parsing a sas7bdat file\n catalog_metadata : pyreadstat metadata object\n resulting from parsing a sas7bcat (catalog) file\n formats_as_category : bool, optional\n defaults to True. If True the variables having formats will be transformed into pandas categories.\n formats_as_ordered_category : bool, optional\n defaults to False. If True the variables having formats will be transformed into pandas ordered categories.\n it has precedence over formats_as_category, meaning if this is True, it will take effect irrespective of\n the value of formats_as_category.\n\n Returns\n -------\n df_copy : pandas dataframe\n a copy of the original dataframe with the values changed, if appropriate formats were found, unaltered\n otherwise\n metadata : dict\n a copy of the original sas_metadata enriched with catalog information if found, otherwise unaltered\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_15set_catalog_to_sas = {"set_catalog_to_sas", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_14set_catalog_to_sas}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_sas_dataframe = 0; PyObject *__pyx_v_sas_metadata = 0; PyObject *__pyx_v_catalog_metadata = 0; PyObject *__pyx_v_formats_as_category = 0; PyObject *__pyx_v_formats_as_ordered_category = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6679,77 +8748,82 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_catalog_to_sas (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sas_dataframe,&__pyx_n_s_sas_metadata,&__pyx_n_s_catalog_metadata,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sas_dataframe,&__pyx_n_s_sas_metadata,&__pyx_n_s_catalog_metadata,&__pyx_n_s_formats_as_category,&__pyx_n_s_formats_as_ordered_category,0}; PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)Py_True); + values[3] = ((PyObject *)((PyObject *)Py_True)); - /* "pyreadstat/pyreadstat.pyx":590 + /* "pyreadstat/pyreadstat.pyx":596 * * def set_catalog_to_sas(sas_dataframe, sas_metadata, catalog_metadata, formats_as_category=True, * formats_as_ordered_category=False): # <<<<<<<<<<<<<< * """ * Changes the values in the dataframe and sas_metadata according to the formats in the catalog. */ - values[4] = ((PyObject *)Py_False); - if (unlikely(__pyx_kwds)) { + values[4] = ((PyObject *)((PyObject *)Py_False)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sas_dataframe)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sas_dataframe)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sas_metadata)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sas_metadata)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("set_catalog_to_sas", 0, 3, 5, 1); __PYX_ERR(0, 589, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_catalog_to_sas", 0, 3, 5, 1); __PYX_ERR(0, 595, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_catalog_metadata)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_catalog_metadata)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("set_catalog_to_sas", 0, 3, 5, 2); __PYX_ERR(0, 589, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_catalog_to_sas", 0, 3, 5, 2); __PYX_ERR(0, 595, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_category); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_formats_as_ordered_category); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_formats_as_ordered_category); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_catalog_to_sas") < 0)) __PYX_ERR(0, 589, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_catalog_to_sas") < 0)) __PYX_ERR(0, 595, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -6762,7 +8836,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas(PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("set_catalog_to_sas", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 589, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("set_catalog_to_sas", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 595, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.set_catalog_to_sas", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6770,7 +8844,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_15set_catalog_to_sas(PyObjec __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(__pyx_self, __pyx_v_sas_dataframe, __pyx_v_sas_metadata, __pyx_v_catalog_metadata, __pyx_v_formats_as_category, __pyx_v_formats_as_ordered_category); - /* "pyreadstat/pyreadstat.pyx":589 + /* "pyreadstat/pyreadstat.pyx":595 * return df_copy * * def set_catalog_to_sas(sas_dataframe, sas_metadata, catalog_metadata, formats_as_category=True, # <<<<<<<<<<<<<< @@ -6798,50 +8872,52 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - PyObject *(*__pyx_t_10)(PyObject *); + int __pyx_t_6; + 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)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_catalog_to_sas", 0); - /* "pyreadstat/pyreadstat.pyx":620 + /* "pyreadstat/pyreadstat.pyx":626 * """ * * if catalog_metadata.value_labels and sas_metadata.variable_to_label: # <<<<<<<<<<<<<< * catalog_metadata_copy = deepcopy(catalog_metadata) * metadata = deepcopy(sas_metadata) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_catalog_metadata, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_catalog_metadata, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __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, 620, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sas_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sas_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __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, 620, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":621 + /* "pyreadstat/pyreadstat.pyx":627 * * if catalog_metadata.value_labels and sas_metadata.variable_to_label: * catalog_metadata_copy = deepcopy(catalog_metadata) # <<<<<<<<<<<<<< * metadata = deepcopy(sas_metadata) * metadata.value_labels = catalog_metadata_copy.value_labels */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 621, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __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)) { @@ -6849,26 +8925,31 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_catalog_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_catalog_metadata); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_catalog_metadata}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_catalog_metadata_copy = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":622 + /* "pyreadstat/pyreadstat.pyx":628 * if catalog_metadata.value_labels and sas_metadata.variable_to_label: * catalog_metadata_copy = deepcopy(catalog_metadata) * metadata = deepcopy(sas_metadata) # <<<<<<<<<<<<<< * metadata.value_labels = catalog_metadata_copy.value_labels * df_copy = set_value_labels(sas_dataframe, metadata, formats_as_category=formats_as_category, */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 622, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __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)) { @@ -6876,38 +8957,42 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_sas_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_sas_metadata); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_sas_metadata}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __pyx_v_metadata = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":623 + /* "pyreadstat/pyreadstat.pyx":629 * catalog_metadata_copy = deepcopy(catalog_metadata) * metadata = deepcopy(sas_metadata) * metadata.value_labels = catalog_metadata_copy.value_labels # <<<<<<<<<<<<<< * df_copy = set_value_labels(sas_dataframe, metadata, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_catalog_metadata_copy, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_catalog_metadata_copy, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels, __pyx_t_2) < 0) __PYX_ERR(0, 623, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_value_labels, __pyx_t_2) < 0) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":624 + /* "pyreadstat/pyreadstat.pyx":630 * metadata = deepcopy(sas_metadata) * metadata.value_labels = catalog_metadata_copy.value_labels * df_copy = set_value_labels(sas_dataframe, metadata, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_set_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_sas_dataframe); __Pyx_GIVEREF(__pyx_v_sas_dataframe); @@ -6915,59 +9000,60 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_INCREF(__pyx_v_metadata); __Pyx_GIVEREF(__pyx_v_metadata); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_metadata); - __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 624, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_formats_as_category, __pyx_v_formats_as_category) < 0) __PYX_ERR(0, 630, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":625 + /* "pyreadstat/pyreadstat.pyx":631 * metadata.value_labels = catalog_metadata_copy.value_labels * df_copy = set_value_labels(sas_dataframe, metadata, formats_as_category=formats_as_category, * formats_as_ordered_category=formats_as_ordered_category) # <<<<<<<<<<<<<< * * variable_value_labels = dict() */ - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 624, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_formats_as_ordered_category, __pyx_v_formats_as_ordered_category) < 0) __PYX_ERR(0, 630, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":624 + /* "pyreadstat/pyreadstat.pyx":630 * metadata = deepcopy(sas_metadata) * metadata.value_labels = catalog_metadata_copy.value_labels * df_copy = set_value_labels(sas_dataframe, metadata, formats_as_category=formats_as_category, # <<<<<<<<<<<<<< * formats_as_ordered_category=formats_as_ordered_category) * */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 624, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __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_v_df_copy = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_df_copy = __pyx_t_7; + __pyx_t_7 = 0; - /* "pyreadstat/pyreadstat.pyx":627 + /* "pyreadstat/pyreadstat.pyx":633 * formats_as_ordered_category=formats_as_ordered_category) * * variable_value_labels = dict() # <<<<<<<<<<<<<< * for var_name, var_label in metadata.variable_to_label.items(): * current_labels = catalog_metadata_copy.value_labels.get(var_label) */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 627, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_v_variable_value_labels = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_variable_value_labels = ((PyObject*)__pyx_t_7); + __pyx_t_7 = 0; - /* "pyreadstat/pyreadstat.pyx":628 + /* "pyreadstat/pyreadstat.pyx":634 * * variable_value_labels = dict() * for var_name, var_label in metadata.variable_to_label.items(): # <<<<<<<<<<<<<< * current_labels = catalog_metadata_copy.value_labels.get(var_label) * if current_labels: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_to_label); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { @@ -6975,60 +9061,64 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_6 = (__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_6)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { - __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + { + PyObject *__pyx_callargs[1] = {__pyx_t_5, }; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; + __pyx_t_9 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 634, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { - if (likely(!__pyx_t_8)) { + if (likely(!__pyx_t_9)) { if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 634, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); #endif } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 634, __pyx_L1_error) #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); #endif } } else { - __pyx_t_6 = __pyx_t_8(__pyx_t_4); - if (unlikely(!__pyx_t_6)) { + __pyx_t_7 = __pyx_t_9(__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, 628, __pyx_L1_error) + else __PYX_ERR(0, 634, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); } - if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { - PyObject* sequence = __pyx_t_6; + 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, 628, __pyx_L1_error) + __PYX_ERR(0, 634, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7041,31 +9131,31 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_2); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 628, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed; + __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 634, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); + index = 0; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_2 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; + index = 1; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 628, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 634, __pyx_L1_error) + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 628, __pyx_L1_error) + __PYX_ERR(0, 634, __pyx_L1_error) __pyx_L9_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_var_name, __pyx_t_5); @@ -7073,19 +9163,20 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_XDECREF_SET(__pyx_v_var_label, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":629 + /* "pyreadstat/pyreadstat.pyx":635 * variable_value_labels = dict() * for var_name, var_label in metadata.variable_to_label.items(): * current_labels = catalog_metadata_copy.value_labels.get(var_label) # <<<<<<<<<<<<<< * if current_labels: * variable_value_labels[var_name] = current_labels */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_catalog_metadata_copy, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_catalog_metadata_copy, __pyx_n_s_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 629, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; + __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { @@ -7093,36 +9184,40 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; } } - __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_var_label) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_var_label); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 629, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_current_labels, __pyx_t_6); - __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_var_label}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 635, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_XDECREF_SET(__pyx_v_current_labels, __pyx_t_7); + __pyx_t_7 = 0; - /* "pyreadstat/pyreadstat.pyx":630 + /* "pyreadstat/pyreadstat.pyx":636 * for var_name, var_label in metadata.variable_to_label.items(): * current_labels = catalog_metadata_copy.value_labels.get(var_label) * if current_labels: # <<<<<<<<<<<<<< * variable_value_labels[var_name] = current_labels * metadata.variable_value_labels = variable_value_labels */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_current_labels); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 630, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_current_labels); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 636, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":631 + /* "pyreadstat/pyreadstat.pyx":637 * current_labels = catalog_metadata_copy.value_labels.get(var_label) * if current_labels: * variable_value_labels[var_name] = current_labels # <<<<<<<<<<<<<< * metadata.variable_value_labels = variable_value_labels * */ - if (unlikely(PyDict_SetItem(__pyx_v_variable_value_labels, __pyx_v_var_name, __pyx_v_current_labels) < 0)) __PYX_ERR(0, 631, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_variable_value_labels, __pyx_v_var_name, __pyx_v_current_labels) < 0))) __PYX_ERR(0, 637, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":630 + /* "pyreadstat/pyreadstat.pyx":636 * for var_name, var_label in metadata.variable_to_label.items(): * current_labels = catalog_metadata_copy.value_labels.get(var_label) * if current_labels: # <<<<<<<<<<<<<< @@ -7131,7 +9226,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ */ } - /* "pyreadstat/pyreadstat.pyx":628 + /* "pyreadstat/pyreadstat.pyx":634 * * variable_value_labels = dict() * for var_name, var_label in metadata.variable_to_label.items(): # <<<<<<<<<<<<<< @@ -7141,16 +9236,16 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":632 + /* "pyreadstat/pyreadstat.pyx":638 * if current_labels: * variable_value_labels[var_name] = current_labels * metadata.variable_value_labels = variable_value_labels # <<<<<<<<<<<<<< * * else: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_value_labels, __pyx_v_variable_value_labels) < 0) __PYX_ERR(0, 632, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_metadata, __pyx_n_s_variable_value_labels, __pyx_v_variable_value_labels) < 0) __PYX_ERR(0, 638, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":620 + /* "pyreadstat/pyreadstat.pyx":626 * """ * * if catalog_metadata.value_labels and sas_metadata.variable_to_label: # <<<<<<<<<<<<<< @@ -7160,7 +9255,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ goto __pyx_L3; } - /* "pyreadstat/pyreadstat.pyx":635 + /* "pyreadstat/pyreadstat.pyx":641 * * else: * df_copy = sas_dataframe.copy() # <<<<<<<<<<<<<< @@ -7168,56 +9263,66 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ * */ /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_sas_dataframe, __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sas_dataframe, __pyx_n_s_copy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_6 = 1; } } - __pyx_t_4 = (__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_4)) __PYX_ERR(0, 635, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_5, }; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 641, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } __pyx_v_df_copy = __pyx_t_4; __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":636 + /* "pyreadstat/pyreadstat.pyx":642 * else: * df_copy = sas_dataframe.copy() * metadata = deepcopy(sas_metadata) # <<<<<<<<<<<<<< * * return df_copy, metadata */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_6 = 1; } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_v_sas_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_sas_metadata); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_sas_metadata}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } __pyx_v_metadata = __pyx_t_4; __pyx_t_4 = 0; } __pyx_L3:; - /* "pyreadstat/pyreadstat.pyx":638 + /* "pyreadstat/pyreadstat.pyx":644 * metadata = deepcopy(sas_metadata) * * return df_copy, metadata # <<<<<<<<<<<<<< @@ -7225,7 +9330,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ * # convenience functions to read in chunks */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 638, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_df_copy); __Pyx_GIVEREF(__pyx_v_df_copy); @@ -7237,7 +9342,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __pyx_t_4 = 0; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":589 + /* "pyreadstat/pyreadstat.pyx":595 * return df_copy * * def set_catalog_to_sas(sas_dataframe, sas_metadata, catalog_metadata, formats_as_category=True, # <<<<<<<<<<<<<< @@ -7250,8 +9355,8 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("pyreadstat.pyreadstat.set_catalog_to_sas", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -7268,7 +9373,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_14set_catalog_to_sas(CYTHON_ } static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "pyreadstat/pyreadstat.pyx":642 +/* "pyreadstat/pyreadstat.pyx":648 * # convenience functions to read in chunks * * def read_file_in_chunks(read_function, file_path, chunksize=100000, offset=0, limit=0, # <<<<<<<<<<<<<< @@ -7277,10 +9382,22 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_16read_file_in_chunks[] = "\n Returns a generator that will allow to read a file in chunks.\n\n If using multiprocessing, for Xport, Por and some defective sav files where the number of rows in the dataset canot be obtained from the metadata, \n the parameter num_rows must be set to a number equal or larger than the number of rows in the dataset. That information must\n be obtained by the user before running this function.\n\n Parameters\n ----------\n read_function : pyreadstat function\n a pyreadstat reading function\n file_path : string\n path to the file to be read\n chunksize : integer, optional\n size of the chunks to read\n offset : integer, optional\n start reading the file after certain number of rows\n limit : integer, optional\n stop reading the file after certain number of rows, will be added to offset\n multiprocess: bool, optional\n use multiprocessing to read each chunk?\n num_processes: integer, optional\n in case multiprocess is true, how many workers/processes to spawn?\n num_rows: integer, optional\n number of rows in the dataset. If using multiprocessing it is obligatory for files where\n the number of rows cannot be obtained from the medatata, such as xport, por and \n some defective sav files. The user must obtain this value by reading the file without multiprocessing first or any other means. A number\n larger than the actual number of rows will work as well. Discarded if the number of rows can be obtained from the metadata or not using\n multiprocessing.\n kwargs : dict, optional\n any other keyword argument to pass to the read_function. row_limit and row_offset will be discarded if present.\n\n Yields\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data\n metadata :\n object with me""tadata. \n Look at the documentation for more information.\n\n it : generator\n A generator that reads the file in chunks.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_17read_file_in_chunks = {"read_file_in_chunks", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_16read_file_in_chunks}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_16read_file_in_chunks, "\n Returns a generator that will allow to read a file in chunks.\n\n If using multiprocessing, for Xport, Por and some defective sav files where the number of rows in the dataset canot be obtained from the metadata, \n the parameter num_rows must be set to a number equal or larger than the number of rows in the dataset. That information must\n be obtained by the user before running this function.\n\n Parameters\n ----------\n read_function : pyreadstat function\n a pyreadstat reading function\n file_path : string\n path to the file to be read\n chunksize : integer, optional\n size of the chunks to read\n offset : integer, optional\n start reading the file after certain number of rows\n limit : integer, optional\n stop reading the file after certain number of rows, will be added to offset\n multiprocess: bool, optional\n use multiprocessing to read each chunk?\n num_processes: integer, optional\n in case multiprocess is true, how many workers/processes to spawn?\n num_rows: integer, optional\n number of rows in the dataset. If using multiprocessing it is obligatory for files where\n the number of rows cannot be obtained from the medatata, such as xport, por and \n some defective sav files. The user must obtain this value by reading the file without multiprocessing first or any other means. A number\n larger than the actual number of rows will work as well. Discarded if the number of rows can be obtained from the metadata or not using\n multiprocessing.\n kwargs : dict, optional\n any other keyword argument to pass to the read_function. row_limit and row_offset will be discarded if present.\n\n Yields\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data\n metadata :\n object with me""tadata. \n Look at the documentation for more information.\n\n it : generator\n A generator that reads the file in chunks.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_17read_file_in_chunks = {"read_file_in_chunks", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_16read_file_in_chunks}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_read_function = 0; PyObject *__pyx_v_file_path = 0; PyObject *__pyx_v_chunksize = 0; @@ -7290,6 +9407,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObje PyObject *__pyx_v_num_processes = 0; PyObject *__pyx_v_num_rows = 0; PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7299,112 +9420,120 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObje __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read_function,&__pyx_n_s_file_path,&__pyx_n_s_chunksize,&__pyx_n_s_offset,&__pyx_n_s_limit,&__pyx_n_s_multiprocess,&__pyx_n_s_num_processes,&__pyx_n_s_num_rows,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read_function,&__pyx_n_s_file_path,&__pyx_n_s_chunksize,&__pyx_n_s_offset,&__pyx_n_s_limit,&__pyx_n_s_multiprocess,&__pyx_n_s_num_processes,&__pyx_n_s_num_rows,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; - values[2] = ((PyObject *)__pyx_int_100000); - values[3] = ((PyObject *)__pyx_int_0); - values[4] = ((PyObject *)__pyx_int_0); + values[2] = ((PyObject *)((PyObject *)__pyx_int_100000)); + values[3] = ((PyObject *)((PyObject *)__pyx_int_0)); + values[4] = ((PyObject *)((PyObject *)__pyx_int_0)); - /* "pyreadstat/pyreadstat.pyx":643 + /* "pyreadstat/pyreadstat.pyx":649 * * def read_file_in_chunks(read_function, file_path, chunksize=100000, offset=0, limit=0, * multiprocess=False, num_processes=4, num_rows=None, **kwargs): # <<<<<<<<<<<<<< * """ * Returns a generator that will allow to read a file in chunks. */ - values[5] = ((PyObject *)Py_False); - values[6] = ((PyObject *)__pyx_int_4); - values[7] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + values[5] = ((PyObject *)((PyObject *)Py_False)); + values[6] = ((PyObject *)((PyObject *)__pyx_int_4)); + values[7] = ((PyObject *)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read_function)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_read_function)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_path)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("read_file_in_chunks", 0, 2, 8, 1); __PYX_ERR(0, 642, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_file_in_chunks", 0, 2, 8, 1); __PYX_ERR(0, 648, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chunksize); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chunksize); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_limit); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_limit); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_multiprocess); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_multiprocess); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_processes); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_num_processes); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_rows); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_num_rows); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "read_file_in_chunks") < 0)) __PYX_ERR(0, 642, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "read_file_in_chunks") < 0)) __PYX_ERR(0, 648, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -7420,7 +9549,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_file_in_chunks", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 642, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_file_in_chunks", 0, 2, 8, __pyx_nargs); __PYX_ERR(0, 648, __pyx_L3_error) __pyx_L3_error:; __Pyx_CLEAR(__pyx_v_kwargs); __Pyx_AddTraceback("pyreadstat.pyreadstat.read_file_in_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -7429,7 +9558,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObje __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_16read_file_in_chunks(__pyx_self, __pyx_v_read_function, __pyx_v_file_path, __pyx_v_chunksize, __pyx_v_offset, __pyx_v_limit, __pyx_v_multiprocess, __pyx_v_num_processes, __pyx_v_num_rows, __pyx_v_kwargs); - /* "pyreadstat/pyreadstat.pyx":642 + /* "pyreadstat/pyreadstat.pyx":648 * # convenience functions to read in chunks * * def read_file_in_chunks(read_function, file_path, chunksize=100000, offset=0, limit=0, # <<<<<<<<<<<<<< @@ -7438,7 +9567,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_17read_file_in_chunks(PyObje */ /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_DECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -7455,9 +9584,9 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_16read_file_in_chunks(CYTHON if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 642, __pyx_L1_error) + __PYX_ERR(0, 648, __pyx_L1_error) } else { - __Pyx_GOTREF(__pyx_cur_scope); + __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_read_function = __pyx_v_read_function; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_read_function); @@ -7487,7 +9616,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_16read_file_in_chunks(CYTHON __Pyx_INCREF(__pyx_cur_scope->__pyx_v_kwargs); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_kwargs); { - __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pyreadstat_10pyreadstat_18generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_read_file_in_chunks, __pyx_n_s_read_file_in_chunks, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!gen)) __PYX_ERR(0, 642, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_10pyreadstat_10pyreadstat_18generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_read_file_in_chunks, __pyx_n_s_read_file_in_chunks, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!gen)) __PYX_ERR(0, 648, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -7497,7 +9626,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_16read_file_in_chunks(CYTHON __pyx_L1_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_file_in_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; - __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -7510,10 +9639,10 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *(*__pyx_t_7)(PyObject *); + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; Py_ssize_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -7528,37 +9657,37 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 642, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 648, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":688 + /* "pyreadstat/pyreadstat.pyx":694 * """ * * if read_function == read_sas7bcat: # <<<<<<<<<<<<<< * raise Exception("read_sas7bcat not supported") * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_read_sas7bcat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_read_sas7bcat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_read_function, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_read_function, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error) __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, 688, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "pyreadstat/pyreadstat.pyx":689 + /* "pyreadstat/pyreadstat.pyx":695 * * if read_function == read_sas7bcat: * raise Exception("read_sas7bcat not supported") # <<<<<<<<<<<<<< * * if "row_offset" in kwargs: */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __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, 689, __pyx_L1_error) + __PYX_ERR(0, 695, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":688 + /* "pyreadstat/pyreadstat.pyx":694 * """ * * if read_function == read_sas7bcat: # <<<<<<<<<<<<<< @@ -7567,31 +9696,30 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ } - /* "pyreadstat/pyreadstat.pyx":691 + /* "pyreadstat/pyreadstat.pyx":697 * raise Exception("read_sas7bcat not supported") * * if "row_offset" in kwargs: # <<<<<<<<<<<<<< * _ = kwargs.pop("row_offset") * */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_row_offset, __pyx_cur_scope->__pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 691, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_row_offset, __pyx_cur_scope->__pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 697, __pyx_L1_error) + if (__pyx_t_3) { - /* "pyreadstat/pyreadstat.pyx":692 + /* "pyreadstat/pyreadstat.pyx":698 * * if "row_offset" in kwargs: * _ = kwargs.pop("row_offset") # <<<<<<<<<<<<<< * * if "row_limit" in kwargs: */ - __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_s_row_offset, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_s_row_offset, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v__ = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":691 + /* "pyreadstat/pyreadstat.pyx":697 * raise Exception("read_sas7bcat not supported") * * if "row_offset" in kwargs: # <<<<<<<<<<<<<< @@ -7600,32 +9728,31 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ } - /* "pyreadstat/pyreadstat.pyx":694 + /* "pyreadstat/pyreadstat.pyx":700 * _ = kwargs.pop("row_offset") * * if "row_limit" in kwargs: # <<<<<<<<<<<<<< * _ = kwargs.pop("row_limit") * */ - __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_row_limit, __pyx_cur_scope->__pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 694, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_row_limit, __pyx_cur_scope->__pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 700, __pyx_L1_error) if (__pyx_t_3) { - /* "pyreadstat/pyreadstat.pyx":695 + /* "pyreadstat/pyreadstat.pyx":701 * * if "row_limit" in kwargs: * _ = kwargs.pop("row_limit") # <<<<<<<<<<<<<< * * if "num_processes" in kwargs: */ - __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_s_row_limit, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_s_row_limit, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v__, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":694 + /* "pyreadstat/pyreadstat.pyx":700 * _ = kwargs.pop("row_offset") * * if "row_limit" in kwargs: # <<<<<<<<<<<<<< @@ -7634,32 +9761,31 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ } - /* "pyreadstat/pyreadstat.pyx":697 + /* "pyreadstat/pyreadstat.pyx":703 * _ = kwargs.pop("row_limit") * * if "num_processes" in kwargs: # <<<<<<<<<<<<<< * _ = kwargs.pop("num_processes") * */ - __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_num_processes, __pyx_cur_scope->__pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 697, __pyx_L1_error) - __pyx_t_4 = (__pyx_t_3 != 0); - if (__pyx_t_4) { + __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_num_processes, __pyx_cur_scope->__pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 703, __pyx_L1_error) + if (__pyx_t_3) { - /* "pyreadstat/pyreadstat.pyx":698 + /* "pyreadstat/pyreadstat.pyx":704 * * if "num_processes" in kwargs: * _ = kwargs.pop("num_processes") # <<<<<<<<<<<<<< * * _, meta = read_function(file_path, metadataonly=True) */ - __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_s_num_processes, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_cur_scope->__pyx_v_kwargs, __pyx_n_s_num_processes, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v__, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":697 + /* "pyreadstat/pyreadstat.pyx":703 * _ = kwargs.pop("row_limit") * * if "num_processes" in kwargs: # <<<<<<<<<<<<<< @@ -7668,32 +9794,32 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ } - /* "pyreadstat/pyreadstat.pyx":700 + /* "pyreadstat/pyreadstat.pyx":706 * _ = kwargs.pop("num_processes") * * _, meta = read_function(file_path, metadataonly=True) # <<<<<<<<<<<<<< * numrows = meta.number_rows * if numrows: */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_file_path); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_file_path); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_file_path); - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_metadataonly, Py_True) < 0) __PYX_ERR(0, 700, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_read_function, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_metadataonly, Py_True) < 0) __PYX_ERR(0, 706, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_read_function, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { - PyObject* sequence = __pyx_t_5; + if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) { + PyObject* sequence = __pyx_t_4; 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, 700, __pyx_L1_error) + __PYX_ERR(0, 706, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -7706,31 +9832,31 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { Py_ssize_t index = -1; - __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 700, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed; + __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 706, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); + index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; + index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 700, __pyx_L1_error) - __pyx_t_7 = NULL; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 706, __pyx_L1_error) + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_unpacking_failed:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 700, __pyx_L1_error) + __PYX_ERR(0, 706, __pyx_L1_error) __pyx_L9_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v__); @@ -7741,41 +9867,41 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __pyx_cur_scope->__pyx_v_meta = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":701 + /* "pyreadstat/pyreadstat.pyx":707 * * _, meta = read_function(file_path, metadataonly=True) * numrows = meta.number_rows # <<<<<<<<<<<<<< * if numrows: * if not limit: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_meta, __pyx_n_s_number_rows); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 701, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_numrows = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_meta, __pyx_n_s_number_rows); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 707, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_numrows = __pyx_t_4; + __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":702 + /* "pyreadstat/pyreadstat.pyx":708 * _, meta = read_function(file_path, metadataonly=True) * numrows = meta.number_rows * if numrows: # <<<<<<<<<<<<<< * if not limit: * limit = numrows */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_numrows); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 702, __pyx_L1_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_numrows); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 708, __pyx_L1_error) + if (__pyx_t_3) { - /* "pyreadstat/pyreadstat.pyx":703 + /* "pyreadstat/pyreadstat.pyx":709 * numrows = meta.number_rows * if numrows: * if not limit: # <<<<<<<<<<<<<< * limit = numrows * else: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_limit); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 703, __pyx_L1_error) - __pyx_t_3 = ((!__pyx_t_4) != 0); - if (__pyx_t_3) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_limit); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 709, __pyx_L1_error) + __pyx_t_7 = (!__pyx_t_3); + if (__pyx_t_7) { - /* "pyreadstat/pyreadstat.pyx":704 + /* "pyreadstat/pyreadstat.pyx":710 * if numrows: * if not limit: * limit = numrows # <<<<<<<<<<<<<< @@ -7787,7 +9913,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_limit, __pyx_cur_scope->__pyx_v_numrows); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_numrows); - /* "pyreadstat/pyreadstat.pyx":703 + /* "pyreadstat/pyreadstat.pyx":709 * numrows = meta.number_rows * if numrows: * if not limit: # <<<<<<<<<<<<<< @@ -7797,7 +9923,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO goto __pyx_L11; } - /* "pyreadstat/pyreadstat.pyx":706 + /* "pyreadstat/pyreadstat.pyx":712 * limit = numrows * else: * limit = min(offset+limit, numrows) # <<<<<<<<<<<<<< @@ -7806,32 +9932,32 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ /*else*/ { __Pyx_INCREF(__pyx_cur_scope->__pyx_v_numrows); - __pyx_t_5 = __pyx_cur_scope->__pyx_v_numrows; - __pyx_t_2 = PyNumber_Add(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_limit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L1_error) + __pyx_t_4 = __pyx_cur_scope->__pyx_v_numrows; + __pyx_t_2 = PyNumber_Add(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_limit); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 706, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 706, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_3) { - __Pyx_INCREF(__pyx_t_5); - __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 712, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + __Pyx_INCREF(__pyx_t_4); + __pyx_t_1 = __pyx_t_4; } else { __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __pyx_t_1; - __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_limit); - __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_limit, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_limit, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; } __pyx_L11:; - /* "pyreadstat/pyreadstat.pyx":702 + /* "pyreadstat/pyreadstat.pyx":708 * _, meta = read_function(file_path, metadataonly=True) * numrows = meta.number_rows * if numrows: # <<<<<<<<<<<<<< @@ -7841,7 +9967,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO goto __pyx_L10; } - /* "pyreadstat/pyreadstat.pyx":708 + /* "pyreadstat/pyreadstat.pyx":714 * limit = min(offset+limit, numrows) * else: * if limit: # <<<<<<<<<<<<<< @@ -7849,24 +9975,24 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO * df = [0] */ /*else*/ { - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_limit); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 708, __pyx_L1_error) - if (__pyx_t_3) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_limit); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 714, __pyx_L1_error) + if (__pyx_t_7) { - /* "pyreadstat/pyreadstat.pyx":709 + /* "pyreadstat/pyreadstat.pyx":715 * else: * if limit: * limit = offset + limit # <<<<<<<<<<<<<< * df = [0] * while len(df): */ - __pyx_t_5 = PyNumber_Add(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_limit); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Add(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_limit); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_limit); - __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_limit, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_limit, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":708 + /* "pyreadstat/pyreadstat.pyx":714 * limit = min(offset+limit, numrows) * else: * if limit: # <<<<<<<<<<<<<< @@ -7877,23 +10003,23 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO } __pyx_L10:; - /* "pyreadstat/pyreadstat.pyx":710 + /* "pyreadstat/pyreadstat.pyx":716 * if limit: * limit = offset + limit * df = [0] # <<<<<<<<<<<<<< * while len(df): * if limit and (offset >= limit): */ - __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 710, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_cur_scope->__pyx_v_df = __pyx_t_5; - __pyx_t_5 = 0; + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_cur_scope->__pyx_v_df = __pyx_t_4; + __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":711 + /* "pyreadstat/pyreadstat.pyx":717 * limit = offset + limit * df = [0] * while len(df): # <<<<<<<<<<<<<< @@ -7901,31 +10027,31 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO * break */ while (1) { - __pyx_t_8 = PyObject_Length(__pyx_cur_scope->__pyx_v_df); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 711, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_8 != 0); - if (!__pyx_t_3) break; + __pyx_t_8 = PyObject_Length(__pyx_cur_scope->__pyx_v_df); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 717, __pyx_L1_error) + __pyx_t_7 = (__pyx_t_8 != 0); + if (!__pyx_t_7) break; - /* "pyreadstat/pyreadstat.pyx":712 + /* "pyreadstat/pyreadstat.pyx":718 * df = [0] * while len(df): * if limit and (offset >= limit): # <<<<<<<<<<<<<< * break * if multiprocess: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_limit); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 712, __pyx_L1_error) - if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_limit); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 718, __pyx_L1_error) + if (__pyx_t_3) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_7 = __pyx_t_3; goto __pyx_L16_bool_binop_done; } - __pyx_t_5 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_limit, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 712, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_limit, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 718, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 718, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __pyx_t_3; __pyx_L16_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_7) { - /* "pyreadstat/pyreadstat.pyx":713 + /* "pyreadstat/pyreadstat.pyx":719 * while len(df): * if limit and (offset >= limit): * break # <<<<<<<<<<<<<< @@ -7934,7 +10060,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ goto __pyx_L14_break; - /* "pyreadstat/pyreadstat.pyx":712 + /* "pyreadstat/pyreadstat.pyx":718 * df = [0] * while len(df): * if limit and (offset >= limit): # <<<<<<<<<<<<<< @@ -7943,26 +10069,26 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ } - /* "pyreadstat/pyreadstat.pyx":714 + /* "pyreadstat/pyreadstat.pyx":720 * if limit and (offset >= limit): * break * if multiprocess: # <<<<<<<<<<<<<< * df, meta = read_file_multiprocessing(read_function, file_path, num_processes=num_processes, * row_offset=offset, row_limit=chunksize, num_rows=num_rows, **kwargs) */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_multiprocess); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 714, __pyx_L1_error) - if (__pyx_t_3) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_multiprocess); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 720, __pyx_L1_error) + if (__pyx_t_7) { - /* "pyreadstat/pyreadstat.pyx":715 + /* "pyreadstat/pyreadstat.pyx":721 * break * if multiprocess: * df, meta = read_file_multiprocessing(read_function, file_path, num_processes=num_processes, # <<<<<<<<<<<<<< * row_offset=offset, row_limit=chunksize, num_rows=num_rows, **kwargs) * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_read_file_multiprocessing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_read_file_multiprocessing); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_read_function); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_read_function); @@ -7970,43 +10096,43 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __Pyx_INCREF(__pyx_cur_scope->__pyx_v_file_path); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_file_path); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_file_path); - __pyx_t_6 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_num_processes, __pyx_cur_scope->__pyx_v_num_processes) < 0) __PYX_ERR(0, 715, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_num_processes, __pyx_cur_scope->__pyx_v_num_processes) < 0) __PYX_ERR(0, 721, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":716 + /* "pyreadstat/pyreadstat.pyx":722 * if multiprocess: * df, meta = read_file_multiprocessing(read_function, file_path, num_processes=num_processes, * row_offset=offset, row_limit=chunksize, num_rows=num_rows, **kwargs) # <<<<<<<<<<<<<< * else: * df, meta = read_function(file_path, row_offset=offset, row_limit=chunksize, **kwargs) */ - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_row_offset, __pyx_cur_scope->__pyx_v_offset) < 0) __PYX_ERR(0, 715, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_row_limit, __pyx_cur_scope->__pyx_v_chunksize) < 0) __PYX_ERR(0, 715, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_num_rows, __pyx_cur_scope->__pyx_v_num_rows) < 0) __PYX_ERR(0, 715, __pyx_L1_error) - __pyx_t_2 = __pyx_t_6; - __pyx_t_6 = 0; - if (__Pyx_MergeKeywords(__pyx_t_2, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 716, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_row_offset, __pyx_cur_scope->__pyx_v_offset) < 0) __PYX_ERR(0, 721, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_row_limit, __pyx_cur_scope->__pyx_v_chunksize) < 0) __PYX_ERR(0, 721, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_num_rows, __pyx_cur_scope->__pyx_v_num_rows) < 0) __PYX_ERR(0, 721, __pyx_L1_error) + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + if (__Pyx_MergeKeywords(__pyx_t_2, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 722, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":715 + /* "pyreadstat/pyreadstat.pyx":721 * break * if multiprocess: * df, meta = read_file_multiprocessing(read_function, file_path, num_processes=num_processes, # <<<<<<<<<<<<<< * row_offset=offset, row_limit=chunksize, num_rows=num_rows, **kwargs) * else: */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { - PyObject* sequence = __pyx_t_6; + 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, 715, __pyx_L1_error) + __PYX_ERR(0, 721, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -8019,31 +10145,31 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L19_unpacking_failed; + __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 721, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); + index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L19_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed; + index = 1; __pyx_t_1 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < 0) __PYX_ERR(0, 715, __pyx_L1_error) - __pyx_t_7 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_4), 2) < 0) __PYX_ERR(0, 721, __pyx_L1_error) + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L20_unpacking_done; __pyx_L19_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 715, __pyx_L1_error) + __PYX_ERR(0, 721, __pyx_L1_error) __pyx_L20_unpacking_done:; } __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_df); @@ -8055,7 +10181,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":714 + /* "pyreadstat/pyreadstat.pyx":720 * if limit and (offset >= limit): * break * if multiprocess: # <<<<<<<<<<<<<< @@ -8065,7 +10191,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO goto __pyx_L18; } - /* "pyreadstat/pyreadstat.pyx":718 + /* "pyreadstat/pyreadstat.pyx":724 * row_offset=offset, row_limit=chunksize, num_rows=num_rows, **kwargs) * else: * df, meta = read_function(file_path, row_offset=offset, row_limit=chunksize, **kwargs) # <<<<<<<<<<<<<< @@ -8073,21 +10199,21 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO * yield df, meta */ /*else*/ { - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_file_path); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_file_path); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_file_path); - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_file_path); + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_row_offset, __pyx_cur_scope->__pyx_v_offset) < 0) __PYX_ERR(0, 718, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_row_limit, __pyx_cur_scope->__pyx_v_chunksize) < 0) __PYX_ERR(0, 718, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_row_offset, __pyx_cur_scope->__pyx_v_offset) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_row_limit, __pyx_cur_scope->__pyx_v_chunksize) < 0) __PYX_ERR(0, 724, __pyx_L1_error) __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; - if (__Pyx_MergeKeywords(__pyx_t_1, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 718, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_read_function, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error) + if (__Pyx_MergeKeywords(__pyx_t_1, __pyx_cur_scope->__pyx_v_kwargs) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_read_function, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; @@ -8095,44 +10221,44 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 718, __pyx_L1_error) + __PYX_ERR(0, 724, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + __pyx_t_5 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_5); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 718, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed; + __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); + index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L21_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L21_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < 0) __PYX_ERR(0, 718, __pyx_L1_error) - __pyx_t_7 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L21_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_4), 2) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L22_unpacking_done; __pyx_L21_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = NULL; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 718, __pyx_L1_error) + __PYX_ERR(0, 724, __pyx_L1_error) __pyx_L22_unpacking_done:; } __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_df); @@ -8140,31 +10266,31 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_meta); - __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_meta, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_meta, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; } __pyx_L18:; - /* "pyreadstat/pyreadstat.pyx":719 + /* "pyreadstat/pyreadstat.pyx":725 * else: * df, meta = read_function(file_path, row_offset=offset, row_limit=chunksize, **kwargs) * if len(df): # <<<<<<<<<<<<<< * yield df, meta * offset += chunksize */ - __pyx_t_8 = PyObject_Length(__pyx_cur_scope->__pyx_v_df); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 719, __pyx_L1_error) - __pyx_t_3 = (__pyx_t_8 != 0); - if (__pyx_t_3) { + __pyx_t_8 = PyObject_Length(__pyx_cur_scope->__pyx_v_df); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 725, __pyx_L1_error) + __pyx_t_7 = (__pyx_t_8 != 0); + if (__pyx_t_7) { - /* "pyreadstat/pyreadstat.pyx":720 + /* "pyreadstat/pyreadstat.pyx":726 * df, meta = read_function(file_path, row_offset=offset, row_limit=chunksize, **kwargs) * if len(df): * yield df, meta # <<<<<<<<<<<<<< * offset += chunksize * */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_df); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_df); @@ -8181,23 +10307,23 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L24_resume_from_yield:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 720, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 726, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":721 + /* "pyreadstat/pyreadstat.pyx":727 * if len(df): * yield df, meta * offset += chunksize # <<<<<<<<<<<<<< * * def read_file_multiprocessing(read_function, file_path, num_processes=None, num_rows=None, **kwargs): */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_chunksize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error) + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_offset, __pyx_cur_scope->__pyx_v_chunksize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_offset); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_offset, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":719 + /* "pyreadstat/pyreadstat.pyx":725 * else: * df, meta = read_function(file_path, row_offset=offset, row_limit=chunksize, **kwargs) * if len(df): # <<<<<<<<<<<<<< @@ -8209,7 +10335,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __pyx_L14_break:; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "pyreadstat/pyreadstat.pyx":642 + /* "pyreadstat/pyreadstat.pyx":648 * # convenience functions to read in chunks * * def read_file_in_chunks(read_function, file_path, chunksize=100000, offset=0, limit=0, # <<<<<<<<<<<<<< @@ -8223,8 +10349,8 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("read_file_in_chunks", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; @@ -8237,7 +10363,7 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":723 +/* "pyreadstat/pyreadstat.pyx":729 * offset += chunksize * * def read_file_multiprocessing(read_function, file_path, num_processes=None, num_rows=None, **kwargs): # <<<<<<<<<<<<<< @@ -8246,15 +10372,31 @@ static PyObject *__pyx_gb_10pyreadstat_10pyreadstat_18generator(__pyx_CoroutineO */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_19read_file_multiprocessing[] = "\n Reads a file in parallel using multiprocessing.\n For Xport, Por and some defective sav files where the number of rows in the dataset canot be obtained from the metadata, \n the parameter num_rows must be set to a number equal or larger than the number of rows in the dataset. That information must\n be obtained by the user before running this function.\n\n Parameters\n ----------\n read_function : pyreadstat function\n a pyreadstat reading function\n file_path : string\n path to the file to be read\n num_processes : integer, optional\n number of processes to spawn, by default the min 4 and the max cores on the computer\n num_rows: integer, optional\n number of rows in the dataset. Obligatory for files where the number of rows cannot be obtained from the medatata, such as xport, por and \n some defective sav files. The user must obtain this value by reading the file without multiprocessing first or any other means. A number\n larger than the actual number of rows will work as well. Discarded if the number of rows can be obtained from the metadata.\n kwargs : dict, optional\n any other keyword argument to pass to the read_function. \n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data\n metadata :\n object with metadata. Look at the documentation for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_20read_file_multiprocessing = {"read_file_multiprocessing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_19read_file_multiprocessing}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_19read_file_multiprocessing, "\n Reads a file in parallel using multiprocessing.\n For Xport, Por and some defective sav files where the number of rows in the dataset canot be obtained from the metadata, \n the parameter num_rows must be set to a number equal or larger than the number of rows in the dataset. That information must\n be obtained by the user before running this function.\n\n Parameters\n ----------\n read_function : pyreadstat function\n a pyreadstat reading function\n file_path : string\n path to the file to be read\n num_processes : integer, optional\n number of processes to spawn, by default the min 4 and the max cores on the computer\n num_rows: integer, optional\n number of rows in the dataset. Obligatory for files where the number of rows cannot be obtained from the medatata, such as xport, por and \n some defective sav files. The user must obtain this value by reading the file without multiprocessing first or any other means. A number\n larger than the actual number of rows will work as well. Discarded if the number of rows can be obtained from the metadata.\n kwargs : dict, optional\n any other keyword argument to pass to the read_function. \n\n Returns\n -------\n data_frame : pandas dataframe\n a pandas data frame with the data\n metadata :\n object with metadata. Look at the documentation for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_20read_file_multiprocessing = {"read_file_multiprocessing", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_19read_file_multiprocessing}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_read_function = 0; PyObject *__pyx_v_file_path = 0; PyObject *__pyx_v_num_processes = 0; PyObject *__pyx_v_num_rows = 0; PyObject *__pyx_v_kwargs = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8264,60 +10406,64 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing( __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read_function,&__pyx_n_s_file_path,&__pyx_n_s_num_processes,&__pyx_n_s_num_rows,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_read_function,&__pyx_n_s_file_path,&__pyx_n_s_num_processes,&__pyx_n_s_num_rows,0}; PyObject* values[4] = {0,0,0,0}; - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)Py_None); - if (unlikely(__pyx_kwds)) { + values[2] = ((PyObject *)((PyObject *)Py_None)); + values[3] = ((PyObject *)((PyObject *)Py_None)); + if (__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); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read_function)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_read_function)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 729, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_path)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 729, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("read_file_multiprocessing", 0, 2, 4, 1); __PYX_ERR(0, 723, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_file_multiprocessing", 0, 2, 4, 1); __PYX_ERR(0, 729, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_processes); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_num_processes); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 729, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_rows); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_num_rows); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 729, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "read_file_multiprocessing") < 0)) __PYX_ERR(0, 723, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "read_file_multiprocessing") < 0)) __PYX_ERR(0, 729, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + switch (__pyx_nargs) { + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -8329,7 +10475,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_file_multiprocessing", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 723, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("read_file_multiprocessing", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 729, __pyx_L3_error) __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("pyreadstat.pyreadstat.read_file_multiprocessing", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -8339,7 +10485,7 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_20read_file_multiprocessing( __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing(__pyx_self, __pyx_v_read_function, __pyx_v_file_path, __pyx_v_num_processes, __pyx_v_num_rows, __pyx_v_kwargs); /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_DECREF(__pyx_v_kwargs); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8372,29 +10518,31 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( int __pyx_t_5; int __pyx_t_6; long __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *(*__pyx_t_9)(PyObject *); - PyObject *__pyx_t_10 = NULL; - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + double __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_13; + PyObject *(*__pyx_t_14)(PyObject *); PyObject *__pyx_t_15 = NULL; - PyObject *__pyx_t_16 = NULL; + int __pyx_t_16; PyObject *__pyx_t_17 = NULL; - int __pyx_t_18; - int __pyx_t_19; - char const *__pyx_t_20; - PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + int __pyx_t_20; + char const *__pyx_t_21; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + int __pyx_t_25; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("read_file_multiprocessing", 0); __Pyx_INCREF(__pyx_v_num_processes); - /* "pyreadstat/pyreadstat.pyx":753 + /* "pyreadstat/pyreadstat.pyx":759 * """ * * if read_function in (read_sas7bcat,): # <<<<<<<<<<<<<< @@ -8403,30 +10551,30 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ __Pyx_INCREF(__pyx_v_read_function); __pyx_t_1 = __pyx_v_read_function; - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_sas7bcat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_sas7bcat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 753, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 759, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 753, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 759, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = (__pyx_t_4 != 0); + __pyx_t_5 = __pyx_t_4; if (unlikely(__pyx_t_5)) { - /* "pyreadstat/pyreadstat.pyx":754 + /* "pyreadstat/pyreadstat.pyx":760 * * if read_function in (read_sas7bcat,): * raise Exception("read_sas7bcat is not supported") # <<<<<<<<<<<<<< * * if read_function in (read_xport, read_por) and num_rows is None: */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __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, 754, __pyx_L1_error) + __PYX_ERR(0, 760, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":753 + /* "pyreadstat/pyreadstat.pyx":759 * """ * * if read_function in (read_sas7bcat,): # <<<<<<<<<<<<<< @@ -8435,7 +10583,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ } - /* "pyreadstat/pyreadstat.pyx":756 + /* "pyreadstat/pyreadstat.pyx":762 * raise Exception("read_sas7bcat is not supported") * * if read_function in (read_xport, read_por) and num_rows is None: # <<<<<<<<<<<<<< @@ -8444,52 +10592,51 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ __Pyx_INCREF(__pyx_v_read_function); __pyx_t_1 = __pyx_v_read_function; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_read_xport); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_read_xport); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_4 = __pyx_t_6; goto __pyx_L7_bool_binop_done; } - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_por); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_por); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 756, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 762, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __pyx_t_6; __pyx_L7_bool_binop_done:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = (__pyx_t_4 != 0); + __pyx_t_6 = __pyx_t_4; if (__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L5_bool_binop_done; } __pyx_t_6 = (__pyx_v_num_rows == Py_None); - __pyx_t_4 = (__pyx_t_6 != 0); - __pyx_t_5 = __pyx_t_4; + __pyx_t_5 = __pyx_t_6; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_5)) { - /* "pyreadstat/pyreadstat.pyx":757 + /* "pyreadstat/pyreadstat.pyx":763 * * if read_function in (read_xport, read_por) and num_rows is None: * raise Exception("num_rows must be specified for read_xport and read_por to be a number equal or larger than the number of rows in the dataset.") # <<<<<<<<<<<<<< * * if not num_processes: */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 757, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __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, 757, __pyx_L1_error) + __PYX_ERR(0, 763, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":756 + /* "pyreadstat/pyreadstat.pyx":762 * raise Exception("read_sas7bcat is not supported") * * if read_function in (read_xport, read_por) and num_rows is None: # <<<<<<<<<<<<<< @@ -8498,18 +10645,18 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ } - /* "pyreadstat/pyreadstat.pyx":759 + /* "pyreadstat/pyreadstat.pyx":765 * raise Exception("num_rows must be specified for read_xport and read_por to be a number equal or larger than the number of rows in the dataset.") * * if not num_processes: # <<<<<<<<<<<<<< * # let's be conservative with the number of workers * num_processes = min(mp.cpu_count(), 4) */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_num_processes); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 759, __pyx_L1_error) - __pyx_t_4 = ((!__pyx_t_5) != 0); - if (__pyx_t_4) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_num_processes); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 765, __pyx_L1_error) + __pyx_t_6 = (!__pyx_t_5); + if (__pyx_t_6) { - /* "pyreadstat/pyreadstat.pyx":761 + /* "pyreadstat/pyreadstat.pyx":767 * if not num_processes: * # let's be conservative with the number of workers * num_processes = min(mp.cpu_count(), 4) # <<<<<<<<<<<<<< @@ -8517,12 +10664,13 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( * row_offset = kwargs.pop("row_offset", 0) */ __pyx_t_7 = 4; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_mp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_mp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; + __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { @@ -8530,24 +10678,28 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 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(0, 761, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error) + { + PyObject *__pyx_callargs[1] = {__pyx_t_3, }; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 761, __pyx_L1_error) + __pyx_t_9 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 761, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_4) { - __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 761, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (__pyx_t_6) { + __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 767, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = __pyx_t_9; + __pyx_t_9 = 0; } else { __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; @@ -8559,7 +10711,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_DECREF_SET(__pyx_v_num_processes, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":759 + /* "pyreadstat/pyreadstat.pyx":765 * raise Exception("num_rows must be specified for read_xport and read_por to be a number equal or larger than the number of rows in the dataset.") * * if not num_processes: # <<<<<<<<<<<<<< @@ -8568,74 +10720,75 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ } - /* "pyreadstat/pyreadstat.pyx":762 + /* "pyreadstat/pyreadstat.pyx":768 * # let's be conservative with the number of workers * num_processes = min(mp.cpu_count(), 4) * _ = kwargs.pop('metadataonly', None) # <<<<<<<<<<<<<< * row_offset = kwargs.pop("row_offset", 0) * row_limit = kwargs.pop("row_limit", float('inf')) */ - __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_metadataonly, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_metadataonly, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__ = __pyx_t_1; __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":763 + /* "pyreadstat/pyreadstat.pyx":769 * num_processes = min(mp.cpu_count(), 4) * _ = kwargs.pop('metadataonly', None) * row_offset = kwargs.pop("row_offset", 0) # <<<<<<<<<<<<<< * row_limit = kwargs.pop("row_limit", float('inf')) * _, meta = read_function(file_path, metadataonly=True, **kwargs) */ - __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_row_offset, __pyx_int_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_row_offset, __pyx_int_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_row_offset = __pyx_t_1; __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":764 + /* "pyreadstat/pyreadstat.pyx":770 * _ = kwargs.pop('metadataonly', None) * row_offset = kwargs.pop("row_offset", 0) * row_limit = kwargs.pop("row_limit", float('inf')) # <<<<<<<<<<<<<< * _, meta = read_function(file_path, metadataonly=True, **kwargs) * numrows = meta.number_rows */ - __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_n_s_inf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyString_AsDouble(__pyx_n_s_inf); if (unlikely(__pyx_t_10 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 770, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_row_limit, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_Pop(__pyx_v_kwargs, __pyx_n_s_row_limit, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_row_limit = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":765 + /* "pyreadstat/pyreadstat.pyx":771 * row_offset = kwargs.pop("row_offset", 0) * row_limit = kwargs.pop("row_limit", float('inf')) * _, meta = read_function(file_path, metadataonly=True, **kwargs) # <<<<<<<<<<<<<< * numrows = meta.number_rows * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_file_path); __Pyx_GIVEREF(__pyx_v_file_path); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_file_path); - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_metadataonly, Py_True) < 0) __PYX_ERR(0, 765, __pyx_L1_error) - __pyx_t_1 = __pyx_t_8; - __pyx_t_8 = 0; - if (__Pyx_MergeKeywords(__pyx_t_1, __pyx_v_kwargs) < 0) __PYX_ERR(0, 765, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_v_read_function, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 765, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_metadataonly, Py_True) < 0) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_t_1 = __pyx_t_9; + __pyx_t_9 = 0; + if (__Pyx_MergeKeywords(__pyx_t_1, __pyx_v_kwargs) < 0) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_read_function, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) { - PyObject* sequence = __pyx_t_8; + 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, 765, __pyx_L1_error) + __PYX_ERR(0, 771, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -8648,31 +10801,31 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 765, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L10_unpacking_failed; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); + index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed; + index = 1; __pyx_t_2 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L10_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < 0) __PYX_ERR(0, 765, __pyx_L1_error) - __pyx_t_9 = NULL; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_3), 2) < 0) __PYX_ERR(0, 771, __pyx_L1_error) + __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L11_unpacking_done; __pyx_L10_unpacking_failed:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = NULL; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 765, __pyx_L1_error) + __PYX_ERR(0, 771, __pyx_L1_error) __pyx_L11_unpacking_done:; } __Pyx_DECREF_SET(__pyx_v__, __pyx_t_1); @@ -8680,54 +10833,52 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __pyx_v_meta = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":766 + /* "pyreadstat/pyreadstat.pyx":772 * row_limit = kwargs.pop("row_limit", float('inf')) * _, meta = read_function(file_path, metadataonly=True, **kwargs) * numrows = meta.number_rows # <<<<<<<<<<<<<< * * if numrows is None: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_meta, __pyx_n_s_number_rows); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 766, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_v_numrows = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_meta, __pyx_n_s_number_rows); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_v_numrows = __pyx_t_9; + __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":768 + /* "pyreadstat/pyreadstat.pyx":774 * numrows = meta.number_rows * * if numrows is None: # <<<<<<<<<<<<<< * if num_rows is None: * raise Exception("The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data") */ - __pyx_t_4 = (__pyx_v_numrows == Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { + __pyx_t_6 = (__pyx_v_numrows == Py_None); + if (__pyx_t_6) { - /* "pyreadstat/pyreadstat.pyx":769 + /* "pyreadstat/pyreadstat.pyx":775 * * if numrows is None: * if num_rows is None: # <<<<<<<<<<<<<< * raise Exception("The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data") * numrows = num_rows */ - __pyx_t_5 = (__pyx_v_num_rows == Py_None); - __pyx_t_4 = (__pyx_t_5 != 0); - if (unlikely(__pyx_t_4)) { + __pyx_t_6 = (__pyx_v_num_rows == Py_None); + if (unlikely(__pyx_t_6)) { - /* "pyreadstat/pyreadstat.pyx":770 + /* "pyreadstat/pyreadstat.pyx":776 * if numrows is None: * if num_rows is None: * raise Exception("The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data") # <<<<<<<<<<<<<< * numrows = num_rows * elif numrows == 0: */ - __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 770, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_Raise(__pyx_t_8, 0, 0, 0); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(0, 770, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 776, __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, 776, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":769 + /* "pyreadstat/pyreadstat.pyx":775 * * if numrows is None: * if num_rows is None: # <<<<<<<<<<<<<< @@ -8736,7 +10887,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ } - /* "pyreadstat/pyreadstat.pyx":771 + /* "pyreadstat/pyreadstat.pyx":777 * if num_rows is None: * raise Exception("The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data") * numrows = num_rows # <<<<<<<<<<<<<< @@ -8746,7 +10897,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_v_num_rows); __Pyx_DECREF_SET(__pyx_v_numrows, __pyx_v_num_rows); - /* "pyreadstat/pyreadstat.pyx":768 + /* "pyreadstat/pyreadstat.pyx":774 * numrows = meta.number_rows * * if numrows is None: # <<<<<<<<<<<<<< @@ -8756,36 +10907,33 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( goto __pyx_L12; } - /* "pyreadstat/pyreadstat.pyx":772 + /* "pyreadstat/pyreadstat.pyx":778 * raise Exception("The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data") * numrows = num_rows * elif numrows == 0: # <<<<<<<<<<<<<< * final, meta = read_function(file_path, **kwargs) * */ - __pyx_t_8 = __Pyx_PyInt_EqObjC(__pyx_v_numrows, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 772, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 772, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_4) { + __pyx_t_6 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_numrows, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 778, __pyx_L1_error) + if (__pyx_t_6) { - /* "pyreadstat/pyreadstat.pyx":773 + /* "pyreadstat/pyreadstat.pyx":779 * numrows = num_rows * elif numrows == 0: * final, meta = read_function(file_path, **kwargs) # <<<<<<<<<<<<<< * * numrows = min(max(numrows - row_offset, 0), row_limit) */ - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 773, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_file_path); __Pyx_GIVEREF(__pyx_v_file_path); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_file_path); - __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_file_path); + __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_read_function, __pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_read_function, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 779, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; @@ -8793,52 +10941,52 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 773, __pyx_L1_error) + __PYX_ERR(0, 779, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 773, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L14_unpacking_failed; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); + index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L14_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_8)) goto __pyx_L14_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < 0) __PYX_ERR(0, 773, __pyx_L1_error) - __pyx_t_9 = NULL; + index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_9)) goto __pyx_L14_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_3), 2) < 0) __PYX_ERR(0, 779, __pyx_L1_error) + __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L15_unpacking_done; __pyx_L14_unpacking_failed:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = NULL; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 773, __pyx_L1_error) + __PYX_ERR(0, 779, __pyx_L1_error) __pyx_L15_unpacking_done:; } __pyx_v_final = __pyx_t_2; __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_meta, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_DECREF_SET(__pyx_v_meta, __pyx_t_9); + __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":772 + /* "pyreadstat/pyreadstat.pyx":778 * raise Exception("The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data") * numrows = num_rows * elif numrows == 0: # <<<<<<<<<<<<<< @@ -8848,7 +10996,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( } __pyx_L12:; - /* "pyreadstat/pyreadstat.pyx":775 + /* "pyreadstat/pyreadstat.pyx":781 * final, meta = read_function(file_path, **kwargs) * * numrows = min(max(numrows - row_offset, 0), row_limit) # <<<<<<<<<<<<<< @@ -8858,38 +11006,38 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_v_row_limit); __pyx_t_1 = __pyx_v_row_limit; __pyx_t_7 = 0; - __pyx_t_8 = PyNumber_Subtract(__pyx_v_numrows, __pyx_v_row_offset); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error) + __pyx_t_9 = PyNumber_Subtract(__pyx_v_numrows, __pyx_v_row_offset); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_t_8, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 775, __pyx_L1_error) + __pyx_t_12 = PyObject_RichCompare(__pyx_t_3, __pyx_t_9, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 781, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_4) { - __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_6) { + __pyx_t_12 = __Pyx_PyInt_From_long(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __pyx_t_12; + __pyx_t_12 = 0; } else { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_2 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_9); + __pyx_t_2 = __pyx_t_9; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_INCREF(__pyx_t_2); - __pyx_t_8 = __pyx_t_2; + __pyx_t_9 = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_10 = PyObject_RichCompare(__pyx_t_1, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 775, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 775, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (__pyx_t_4) { + __pyx_t_12 = PyObject_RichCompare(__pyx_t_1, __pyx_t_9, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 781, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 781, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; } else { - __Pyx_INCREF(__pyx_t_8); - __pyx_t_2 = __pyx_t_8; + __Pyx_INCREF(__pyx_t_9); + __pyx_t_2 = __pyx_t_9; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); @@ -8897,52 +11045,52 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_DECREF_SET(__pyx_v_numrows, __pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":776 + /* "pyreadstat/pyreadstat.pyx":782 * * numrows = min(max(numrows - row_offset, 0), row_limit) * divs = [numrows // num_processes + (1 if x < numrows % num_processes else 0) for x in range (num_processes)] # <<<<<<<<<<<<<< * offsets = list() * prev_offset = row_offset */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_processes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_processes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_8 = __pyx_t_2; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; - __pyx_t_12 = NULL; + __pyx_t_9 = __pyx_t_2; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0; + __pyx_t_14 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_13 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_14 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 782, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_8))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; + if (likely(!__pyx_t_14)) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_2); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_2); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 782, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_2); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_2); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 782, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { - __pyx_t_2 = __pyx_t_12(__pyx_t_8); + __pyx_t_2 = __pyx_t_14(__pyx_t_9); 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, 776, __pyx_L1_error) + else __PYX_ERR(0, 782, __pyx_L1_error) } break; } @@ -8950,45 +11098,45 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( } __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_FloorDivide(__pyx_v_numrows, __pyx_v_num_processes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_2 = PyNumber_FloorDivide(__pyx_v_numrows, __pyx_v_num_processes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(__pyx_v_numrows, __pyx_v_num_processes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_3 = PyNumber_Remainder(__pyx_v_numrows, __pyx_v_num_processes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = PyObject_RichCompare(__pyx_v_x, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_15 = PyObject_RichCompare(__pyx_v_x, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 782, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (__pyx_t_4) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_6) { __Pyx_INCREF(__pyx_int_1); - __pyx_t_10 = __pyx_int_1; + __pyx_t_12 = __pyx_int_1; } else { __Pyx_INCREF(__pyx_int_0); - __pyx_t_10 = __pyx_int_0; + __pyx_t_12 = __pyx_int_0; } - __pyx_t_13 = PyNumber_Add(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = PyNumber_Add(__pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_13))) __PYX_ERR(0, 776, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_15))) __PYX_ERR(0, 782, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_divs = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":777 + /* "pyreadstat/pyreadstat.pyx":783 * numrows = min(max(numrows - row_offset, 0), row_limit) * divs = [numrows // num_processes + (1 if x < numrows % num_processes else 0) for x in range (num_processes)] * offsets = list() # <<<<<<<<<<<<<< * prev_offset = row_offset * prev_div = 0 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 777, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 783, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_offsets = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":778 + /* "pyreadstat/pyreadstat.pyx":784 * divs = [numrows // num_processes + (1 if x < numrows % num_processes else 0) for x in range (num_processes)] * offsets = list() * prev_offset = row_offset # <<<<<<<<<<<<<< @@ -8998,7 +11146,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_v_row_offset); __pyx_v_prev_offset = __pyx_v_row_offset; - /* "pyreadstat/pyreadstat.pyx":779 + /* "pyreadstat/pyreadstat.pyx":785 * offsets = list() * prev_offset = row_offset * prev_div = 0 # <<<<<<<<<<<<<< @@ -9008,7 +11156,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_int_0); __pyx_v_prev_div = __pyx_int_0; - /* "pyreadstat/pyreadstat.pyx":780 + /* "pyreadstat/pyreadstat.pyx":786 * prev_offset = row_offset * prev_div = 0 * for indx, div in enumerate(divs): # <<<<<<<<<<<<<< @@ -9017,38 +11165,38 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ __Pyx_INCREF(__pyx_int_0); __pyx_t_1 = __pyx_int_0; - __pyx_t_8 = __pyx_v_divs; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; + __pyx_t_9 = __pyx_v_divs; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0; for (;;) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_13); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 780, __pyx_L1_error) + __pyx_t_15 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); #endif - __Pyx_XDECREF_SET(__pyx_v_div, __pyx_t_13); - __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_div, __pyx_t_15); + __pyx_t_15 = 0; __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_indx, __pyx_t_1); - __pyx_t_13 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 780, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_13; - __pyx_t_13 = 0; + __pyx_t_1 = __pyx_t_15; + __pyx_t_15 = 0; - /* "pyreadstat/pyreadstat.pyx":781 + /* "pyreadstat/pyreadstat.pyx":787 * prev_div = 0 * for indx, div in enumerate(divs): * offset = prev_offset + prev_div # <<<<<<<<<<<<<< * prev_offset = offset * prev_div = div */ - __pyx_t_13 = PyNumber_Add(__pyx_v_prev_offset, __pyx_v_prev_div); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 781, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_t_13); - __pyx_t_13 = 0; + __pyx_t_15 = PyNumber_Add(__pyx_v_prev_offset, __pyx_v_prev_div); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 787, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_t_15); + __pyx_t_15 = 0; - /* "pyreadstat/pyreadstat.pyx":782 + /* "pyreadstat/pyreadstat.pyx":788 * for indx, div in enumerate(divs): * offset = prev_offset + prev_div * prev_offset = offset # <<<<<<<<<<<<<< @@ -9058,7 +11206,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_v_offset); __Pyx_DECREF_SET(__pyx_v_prev_offset, __pyx_v_offset); - /* "pyreadstat/pyreadstat.pyx":783 + /* "pyreadstat/pyreadstat.pyx":789 * offset = prev_offset + prev_div * prev_offset = offset * prev_div = div # <<<<<<<<<<<<<< @@ -9068,25 +11216,25 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_v_div); __Pyx_DECREF_SET(__pyx_v_prev_div, __pyx_v_div); - /* "pyreadstat/pyreadstat.pyx":784 + /* "pyreadstat/pyreadstat.pyx":790 * prev_offset = offset * prev_div = div * offsets.append((offset, div)) # <<<<<<<<<<<<<< * jobs = [(read_function, file_path, offset, chunksize, kwargs) for offset, chunksize in offsets] * pool = mp.Pool(processes=num_processes) */ - __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_v_offset); __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_offset); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_offset); __Pyx_INCREF(__pyx_v_div); __Pyx_GIVEREF(__pyx_v_div); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_div); - __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_offsets, __pyx_t_13); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 784, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_div); + __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_offsets, __pyx_t_15); if (unlikely(__pyx_t_16 == ((int)-1))) __PYX_ERR(0, 790, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "pyreadstat/pyreadstat.pyx":780 + /* "pyreadstat/pyreadstat.pyx":786 * prev_offset = row_offset * prev_div = 0 * for indx, div in enumerate(divs): # <<<<<<<<<<<<<< @@ -9094,124 +11242,124 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( * prev_offset = offset */ } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":785 + /* "pyreadstat/pyreadstat.pyx":791 * prev_div = div * offsets.append((offset, div)) * jobs = [(read_function, file_path, offset, chunksize, kwargs) for offset, chunksize in offsets] # <<<<<<<<<<<<<< * pool = mp.Pool(processes=num_processes) * try: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __pyx_v_offsets; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; + __pyx_t_9 = __pyx_v_offsets; __Pyx_INCREF(__pyx_t_9); __pyx_t_13 = 0; for (;;) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_13); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_15 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 791, __pyx_L1_error) #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 785, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = PySequence_ITEM(__pyx_t_9, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 791, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); #endif - if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) { - PyObject* sequence = __pyx_t_13; + if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) { + PyObject* sequence = __pyx_t_15; 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, 785, __pyx_L1_error) + __PYX_ERR(0, 791, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); } else { - __pyx_t_10 = PyList_GET_ITEM(sequence, 0); + __pyx_t_12 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_2); #else - __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 785, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 791, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } else { Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 785, __pyx_L1_error) + __pyx_t_3 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_10 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_10)) goto __pyx_L22_unpacking_failed; - __Pyx_GOTREF(__pyx_t_10); - index = 1; __pyx_t_2 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L22_unpacking_failed; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); + index = 0; __pyx_t_12 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_12)) goto __pyx_L24_unpacking_failed; + __Pyx_GOTREF(__pyx_t_12); + index = 1; __pyx_t_2 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L24_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_3), 2) < 0) __PYX_ERR(0, 785, __pyx_L1_error) - __pyx_t_9 = NULL; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_3), 2) < 0) __PYX_ERR(0, 791, __pyx_L1_error) + __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L23_unpacking_done; - __pyx_L22_unpacking_failed:; + goto __pyx_L25_unpacking_done; + __pyx_L24_unpacking_failed:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = NULL; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 785, __pyx_L1_error) - __pyx_L23_unpacking_done:; + __PYX_ERR(0, 791, __pyx_L1_error) + __pyx_L25_unpacking_done:; } - __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_t_10); - __pyx_t_10 = 0; + __Pyx_XDECREF_SET(__pyx_v_offset, __pyx_t_12); + __pyx_t_12 = 0; __Pyx_XDECREF_SET(__pyx_v_chunksize, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = PyTuple_New(5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 785, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_15 = PyTuple_New(5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 791, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(__pyx_v_read_function); __Pyx_GIVEREF(__pyx_v_read_function); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_read_function); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_read_function); __Pyx_INCREF(__pyx_v_file_path); __Pyx_GIVEREF(__pyx_v_file_path); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_file_path); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_file_path); __Pyx_INCREF(__pyx_v_offset); __Pyx_GIVEREF(__pyx_v_offset); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_offset); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_offset); __Pyx_INCREF(__pyx_v_chunksize); __Pyx_GIVEREF(__pyx_v_chunksize); - PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_v_chunksize); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_chunksize); __Pyx_INCREF(__pyx_v_kwargs); __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_v_kwargs); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_13))) __PYX_ERR(0, 785, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_v_kwargs); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_15))) __PYX_ERR(0, 791, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_jobs = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "pyreadstat/pyreadstat.pyx":786 + /* "pyreadstat/pyreadstat.pyx":792 * offsets.append((offset, div)) * jobs = [(read_function, file_path, offset, chunksize, kwargs) for offset, chunksize in offsets] * pool = mp.Pool(processes=num_processes) # <<<<<<<<<<<<<< * try: * chunks = pool.map(worker, jobs) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 792, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Pool); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 786, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Pool); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 792, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_processes, __pyx_v_num_processes) < 0) __PYX_ERR(0, 786, __pyx_L1_error) - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 786, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_processes, __pyx_v_num_processes) < 0) __PYX_ERR(0, 792, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_pool = __pyx_t_13; - __pyx_t_13 = 0; + __pyx_v_pool = __pyx_t_15; + __pyx_t_15 = 0; - /* "pyreadstat/pyreadstat.pyx":787 + /* "pyreadstat/pyreadstat.pyx":793 * jobs = [(read_function, file_path, offset, chunksize, kwargs) for offset, chunksize in offsets] * pool = mp.Pool(processes=num_processes) * try: # <<<<<<<<<<<<<< @@ -9222,25 +11370,25 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( { __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_ExceptionSave(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); __Pyx_XGOTREF(__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_18); + __Pyx_XGOTREF(__pyx_t_19); /*try:*/ { - /* "pyreadstat/pyreadstat.pyx":788 + /* "pyreadstat/pyreadstat.pyx":794 * pool = mp.Pool(processes=num_processes) * try: * chunks = pool.map(worker, jobs) # <<<<<<<<<<<<<< * except: * raise */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __pyx_L27_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L30_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_worker); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 788, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_worker); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 794, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_9); __pyx_t_2 = NULL; - __pyx_t_18 = 0; + __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_2)) { @@ -9248,48 +11396,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_18 = 1; + __pyx_t_8 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_8, __pyx_v_jobs}; - __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 788, __pyx_L27_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_8, __pyx_v_jobs}; - __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 788, __pyx_L27_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif { - __pyx_t_10 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 788, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_18, __pyx_t_8); - __Pyx_INCREF(__pyx_v_jobs); - __Pyx_GIVEREF(__pyx_v_jobs); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_18, __pyx_v_jobs); - __pyx_t_8 = 0; - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 788, __pyx_L27_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_9, __pyx_v_jobs}; + __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 794, __pyx_L30_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_chunks = __pyx_t_13; - __pyx_t_13 = 0; + __pyx_v_chunks = __pyx_t_15; + __pyx_t_15 = 0; - /* "pyreadstat/pyreadstat.pyx":787 + /* "pyreadstat/pyreadstat.pyx":793 * jobs = [(read_function, file_path, offset, chunksize, kwargs) for offset, chunksize in offsets] * pool = mp.Pool(processes=num_processes) * try: # <<<<<<<<<<<<<< @@ -9297,19 +11419,19 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( * except: */ } - __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_L32_try_end; - __pyx_L27_error:; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + goto __pyx_L35_try_end; + __pyx_L30_error:; __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_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":789 + /* "pyreadstat/pyreadstat.pyx":795 * try: * chunks = pool.map(worker, jobs) * except: # <<<<<<<<<<<<<< @@ -9318,44 +11440,44 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ /*except:*/ { __Pyx_AddTraceback("pyreadstat.pyreadstat.read_file_multiprocessing", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_1, &__pyx_t_10) < 0) __PYX_ERR(0, 789, __pyx_L29_except_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_10); + if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_1, &__pyx_t_9) < 0) __PYX_ERR(0, 795, __pyx_L32_except_error) + __Pyx_XGOTREF(__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_9); - /* "pyreadstat/pyreadstat.pyx":790 + /* "pyreadstat/pyreadstat.pyx":796 * chunks = pool.map(worker, jobs) * except: * raise # <<<<<<<<<<<<<< * finally: * pool.close() */ - __Pyx_GIVEREF(__pyx_t_13); + __Pyx_GIVEREF(__pyx_t_15); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ErrRestoreWithState(__pyx_t_13, __pyx_t_1, __pyx_t_10); - __pyx_t_13 = 0; __pyx_t_1 = 0; __pyx_t_10 = 0; - __PYX_ERR(0, 790, __pyx_L29_except_error) + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ErrRestoreWithState(__pyx_t_15, __pyx_t_1, __pyx_t_9); + __pyx_t_15 = 0; __pyx_t_1 = 0; __pyx_t_9 = 0; + __PYX_ERR(0, 796, __pyx_L32_except_error) } - __pyx_L29_except_error:; - /* "pyreadstat/pyreadstat.pyx":787 + /* "pyreadstat/pyreadstat.pyx":793 * jobs = [(read_function, file_path, offset, chunksize, kwargs) for offset, chunksize in offsets] * pool = mp.Pool(processes=num_processes) * try: # <<<<<<<<<<<<<< * chunks = pool.map(worker, jobs) * except: */ - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_XGIVEREF(__pyx_t_16); + __pyx_L32_except_error:; __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); - goto __pyx_L25_error; - __pyx_L32_try_end:; + __Pyx_XGIVEREF(__pyx_t_18); + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); + goto __pyx_L28_error; + __pyx_L35_try_end:; } } - /* "pyreadstat/pyreadstat.pyx":792 + /* "pyreadstat/pyreadstat.pyx":798 * raise * finally: * pool.close() # <<<<<<<<<<<<<< @@ -9364,125 +11486,135 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ /*finally:*/ { /*normal exit:*/{ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 792, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = NULL; + __pyx_t_15 = NULL; + __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_13)) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; } } - __pyx_t_10 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 792, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L26; + { + PyObject *__pyx_callargs[1] = {__pyx_t_15, }; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 798, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L29; } - __pyx_L25_error:; + __pyx_L28_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 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_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_17, &__pyx_t_16, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_16, &__pyx_t_15); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 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_18, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_18, &__pyx_t_17); + __Pyx_XGOTREF(__pyx_t_19); + __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_17); - __Pyx_XGOTREF(__pyx_t_16); - __Pyx_XGOTREF(__pyx_t_15); - __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); - __pyx_t_18 = __pyx_lineno; __pyx_t_19 = __pyx_clineno; __pyx_t_20 = __pyx_filename; + __Pyx_XGOTREF(__pyx_t_24); + __pyx_t_8 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename; { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 792, __pyx_L36_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pool, __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L39_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = NULL; + __pyx_t_15 = NULL; + __pyx_t_25 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_13)) { + __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_25 = 1; } } - __pyx_t_10 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 792, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + { + PyObject *__pyx_callargs[1] = {__pyx_t_15, }; + __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_25, 0+__pyx_t_25); + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 798, __pyx_L39_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } 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_24); + __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24); } + __Pyx_XGIVEREF(__pyx_t_19); + __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_17); - __Pyx_XGIVEREF(__pyx_t_16); - __Pyx_XGIVEREF(__pyx_t_15); - __Pyx_ErrRestore(__pyx_t_17, __pyx_t_16, __pyx_t_15); - __pyx_t_17 = 0; __pyx_t_16 = 0; __pyx_t_15 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; - __pyx_lineno = __pyx_t_18; __pyx_clineno = __pyx_t_19; __pyx_filename = __pyx_t_20; + __Pyx_ErrRestore(__pyx_t_19, __pyx_t_18, __pyx_t_17); + __pyx_t_19 = 0; __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; + __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21; goto __pyx_L1_error; - __pyx_L36_error:; + __pyx_L39_error:; 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_24); + __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24); } + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; __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; - __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; + __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; goto __pyx_L1_error; } - __pyx_L26:; + __pyx_L29:; } - /* "pyreadstat/pyreadstat.pyx":793 + /* "pyreadstat/pyreadstat.pyx":799 * finally: * pool.close() * final = pd.concat(chunks, axis=0, ignore_index=True) # <<<<<<<<<<<<<< * return final, meta * */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pd); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 793, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_concat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 793, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_pd); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_concat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 793, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_chunks); __Pyx_GIVEREF(__pyx_v_chunks); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_chunks); - __pyx_t_13 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 793, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 793, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_ignore_index, Py_True) < 0) __PYX_ERR(0, 793, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 793, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_chunks); + __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 799, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_ignore_index, Py_True) < 0) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_XDECREF_SET(__pyx_v_final, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_XDECREF_SET(__pyx_v_final, __pyx_t_2); + __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":794 + /* "pyreadstat/pyreadstat.pyx":800 * pool.close() * final = pd.concat(chunks, axis=0, ignore_index=True) * return final, meta # <<<<<<<<<<<<<< @@ -9490,19 +11622,19 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 794, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_final); __Pyx_GIVEREF(__pyx_v_final); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_final); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_final); __Pyx_INCREF(__pyx_v_meta); __Pyx_GIVEREF(__pyx_v_meta); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_meta); - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_meta); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "pyreadstat/pyreadstat.pyx":723 + /* "pyreadstat/pyreadstat.pyx":729 * offset += chunksize * * def read_file_multiprocessing(read_function, file_path, num_processes=None, num_rows=None, **kwargs): # <<<<<<<<<<<<<< @@ -9515,9 +11647,9 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_15); __Pyx_AddTraceback("pyreadstat.pyreadstat.read_file_multiprocessing", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -9545,7 +11677,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":799 +/* "pyreadstat/pyreadstat.pyx":805 * # Write API * * def write_sav(df, dst_path, str file_label="", object column_labels=None, compress=False, row_compress=False, str note=None, # <<<<<<<<<<<<<< @@ -9554,10 +11686,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_19read_file_multiprocessing( */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_22write_sav(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_21write_sav[] = "\n Writes a pandas data frame to a SPSS sav or zsav file.\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to sav or zsav\n dst_path : str or pathlib.Path\n full path to the result sav or zsav file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n compress : boolean, optional\n if true a zsav will be written, by default False, a sav is written\n row_compress : boolean, optional\n if true it applies row compression, by default False, compress and row_compress cannot be both true at the same time\n note : str, optional\n a note to add to the file\n variable_value_labels : dict, optional\n value labels, a dictionary with key variable name and value a dictionary with key values and\n values labels. Variable names must match variable names in the dataframe otherwise will be\n ignored. Value types must match the type of the column in the dataframe.\n missing_ranges : dict, optional\n user defined missing values. Must be a dictionary with keys as variable names matching variable\n names in the dataframe. The values must be a list. Each element in that list can either be\n either a discrete numeric or string value (max 3 per variable) or a dictionary with keys 'hi' and 'lo' to\n indicate the upper and lower range for numeric values (max 1 range value + 1 discrete value per\n variable). hi and lo may also be the same value in which case it will be interpreted as a discrete\n missing value.""\n For this to be effective, values in the dataframe must be the same as reported here and not NaN.\n variable_display_width : dict, optional\n set the display width for variables. Must be a dictonary with keys being variable names and\n values being integers.\n variable_measure: dict, optional\n sets the measure type for a variable. Must be a dictionary with keys being variable names and\n values being strings one of \"nominal\", \"ordinal\", \"scale\" or \"unknown\" (default).\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_22write_sav = {"write_sav", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_22write_sav, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_21write_sav}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_22write_sav(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_22write_sav(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_21write_sav, "\n Writes a pandas data frame to a SPSS sav or zsav file.\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to sav or zsav\n dst_path : str or pathlib.Path\n full path to the result sav or zsav file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n compress : boolean, optional\n if true a zsav will be written, by default False, a sav is written\n row_compress : boolean, optional\n if true it applies row compression, by default False, compress and row_compress cannot be both true at the same time\n note : str, optional\n a note to add to the file\n variable_value_labels : dict, optional\n value labels, a dictionary with key variable name and value a dictionary with key values and\n values labels. Variable names must match variable names in the dataframe otherwise will be\n ignored. Value types must match the type of the column in the dataframe.\n missing_ranges : dict, optional\n user defined missing values. Must be a dictionary with keys as variable names matching variable\n names in the dataframe. The values must be a list. Each element in that list can either be\n either a discrete numeric or string value (max 3 per variable) or a dictionary with keys 'hi' and 'lo' to\n indicate the upper and lower range for numeric values (max 1 range value + 1 discrete value per\n variable). hi and lo may also be the same value in which case it will be interpreted as a discrete\n missing value.""\n For this to be effective, values in the dataframe must be the same as reported here and not NaN.\n variable_display_width : dict, optional\n set the display width for variables. Must be a dictonary with keys being variable names and\n values being integers.\n variable_measure: dict, optional\n sets the measure type for a variable. Must be a dictionary with keys being variable names and\n values being strings one of \"nominal\", \"ordinal\", \"scale\" or \"unknown\" (default).\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_22write_sav = {"write_sav", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_22write_sav, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_21write_sav}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_22write_sav(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_df = 0; PyObject *__pyx_v_dst_path = 0; PyObject *__pyx_v_file_label = 0; @@ -9570,6 +11714,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_22write_sav(PyObject *__pyx_ PyObject *__pyx_v_variable_display_width = 0; PyObject *__pyx_v_variable_measure = 0; PyObject *__pyx_v_variable_format = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9577,164 +11725,176 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_22write_sav(PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_sav (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_compress,&__pyx_n_s_row_compress,&__pyx_n_s_note,&__pyx_n_s_variable_value_labels,&__pyx_n_s_missing_ranges,&__pyx_n_s_variable_display_width,&__pyx_n_s_variable_measure,&__pyx_n_s_variable_format,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_compress,&__pyx_n_s_row_compress,&__pyx_n_s_note,&__pyx_n_s_variable_value_labels,&__pyx_n_s_missing_ranges,&__pyx_n_s_variable_display_width,&__pyx_n_s_variable_measure,&__pyx_n_s_variable_format,0}; PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; - values[2] = ((PyObject*)__pyx_kp_s__6); - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject *)Py_False); - values[5] = ((PyObject *)Py_False); - values[6] = ((PyObject*)Py_None); + values[2] = ((PyObject*)((PyObject*)__pyx_kp_s__6)); + values[3] = ((PyObject *)((PyObject *)Py_None)); + values[4] = ((PyObject *)((PyObject *)Py_False)); + values[5] = ((PyObject *)((PyObject *)Py_False)); + values[6] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":800 + /* "pyreadstat/pyreadstat.pyx":806 * * def write_sav(df, dst_path, str file_label="", object column_labels=None, compress=False, row_compress=False, str note=None, * dict variable_value_labels=None, dict missing_ranges=None, dict variable_display_width=None, # <<<<<<<<<<<<<< * dict variable_measure=None, dict variable_format=None): * """ */ - values[7] = ((PyObject*)Py_None); - values[8] = ((PyObject*)Py_None); - values[9] = ((PyObject*)Py_None); + values[7] = ((PyObject*)((PyObject *)Py_None)); + values[8] = ((PyObject*)((PyObject *)Py_None)); + values[9] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":801 + /* "pyreadstat/pyreadstat.pyx":807 * def write_sav(df, dst_path, str file_label="", object column_labels=None, compress=False, row_compress=False, str note=None, * dict variable_value_labels=None, dict missing_ranges=None, dict variable_display_width=None, * dict variable_measure=None, dict variable_format=None): # <<<<<<<<<<<<<< * """ * Writes a pandas data frame to a SPSS sav or zsav file. */ - values[10] = ((PyObject*)Py_None); - values[11] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[10] = ((PyObject*)((PyObject *)Py_None)); + values[11] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + switch (__pyx_nargs) { + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_df)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_path)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dst_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("write_sav", 0, 2, 12, 1); __PYX_ERR(0, 799, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_sav", 0, 2, 12, 1); __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_label); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_label); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_column_labels); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_column_labels); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compress); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_compress); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row_compress); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_row_compress); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_note); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_note); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_value_labels); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_value_labels); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_missing_ranges); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_missing_ranges); if (value) { values[8] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_display_width); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_display_width); if (value) { values[9] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_measure); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_measure); if (value) { values[10] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_format); if (value) { values[11] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_sav") < 0)) __PYX_ERR(0, 799, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_sav") < 0)) __PYX_ERR(0, 805, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + switch (__pyx_nargs) { + case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -9754,22 +11914,22 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_22write_sav(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_sav", 0, 2, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 799, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_sav", 0, 2, 12, __pyx_nargs); __PYX_ERR(0, 805, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.write_sav", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 799, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_note), (&PyString_Type), 1, "note", 1))) __PYX_ERR(0, 799, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_value_labels), (&PyDict_Type), 1, "variable_value_labels", 1))) __PYX_ERR(0, 800, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_missing_ranges), (&PyDict_Type), 1, "missing_ranges", 1))) __PYX_ERR(0, 800, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_display_width), (&PyDict_Type), 1, "variable_display_width", 1))) __PYX_ERR(0, 800, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_measure), (&PyDict_Type), 1, "variable_measure", 1))) __PYX_ERR(0, 801, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 801, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 805, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_note), (&PyString_Type), 1, "note", 1))) __PYX_ERR(0, 805, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_value_labels), (&PyDict_Type), 1, "variable_value_labels", 1))) __PYX_ERR(0, 806, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_missing_ranges), (&PyDict_Type), 1, "missing_ranges", 1))) __PYX_ERR(0, 806, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_display_width), (&PyDict_Type), 1, "variable_display_width", 1))) __PYX_ERR(0, 806, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_measure), (&PyDict_Type), 1, "variable_measure", 1))) __PYX_ERR(0, 807, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 807, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_21write_sav(__pyx_self, __pyx_v_df, __pyx_v_dst_path, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_compress, __pyx_v_row_compress, __pyx_v_note, __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format); - /* "pyreadstat/pyreadstat.pyx":799 + /* "pyreadstat/pyreadstat.pyx":805 * # Write API * * def write_sav(df, dst_path, str file_label="", object column_labels=None, compress=False, row_compress=False, str note=None, # <<<<<<<<<<<<<< @@ -9803,19 +11963,19 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyObject *(*__pyx_t_7)(PyObject *); - PyObject *__pyx_t_8 = NULL; + int __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); PyObject *__pyx_t_9 = NULL; - PyObject *(*__pyx_t_10)(PyObject *); - int __pyx_t_11; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); Py_ssize_t __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_sav", 0); - /* "pyreadstat/pyreadstat.pyx":848 + /* "pyreadstat/pyreadstat.pyx":854 * """ * * cdef int file_format_version = 2 # <<<<<<<<<<<<<< @@ -9824,7 +11984,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 2; - /* "pyreadstat/pyreadstat.pyx":850 + /* "pyreadstat/pyreadstat.pyx":856 * cdef int file_format_version = 2 * cdef str var_width * cdef bint row_compression = 0 # <<<<<<<<<<<<<< @@ -9833,34 +11993,35 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ __pyx_v_row_compression = 0; - /* "pyreadstat/pyreadstat.pyx":851 + /* "pyreadstat/pyreadstat.pyx":857 * cdef str var_width * cdef bint row_compression = 0 * if compress and row_compress: # <<<<<<<<<<<<<< * raise PyreadstatError("compress and row_compress cannot be both True") * if compress: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_compress); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_compress); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 857, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_row_compress); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 851, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_row_compress); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 857, __pyx_L1_error) __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "pyreadstat/pyreadstat.pyx":852 + /* "pyreadstat/pyreadstat.pyx":858 * cdef bint row_compression = 0 * if compress and row_compress: * raise PyreadstatError("compress and row_compress cannot be both True") # <<<<<<<<<<<<<< * if compress: * file_format_version = 3 */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 852, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 858, __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)) { @@ -9868,18 +12029,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_compress_and_row_compress_cannot) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_compress_and_row_compress_cannot); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 852, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_kp_s_compress_and_row_compress_cannot}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 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(0, 852, __pyx_L1_error) + __PYX_ERR(0, 858, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":851 + /* "pyreadstat/pyreadstat.pyx":857 * cdef str var_width * cdef bint row_compression = 0 * if compress and row_compress: # <<<<<<<<<<<<<< @@ -9888,17 +12053,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":853 + /* "pyreadstat/pyreadstat.pyx":859 * if compress and row_compress: * raise PyreadstatError("compress and row_compress cannot be both True") * if compress: # <<<<<<<<<<<<<< * file_format_version = 3 * if row_compress: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compress); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 853, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_compress); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 859, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":854 + /* "pyreadstat/pyreadstat.pyx":860 * raise PyreadstatError("compress and row_compress cannot be both True") * if compress: * file_format_version = 3 # <<<<<<<<<<<<<< @@ -9907,7 +12072,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 3; - /* "pyreadstat/pyreadstat.pyx":853 + /* "pyreadstat/pyreadstat.pyx":859 * if compress and row_compress: * raise PyreadstatError("compress and row_compress cannot be both True") * if compress: # <<<<<<<<<<<<<< @@ -9916,17 +12081,17 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":855 + /* "pyreadstat/pyreadstat.pyx":861 * if compress: * file_format_version = 3 * if row_compress: # <<<<<<<<<<<<<< * row_compression = 1 * cdef table_name = "" */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_row_compress); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 855, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_row_compress); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 861, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":856 + /* "pyreadstat/pyreadstat.pyx":862 * file_format_version = 3 * if row_compress: * row_compression = 1 # <<<<<<<<<<<<<< @@ -9935,7 +12100,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ __pyx_v_row_compression = 1; - /* "pyreadstat/pyreadstat.pyx":855 + /* "pyreadstat/pyreadstat.pyx":861 * if compress: * file_format_version = 3 * if row_compress: # <<<<<<<<<<<<<< @@ -9944,7 +12109,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":857 + /* "pyreadstat/pyreadstat.pyx":863 * if row_compress: * row_compression = 1 * cdef table_name = "" # <<<<<<<<<<<<<< @@ -9954,7 +12119,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py __Pyx_INCREF(__pyx_kp_s__6); __pyx_v_table_name = __pyx_kp_s__6; - /* "pyreadstat/pyreadstat.pyx":858 + /* "pyreadstat/pyreadstat.pyx":864 * row_compression = 1 * cdef table_name = "" * cdef dict missing_user_values = None # <<<<<<<<<<<<<< @@ -9964,7 +12129,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_missing_user_values = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":859 + /* "pyreadstat/pyreadstat.pyx":865 * cdef table_name = "" * cdef dict missing_user_values = None * cdef dict variable_alignment = None # <<<<<<<<<<<<<< @@ -9974,31 +12139,31 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_alignment = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":863 + /* "pyreadstat/pyreadstat.pyx":869 * * # formats * formats_presets = {'restricted_integer':'N{var_width}', 'integer':'F{var_width}.0'} # <<<<<<<<<<<<<< * if variable_format: * for col_name, col_format in variable_format.items(): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 863, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 869, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_restricted_integer, __pyx_kp_s_N_var_width) < 0) __PYX_ERR(0, 863, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_integer, __pyx_kp_s_F_var_width_0) < 0) __PYX_ERR(0, 863, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_restricted_integer, __pyx_kp_s_N_var_width) < 0) __PYX_ERR(0, 869, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_integer, __pyx_kp_s_F_var_width_0) < 0) __PYX_ERR(0, 869, __pyx_L1_error) __pyx_v_formats_presets = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/pyreadstat.pyx":864 + /* "pyreadstat/pyreadstat.pyx":870 * # formats * formats_presets = {'restricted_integer':'N{var_width}', 'integer':'F{var_width}.0'} * if variable_format: # <<<<<<<<<<<<<< * for col_name, col_format in variable_format.items(): * if col_format in formats_presets.keys() and col_name in df.columns: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_variable_format); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 864, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_variable_format); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 870, __pyx_L1_error) if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":865 + /* "pyreadstat/pyreadstat.pyx":871 * formats_presets = {'restricted_integer':'N{var_width}', 'integer':'F{var_width}.0'} * if variable_format: * for col_name, col_format in variable_format.items(): # <<<<<<<<<<<<<< @@ -10007,45 +12172,45 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ if (unlikely(__pyx_v_variable_format == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 865, __pyx_L1_error) + __PYX_ERR(0, 871, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_variable_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_Items(__pyx_v_variable_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0; - __pyx_t_7 = NULL; + __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0; + __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 871, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { - if (likely(!__pyx_t_7)) { + if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 871, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 871, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { - __pyx_t_3 = __pyx_t_7(__pyx_t_4); + __pyx_t_3 = __pyx_t_8(__pyx_t_4); 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, 865, __pyx_L1_error) + else __PYX_ERR(0, 871, __pyx_L1_error) } break; } @@ -10057,130 +12222,128 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 865, __pyx_L1_error) + __PYX_ERR(0, 871, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_8 = PyList_GET_ITEM(sequence, 1); + __pyx_t_9 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 865, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 865, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 871, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed; + __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); + index = 0; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed; - __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 865, __pyx_L1_error) - __pyx_t_10 = NULL; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + 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, 871, __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_9); __pyx_t_9 = 0; - __pyx_t_10 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 865, __pyx_L1_error) + __PYX_ERR(0, 871, __pyx_L1_error) __pyx_L12_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_col_name, __pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_col_format, __pyx_t_8); - __pyx_t_8 = 0; + __Pyx_XDECREF_SET(__pyx_v_col_format, __pyx_t_9); + __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":866 + /* "pyreadstat/pyreadstat.pyx":872 * if variable_format: * for col_name, col_format in variable_format.items(): * if col_format in formats_presets.keys() and col_name in df.columns: # <<<<<<<<<<<<<< * var_width = str(len(str(max(df[col_name])))) * variable_format[col_name] = formats_presets[col_format].format(var_width=var_width) */ - __pyx_t_3 = __Pyx_PyDict_Keys(__pyx_v_formats_presets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 866, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_Keys(__pyx_v_formats_presets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_format, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 866, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_format, __pyx_t_3, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 872, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = (__pyx_t_2 != 0); - if (__pyx_t_11) { + if (__pyx_t_2) { } else { - __pyx_t_1 = __pyx_t_11; + __pyx_t_1 = __pyx_t_2; goto __pyx_L14_bool_binop_done; } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 866, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_name, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 866, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_col_name, __pyx_t_3, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 872, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = (__pyx_t_11 != 0); __pyx_t_1 = __pyx_t_2; __pyx_L14_bool_binop_done:; if (__pyx_t_1) { - /* "pyreadstat/pyreadstat.pyx":867 + /* "pyreadstat/pyreadstat.pyx":873 * for col_name, col_format in variable_format.items(): * if col_format in formats_presets.keys() and col_name in df.columns: * var_width = str(len(str(max(df[col_name])))) # <<<<<<<<<<<<<< * variable_format[col_name] = formats_presets[col_format].format(var_width=var_width) * */ - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_df, __pyx_v_col_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_df, __pyx_v_col_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 873, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Str(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_12 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 867, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_12 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_Str(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 873, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 867, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_var_width, ((PyObject*)__pyx_t_8)); - __pyx_t_8 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_9)) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_9))) __PYX_ERR(0, 873, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_var_width, ((PyObject*)__pyx_t_9)); + __pyx_t_9 = 0; - /* "pyreadstat/pyreadstat.pyx":868 + /* "pyreadstat/pyreadstat.pyx":874 * if col_format in formats_presets.keys() and col_name in df.columns: * var_width = str(len(str(max(df[col_name])))) * variable_format[col_name] = formats_presets[col_format].format(var_width=var_width) # <<<<<<<<<<<<<< * * run_write(df, dst_path, _readstat_writer.FILE_FORMAT_SAV, file_label, column_labels, */ - __pyx_t_8 = __Pyx_PyDict_GetItem(__pyx_v_formats_presets, __pyx_v_col_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 868, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 868, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_formats_presets, __pyx_v_col_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 874, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 868, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_var_width, __pyx_v_var_width) < 0) __PYX_ERR(0, 868, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 868, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 874, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_var_width, __pyx_v_var_width) < 0) __PYX_ERR(0, 874, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(__pyx_v_variable_format == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 868, __pyx_L1_error) + __PYX_ERR(0, 874, __pyx_L1_error) } - if (unlikely(PyDict_SetItem(__pyx_v_variable_format, __pyx_v_col_name, __pyx_t_5) < 0)) __PYX_ERR(0, 868, __pyx_L1_error) + if (unlikely((PyDict_SetItem(__pyx_v_variable_format, __pyx_v_col_name, __pyx_t_5) < 0))) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/pyreadstat.pyx":866 + /* "pyreadstat/pyreadstat.pyx":872 * if variable_format: * for col_name, col_format in variable_format.items(): * if col_format in formats_presets.keys() and col_name in df.columns: # <<<<<<<<<<<<<< @@ -10189,7 +12352,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":865 + /* "pyreadstat/pyreadstat.pyx":871 * formats_presets = {'restricted_integer':'N{var_width}', 'integer':'F{var_width}.0'} * if variable_format: * for col_name, col_format in variable_format.items(): # <<<<<<<<<<<<<< @@ -10199,7 +12362,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":864 + /* "pyreadstat/pyreadstat.pyx":870 * # formats * formats_presets = {'restricted_integer':'N{var_width}', 'integer':'F{var_width}.0'} * if variable_format: # <<<<<<<<<<<<<< @@ -10208,25 +12371,25 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ } - /* "pyreadstat/pyreadstat.pyx":871 + /* "pyreadstat/pyreadstat.pyx":877 * * run_write(df, dst_path, _readstat_writer.FILE_FORMAT_SAV, file_label, column_labels, * file_format_version, note, table_name, variable_value_labels, missing_ranges, missing_user_values, # <<<<<<<<<<<<<< * variable_alignment, variable_display_width, variable_measure, variable_format, row_compression) * */ - if (!(likely(PyString_CheckExact(__pyx_v_table_name))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_table_name)->tp_name), 0))) __PYX_ERR(0, 871, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_v_table_name)) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_table_name))) __PYX_ERR(0, 877, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":870 + /* "pyreadstat/pyreadstat.pyx":876 * variable_format[col_name] = formats_presets[col_format].format(var_width=var_width) * * run_write(df, dst_path, _readstat_writer.FILE_FORMAT_SAV, file_label, column_labels, # <<<<<<<<<<<<<< * file_format_version, note, table_name, variable_value_labels, missing_ranges, missing_user_values, * variable_alignment, variable_display_width, variable_measure, variable_format, row_compression) */ - __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAV, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, ((PyObject*)__pyx_v_table_name), __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 870, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_SAV, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, ((PyObject*)__pyx_v_table_name), __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 876, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":799 + /* "pyreadstat/pyreadstat.pyx":805 * # Write API * * def write_sav(df, dst_path, str file_label="", object column_labels=None, compress=False, row_compress=False, str note=None, # <<<<<<<<<<<<<< @@ -10241,8 +12404,8 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("pyreadstat.pyreadstat.write_sav", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -10258,7 +12421,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":874 +/* "pyreadstat/pyreadstat.pyx":880 * variable_alignment, variable_display_width, variable_measure, variable_format, row_compression) * * def write_dta(df, dst_path, str file_label="", object column_labels=None, int version=15, # <<<<<<<<<<<<<< @@ -10267,10 +12430,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_21write_sav(CYTHON_UNUSED Py */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_23write_dta[] = "\n Writes a pandas data frame to a STATA dta file\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to sav or zsav\n dst_path : str or pathlib.Path\n full path to the result dta file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n version : int, optional\n dta file version, supported from 8 to 15, default is 15\n variable_value_labels : dict, optional\n value labels, a dictionary with key variable name and value a dictionary with key values and\n values labels. Variable names must match variable names in the dataframe otherwise will be\n ignored. Value types must match the type of the column in the dataframe.\n missing_user_values : dict, optional\n user defined missing values for numeric variables. Must be a dictionary with keys being variable\n names and values being a list of missing values. Missing values must be a single character\n between a and z.\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_24write_dta = {"write_dta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_24write_dta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_23write_dta}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_23write_dta, "\n Writes a pandas data frame to a STATA dta file\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to sav or zsav\n dst_path : str or pathlib.Path\n full path to the result dta file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n version : int, optional\n dta file version, supported from 8 to 15, default is 15\n variable_value_labels : dict, optional\n value labels, a dictionary with key variable name and value a dictionary with key values and\n values labels. Variable names must match variable names in the dataframe otherwise will be\n ignored. Value types must match the type of the column in the dataframe.\n missing_user_values : dict, optional\n user defined missing values for numeric variables. Must be a dictionary with keys being variable\n names and values being a list of missing values. Missing values must be a single character\n between a and z.\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_24write_dta = {"write_dta", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_24write_dta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_23write_dta}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_df = 0; PyObject *__pyx_v_dst_path = 0; PyObject *__pyx_v_file_label = 0; @@ -10279,6 +12454,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_ PyObject *__pyx_v_variable_value_labels = 0; PyObject *__pyx_v_missing_user_values = 0; PyObject *__pyx_v_variable_format = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -10286,111 +12465,119 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_dta (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_version,&__pyx_n_s_variable_value_labels,&__pyx_n_s_missing_user_values,&__pyx_n_s_variable_format,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_version,&__pyx_n_s_variable_value_labels,&__pyx_n_s_missing_user_values,&__pyx_n_s_variable_format,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; - values[2] = ((PyObject*)__pyx_kp_s__6); - values[3] = ((PyObject *)Py_None); + values[2] = ((PyObject*)((PyObject*)__pyx_kp_s__6)); + values[3] = ((PyObject *)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":875 + /* "pyreadstat/pyreadstat.pyx":881 * * def write_dta(df, dst_path, str file_label="", object column_labels=None, int version=15, * dict variable_value_labels=None, dict missing_user_values=None, dict variable_format=None): # <<<<<<<<<<<<<< * """ * Writes a pandas data frame to a STATA dta file */ - values[5] = ((PyObject*)Py_None); - values[6] = ((PyObject*)Py_None); - values[7] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[5] = ((PyObject*)((PyObject *)Py_None)); + values[6] = ((PyObject*)((PyObject *)Py_None)); + values[7] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_df)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_path)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dst_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("write_dta", 0, 2, 8, 1); __PYX_ERR(0, 874, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_dta", 0, 2, 8, 1); __PYX_ERR(0, 880, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_label); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_label); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_column_labels); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_column_labels); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_version); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_version); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_value_labels); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_value_labels); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_missing_user_values); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_missing_user_values); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_format); if (value) { values[7] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_dta") < 0)) __PYX_ERR(0, 874, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_dta") < 0)) __PYX_ERR(0, 880, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + switch (__pyx_nargs) { + case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -10400,9 +12587,9 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_ __pyx_v_file_label = ((PyObject*)values[2]); __pyx_v_column_labels = values[3]; if (values[4]) { - __pyx_v_version = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_version == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 874, __pyx_L3_error) + __pyx_v_version = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_version == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 880, __pyx_L3_error) } else { - __pyx_v_version = ((int)15); + __pyx_v_version = ((int)((int)15)); } __pyx_v_variable_value_labels = ((PyObject*)values[5]); __pyx_v_missing_user_values = ((PyObject*)values[6]); @@ -10410,19 +12597,19 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_24write_dta(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_dta", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 874, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_dta", 0, 2, 8, __pyx_nargs); __PYX_ERR(0, 880, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.write_dta", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 874, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_value_labels), (&PyDict_Type), 1, "variable_value_labels", 1))) __PYX_ERR(0, 875, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_missing_user_values), (&PyDict_Type), 1, "missing_user_values", 1))) __PYX_ERR(0, 875, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 875, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 880, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_value_labels), (&PyDict_Type), 1, "variable_value_labels", 1))) __PYX_ERR(0, 881, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_missing_user_values), (&PyDict_Type), 1, "missing_user_values", 1))) __PYX_ERR(0, 881, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 881, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_23write_dta(__pyx_self, __pyx_v_df, __pyx_v_dst_path, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_version, __pyx_v_variable_value_labels, __pyx_v_missing_user_values, __pyx_v_variable_format); - /* "pyreadstat/pyreadstat.pyx":874 + /* "pyreadstat/pyreadstat.pyx":880 * variable_alignment, variable_display_width, variable_measure, variable_format, row_compression) * * def write_dta(df, dst_path, str file_label="", object column_labels=None, int version=15, # <<<<<<<<<<<<<< @@ -10456,7 +12643,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_dta", 0); - /* "pyreadstat/pyreadstat.pyx":908 + /* "pyreadstat/pyreadstat.pyx":914 * """ * * if version == 15: # <<<<<<<<<<<<<< @@ -10466,7 +12653,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py switch (__pyx_v_version) { case 15: - /* "pyreadstat/pyreadstat.pyx":909 + /* "pyreadstat/pyreadstat.pyx":915 * * if version == 15: * file_format_version = 119 # <<<<<<<<<<<<<< @@ -10475,7 +12662,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 0x77; - /* "pyreadstat/pyreadstat.pyx":908 + /* "pyreadstat/pyreadstat.pyx":914 * """ * * if version == 15: # <<<<<<<<<<<<<< @@ -10485,7 +12672,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py break; case 14: - /* "pyreadstat/pyreadstat.pyx":911 + /* "pyreadstat/pyreadstat.pyx":917 * file_format_version = 119 * elif version == 14: * file_format_version = 118 # <<<<<<<<<<<<<< @@ -10494,7 +12681,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 0x76; - /* "pyreadstat/pyreadstat.pyx":910 + /* "pyreadstat/pyreadstat.pyx":916 * if version == 15: * file_format_version = 119 * elif version == 14: # <<<<<<<<<<<<<< @@ -10504,7 +12691,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py break; case 13: - /* "pyreadstat/pyreadstat.pyx":913 + /* "pyreadstat/pyreadstat.pyx":919 * file_format_version = 118 * elif version == 13: * file_format_version = 117 # <<<<<<<<<<<<<< @@ -10513,7 +12700,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 0x75; - /* "pyreadstat/pyreadstat.pyx":912 + /* "pyreadstat/pyreadstat.pyx":918 * elif version == 14: * file_format_version = 118 * elif version == 13: # <<<<<<<<<<<<<< @@ -10523,7 +12710,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py break; case 12: - /* "pyreadstat/pyreadstat.pyx":915 + /* "pyreadstat/pyreadstat.pyx":921 * file_format_version = 117 * elif version == 12: * file_format_version = 115 # <<<<<<<<<<<<<< @@ -10532,7 +12719,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 0x73; - /* "pyreadstat/pyreadstat.pyx":914 + /* "pyreadstat/pyreadstat.pyx":920 * elif version == 13: * file_format_version = 117 * elif version == 12: # <<<<<<<<<<<<<< @@ -10542,7 +12729,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py break; case 10: - /* "pyreadstat/pyreadstat.pyx":916 + /* "pyreadstat/pyreadstat.pyx":922 * elif version == 12: * file_format_version = 115 * elif version in {10, 11}: # <<<<<<<<<<<<<< @@ -10551,7 +12738,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ case 11: - /* "pyreadstat/pyreadstat.pyx":917 + /* "pyreadstat/pyreadstat.pyx":923 * file_format_version = 115 * elif version in {10, 11}: * file_format_version = 114 # <<<<<<<<<<<<<< @@ -10560,7 +12747,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 0x72; - /* "pyreadstat/pyreadstat.pyx":916 + /* "pyreadstat/pyreadstat.pyx":922 * elif version == 12: * file_format_version = 115 * elif version in {10, 11}: # <<<<<<<<<<<<<< @@ -10570,7 +12757,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py break; case 8: - /* "pyreadstat/pyreadstat.pyx":918 + /* "pyreadstat/pyreadstat.pyx":924 * elif version in {10, 11}: * file_format_version = 114 * elif version in {8, 9}: # <<<<<<<<<<<<<< @@ -10579,7 +12766,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ case 9: - /* "pyreadstat/pyreadstat.pyx":919 + /* "pyreadstat/pyreadstat.pyx":925 * file_format_version = 114 * elif version in {8, 9}: * file_format_version = 113 # <<<<<<<<<<<<<< @@ -10588,7 +12775,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 0x71; - /* "pyreadstat/pyreadstat.pyx":918 + /* "pyreadstat/pyreadstat.pyx":924 * elif version in {10, 11}: * file_format_version = 114 * elif version in {8, 9}: # <<<<<<<<<<<<<< @@ -10598,22 +12785,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py break; default: - /* "pyreadstat/pyreadstat.pyx":921 + /* "pyreadstat/pyreadstat.pyx":927 * file_format_version = 113 * else: * raise Exception("Version not supported") # <<<<<<<<<<<<<< * * cdef str note = "" */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __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, 921, __pyx_L1_error) + __PYX_ERR(0, 927, __pyx_L1_error) break; } - /* "pyreadstat/pyreadstat.pyx":923 + /* "pyreadstat/pyreadstat.pyx":929 * raise Exception("Version not supported") * * cdef str note = "" # <<<<<<<<<<<<<< @@ -10623,7 +12810,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py __Pyx_INCREF(__pyx_kp_s__6); __pyx_v_note = __pyx_kp_s__6; - /* "pyreadstat/pyreadstat.pyx":924 + /* "pyreadstat/pyreadstat.pyx":930 * * cdef str note = "" * cdef str table_name = "" # <<<<<<<<<<<<<< @@ -10633,7 +12820,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py __Pyx_INCREF(__pyx_kp_s__6); __pyx_v_table_name = __pyx_kp_s__6; - /* "pyreadstat/pyreadstat.pyx":925 + /* "pyreadstat/pyreadstat.pyx":931 * cdef str note = "" * cdef str table_name = "" * cdef dict missing_ranges = None # <<<<<<<<<<<<<< @@ -10643,7 +12830,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_missing_ranges = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":926 + /* "pyreadstat/pyreadstat.pyx":932 * cdef str table_name = "" * cdef dict missing_ranges = None * cdef dict variable_alignment = None # <<<<<<<<<<<<<< @@ -10653,7 +12840,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_alignment = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":927 + /* "pyreadstat/pyreadstat.pyx":933 * cdef dict missing_ranges = None * cdef dict variable_alignment = None * cdef dict variable_display_width = None # <<<<<<<<<<<<<< @@ -10663,7 +12850,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_display_width = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":928 + /* "pyreadstat/pyreadstat.pyx":934 * cdef dict variable_alignment = None * cdef dict variable_display_width = None * cdef dict variable_measure = None # <<<<<<<<<<<<<< @@ -10673,7 +12860,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_measure = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":930 + /* "pyreadstat/pyreadstat.pyx":936 * cdef dict variable_measure = None * #cdef dict variable_format = None * cdef bint row_compression = 0 # <<<<<<<<<<<<<< @@ -10682,16 +12869,16 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ __pyx_v_row_compression = 0; - /* "pyreadstat/pyreadstat.pyx":932 + /* "pyreadstat/pyreadstat.pyx":938 * cdef bint row_compression = 0 * * run_write(df, dst_path, _readstat_writer.FILE_FORMAT_DTA, file_label, column_labels, file_format_version, # <<<<<<<<<<<<<< * note, table_name, variable_value_labels, missing_ranges, missing_user_values, variable_alignment, * variable_display_width, variable_measure, variable_format, row_compression) */ - __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, __pyx_v_table_name, __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_DTA, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, __pyx_v_table_name, __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":874 + /* "pyreadstat/pyreadstat.pyx":880 * variable_alignment, variable_display_width, variable_measure, variable_format, row_compression) * * def write_dta(df, dst_path, str file_label="", object column_labels=None, int version=15, # <<<<<<<<<<<<<< @@ -10718,7 +12905,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":936 +/* "pyreadstat/pyreadstat.pyx":942 * variable_display_width, variable_measure, variable_format, row_compression) * * def write_xport(df, dst_path, str file_label="", object column_labels=None, str table_name=None, int file_format_version = 8, # <<<<<<<<<<<<<< @@ -10727,10 +12914,22 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_23write_dta(CYTHON_UNUSED Py */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_26write_xport(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_25write_xport[] = "\n Writes a pandas data frame to a SAS Xport (xpt) file.\n If no table_name is specified the dataset has by default the name DATASET (take it into account if\n reading the file from SAS.)\n Versions 5 and 8 are supported, default is 8.\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to xport\n dst_path : str or pathlib.Path\n full path to the result xport file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n table_name : str, optional\n name of the dataset, by default DATASET\n file_format_version : int, optional\n XPORT file version, either 8 or 5, default is 8\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_26write_xport = {"write_xport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_26write_xport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_25write_xport}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_26write_xport(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_26write_xport(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_25write_xport, "\n Writes a pandas data frame to a SAS Xport (xpt) file.\n If no table_name is specified the dataset has by default the name DATASET (take it into account if\n reading the file from SAS.)\n Versions 5 and 8 are supported, default is 8.\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to xport\n dst_path : str or pathlib.Path\n full path to the result xport file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n table_name : str, optional\n name of the dataset, by default DATASET\n file_format_version : int, optional\n XPORT file version, either 8 or 5, default is 8\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_26write_xport = {"write_xport", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_26write_xport, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_25write_xport}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_26write_xport(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_df = 0; PyObject *__pyx_v_dst_path = 0; PyObject *__pyx_v_file_label = 0; @@ -10738,6 +12937,10 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_26write_xport(PyObject *__py PyObject *__pyx_v_table_name = 0; int __pyx_v_file_format_version; PyObject *__pyx_v_variable_format = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -10745,100 +12948,107 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_26write_xport(PyObject *__py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_xport (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_table_name,&__pyx_n_s_file_format_version,&__pyx_n_s_variable_format,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_table_name,&__pyx_n_s_file_format_version,&__pyx_n_s_variable_format,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; - values[2] = ((PyObject*)__pyx_kp_s__6); - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject*)Py_None); + values[2] = ((PyObject*)((PyObject*)__pyx_kp_s__6)); + values[3] = ((PyObject *)((PyObject *)Py_None)); + values[4] = ((PyObject*)((PyObject *)Py_None)); - /* "pyreadstat/pyreadstat.pyx":937 + /* "pyreadstat/pyreadstat.pyx":943 * * def write_xport(df, dst_path, str file_label="", object column_labels=None, str table_name=None, int file_format_version = 8, * dict variable_format=None): # <<<<<<<<<<<<<< * """ * Writes a pandas data frame to a SAS Xport (xpt) file. */ - values[6] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[6] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_df)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_path)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dst_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("write_xport", 0, 2, 7, 1); __PYX_ERR(0, 936, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_xport", 0, 2, 7, 1); __PYX_ERR(0, 942, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_label); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_label); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_column_labels); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_column_labels); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_table_name); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table_name); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_format_version); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_format_version); if (value) { values[5] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_format); if (value) { values[6] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_xport") < 0)) __PYX_ERR(0, 936, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_xport") < 0)) __PYX_ERR(0, 942, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + switch (__pyx_nargs) { + case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -10849,26 +13059,26 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_26write_xport(PyObject *__py __pyx_v_column_labels = values[3]; __pyx_v_table_name = ((PyObject*)values[4]); if (values[5]) { - __pyx_v_file_format_version = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_file_format_version == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 936, __pyx_L3_error) + __pyx_v_file_format_version = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_file_format_version == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) } else { - __pyx_v_file_format_version = ((int)8); + __pyx_v_file_format_version = ((int)((int)8)); } __pyx_v_variable_format = ((PyObject*)values[6]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_xport", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 936, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_xport", 0, 2, 7, __pyx_nargs); __PYX_ERR(0, 942, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.write_xport", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 936, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyString_Type), 1, "table_name", 1))) __PYX_ERR(0, 936, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 937, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 942, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyString_Type), 1, "table_name", 1))) __PYX_ERR(0, 942, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 943, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_25write_xport(__pyx_self, __pyx_v_df, __pyx_v_dst_path, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_table_name, __pyx_v_file_format_version, __pyx_v_variable_format); - /* "pyreadstat/pyreadstat.pyx":936 + /* "pyreadstat/pyreadstat.pyx":942 * variable_display_width, variable_measure, variable_format, row_compression) * * def write_xport(df, dst_path, str file_label="", object column_labels=None, str table_name=None, int file_format_version = 8, # <<<<<<<<<<<<<< @@ -10901,7 +13111,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_xport", 0); - /* "pyreadstat/pyreadstat.pyx":967 + /* "pyreadstat/pyreadstat.pyx":973 * """ * * cdef dict variable_value_labels = None # <<<<<<<<<<<<<< @@ -10911,7 +13121,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED __Pyx_INCREF(Py_None); __pyx_v_variable_value_labels = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":968 + /* "pyreadstat/pyreadstat.pyx":974 * * cdef dict variable_value_labels = None * cdef str note = "" # <<<<<<<<<<<<<< @@ -10921,7 +13131,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED __Pyx_INCREF(__pyx_kp_s__6); __pyx_v_note = __pyx_kp_s__6; - /* "pyreadstat/pyreadstat.pyx":969 + /* "pyreadstat/pyreadstat.pyx":975 * cdef dict variable_value_labels = None * cdef str note = "" * cdef dict missing_ranges = None # <<<<<<<<<<<<<< @@ -10931,7 +13141,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED __Pyx_INCREF(Py_None); __pyx_v_missing_ranges = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":970 + /* "pyreadstat/pyreadstat.pyx":976 * cdef str note = "" * cdef dict missing_ranges = None * cdef dict missing_user_values = None # <<<<<<<<<<<<<< @@ -10941,7 +13151,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED __Pyx_INCREF(Py_None); __pyx_v_missing_user_values = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":971 + /* "pyreadstat/pyreadstat.pyx":977 * cdef dict missing_ranges = None * cdef dict missing_user_values = None * cdef dict variable_alignment = None # <<<<<<<<<<<<<< @@ -10951,7 +13161,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED __Pyx_INCREF(Py_None); __pyx_v_variable_alignment = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":972 + /* "pyreadstat/pyreadstat.pyx":978 * cdef dict missing_user_values = None * cdef dict variable_alignment = None * cdef dict variable_display_width = None # <<<<<<<<<<<<<< @@ -10961,7 +13171,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED __Pyx_INCREF(Py_None); __pyx_v_variable_display_width = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":973 + /* "pyreadstat/pyreadstat.pyx":979 * cdef dict variable_alignment = None * cdef dict variable_display_width = None * cdef dict variable_measure = None # <<<<<<<<<<<<<< @@ -10971,7 +13181,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED __Pyx_INCREF(Py_None); __pyx_v_variable_measure = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":975 + /* "pyreadstat/pyreadstat.pyx":981 * cdef dict variable_measure = None * #cdef dict variable_format = None * cdef bint row_compression = 0 # <<<<<<<<<<<<<< @@ -10980,16 +13190,16 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED */ __pyx_v_row_compression = 0; - /* "pyreadstat/pyreadstat.pyx":976 + /* "pyreadstat/pyreadstat.pyx":982 * #cdef dict variable_format = None * cdef bint row_compression = 0 * run_write(df, dst_path, _readstat_writer.FILE_FORMAT_XPORT, file_label, column_labels, # <<<<<<<<<<<<<< * file_format_version, note, table_name, variable_value_labels, missing_ranges,missing_user_values, * variable_alignment,variable_display_width, variable_measure, variable_format, row_compression) */ - __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_XPORT, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, __pyx_v_table_name, __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 976, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_XPORT, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, __pyx_v_table_name, __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 982, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":936 + /* "pyreadstat/pyreadstat.pyx":942 * variable_display_width, variable_measure, variable_format, row_compression) * * def write_xport(df, dst_path, str file_label="", object column_labels=None, str table_name=None, int file_format_version = 8, # <<<<<<<<<<<<<< @@ -11016,7 +13226,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED return __pyx_r; } -/* "pyreadstat/pyreadstat.pyx":980 +/* "pyreadstat/pyreadstat.pyx":986 * variable_alignment,variable_display_width, variable_measure, variable_format, row_compression) * * def write_por(df, dst_path, str file_label="", object column_labels=None, dict variable_format=None): # <<<<<<<<<<<<<< @@ -11025,15 +13235,31 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_25write_xport(CYTHON_UNUSED */ /* Python wrapper */ -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_28write_por(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_10pyreadstat_10pyreadstat_27write_por[] = "\n Writes a pandas data frame to a SPSS POR file.\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to por\n dst_path : str or pathlib.Path\n full path to the result por file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "; -static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_28write_por = {"write_por", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_28write_por, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_27write_por}; -static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_28write_por(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_28write_por(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +); /*proto*/ +PyDoc_STRVAR(__pyx_doc_10pyreadstat_10pyreadstat_27write_por, "\n Writes a pandas data frame to a SPSS POR file.\n\n Parameters\n ----------\n df : pandas data frame\n pandas data frame to write to por\n dst_path : str or pathlib.Path\n full path to the result por file\n file_label : str, optional\n a label for the file\n column_labels : list or dict, optional\n labels for columns (variables), if list must be the same length as the number of columns. Variables with no\n labels must be represented by None. If dict values must be variable names and values variable labels.\n In such case there is no need to include all variables; labels for non existent\n variables will be ignored with no warning or error.\n variable_format: dict, optional\n sets the format of a variable. Must be a dictionary with keys being the variable names and \n values being strings defining the format. See README, setting variable formats section,\n for more information.\n "); +static PyMethodDef __pyx_mdef_10pyreadstat_10pyreadstat_28write_por = {"write_por", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10pyreadstat_10pyreadstat_28write_por, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_10pyreadstat_10pyreadstat_27write_por}; +static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_28write_por(PyObject *__pyx_self, +#if CYTHON_METH_FASTCALL +PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds +#else +PyObject *__pyx_args, PyObject *__pyx_kwds +#endif +) { PyObject *__pyx_v_df = 0; PyObject *__pyx_v_dst_path = 0; PyObject *__pyx_v_file_label = 0; PyObject *__pyx_v_column_labels = 0; PyObject *__pyx_v_variable_format = 0; + #if !CYTHON_METH_FASTCALL + CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #endif + CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -11041,71 +13267,76 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_28write_por(PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_por (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_variable_format,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_dst_path,&__pyx_n_s_file_label,&__pyx_n_s_column_labels,&__pyx_n_s_variable_format,0}; PyObject* values[5] = {0,0,0,0,0}; - values[2] = ((PyObject*)__pyx_kp_s__6); - values[3] = ((PyObject *)Py_None); - values[4] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { + values[2] = ((PyObject*)((PyObject*)__pyx_kp_s__6)); + values[3] = ((PyObject *)((PyObject *)Py_None)); + values[4] = ((PyObject*)((PyObject *)Py_None)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_df)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 986, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_path)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dst_path)) != 0)) kw_args--; + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 986, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("write_por", 0, 2, 5, 1); __PYX_ERR(0, 980, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_por", 0, 2, 5, 1); __PYX_ERR(0, 986, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_file_label); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file_label); if (value) { values[2] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 986, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_column_labels); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_column_labels); if (value) { values[3] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 986, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_format); + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_variable_format); if (value) { values[4] = value; kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 986, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "write_por") < 0)) __PYX_ERR(0, 980, __pyx_L3_error) + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write_por") < 0)) __PYX_ERR(0, 986, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -11118,14 +13349,14 @@ static PyObject *__pyx_pw_10pyreadstat_10pyreadstat_28write_por(PyObject *__pyx_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("write_por", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 980, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("write_por", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 986, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("pyreadstat.pyreadstat.write_por", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 980, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 980, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file_label), (&PyString_Type), 1, "file_label", 1))) __PYX_ERR(0, 986, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable_format), (&PyDict_Type), 1, "variable_format", 1))) __PYX_ERR(0, 986, __pyx_L1_error) __pyx_r = __pyx_pf_10pyreadstat_10pyreadstat_27write_por(__pyx_self, __pyx_v_df, __pyx_v_dst_path, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_variable_format); /* function exit code */ @@ -11155,7 +13386,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write_por", 0); - /* "pyreadstat/pyreadstat.pyx":1004 + /* "pyreadstat/pyreadstat.pyx":1010 * * # atm version 5 and 8 are supported by readstat but only 5 can be later be read by SAS * cdef str note=None # <<<<<<<<<<<<<< @@ -11165,7 +13396,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_note = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":1005 + /* "pyreadstat/pyreadstat.pyx":1011 * # atm version 5 and 8 are supported by readstat but only 5 can be later be read by SAS * cdef str note=None * cdef int file_format_version = 0 # <<<<<<<<<<<<<< @@ -11174,7 +13405,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py */ __pyx_v_file_format_version = 0; - /* "pyreadstat/pyreadstat.pyx":1006 + /* "pyreadstat/pyreadstat.pyx":1012 * cdef str note=None * cdef int file_format_version = 0 * cdef dict variable_value_labels=None # <<<<<<<<<<<<<< @@ -11184,7 +13415,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_value_labels = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":1007 + /* "pyreadstat/pyreadstat.pyx":1013 * cdef int file_format_version = 0 * cdef dict variable_value_labels=None * cdef dict missing_ranges = None # <<<<<<<<<<<<<< @@ -11194,7 +13425,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_missing_ranges = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":1008 + /* "pyreadstat/pyreadstat.pyx":1014 * cdef dict variable_value_labels=None * cdef dict missing_ranges = None * cdef dict missing_user_values = None # <<<<<<<<<<<<<< @@ -11204,7 +13435,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_missing_user_values = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":1009 + /* "pyreadstat/pyreadstat.pyx":1015 * cdef dict missing_ranges = None * cdef dict missing_user_values = None * cdef dict variable_alignment = None # <<<<<<<<<<<<<< @@ -11214,7 +13445,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_alignment = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":1010 + /* "pyreadstat/pyreadstat.pyx":1016 * cdef dict missing_user_values = None * cdef dict variable_alignment = None * cdef dict variable_display_width = None # <<<<<<<<<<<<<< @@ -11224,7 +13455,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_display_width = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":1011 + /* "pyreadstat/pyreadstat.pyx":1017 * cdef dict variable_alignment = None * cdef dict variable_display_width = None * cdef dict variable_measure = None # <<<<<<<<<<<<<< @@ -11234,7 +13465,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(Py_None); __pyx_v_variable_measure = ((PyObject*)Py_None); - /* "pyreadstat/pyreadstat.pyx":1012 + /* "pyreadstat/pyreadstat.pyx":1018 * cdef dict variable_display_width = None * cdef dict variable_measure = None * cdef str table_name = "" # <<<<<<<<<<<<<< @@ -11244,7 +13475,7 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py __Pyx_INCREF(__pyx_kp_s__6); __pyx_v_table_name = __pyx_kp_s__6; - /* "pyreadstat/pyreadstat.pyx":1014 + /* "pyreadstat/pyreadstat.pyx":1020 * cdef str table_name = "" * #cdef dict variable_format = None * cdef bint row_compression = 0 # <<<<<<<<<<<<<< @@ -11253,16 +13484,16 @@ static PyObject *__pyx_pf_10pyreadstat_10pyreadstat_27write_por(CYTHON_UNUSED Py */ __pyx_v_row_compression = 0; - /* "pyreadstat/pyreadstat.pyx":1015 + /* "pyreadstat/pyreadstat.pyx":1021 * #cdef dict variable_format = None * cdef bint row_compression = 0 * run_write(df, dst_path, _readstat_writer.FILE_FORMAT_POR, file_label, column_labels, # <<<<<<<<<<<<<< * file_format_version, note, table_name, variable_value_labels, missing_ranges,missing_user_values, * variable_alignment,variable_display_width, variable_measure, variable_format, row_compression) */ - __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, __pyx_v_table_name, __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1015, __pyx_L1_error) + __pyx_f_10pyreadstat_16_readstat_writer_run_write(__pyx_v_df, __pyx_v_dst_path, __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR, __pyx_v_file_label, __pyx_v_column_labels, __pyx_v_file_format_version, __pyx_v_note, __pyx_v_table_name, __pyx_v_variable_value_labels, __pyx_v_missing_ranges, __pyx_v_missing_user_values, __pyx_v_variable_alignment, __pyx_v_variable_display_width, __pyx_v_variable_measure, __pyx_v_variable_format, __pyx_v_row_compression); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1021, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":980 + /* "pyreadstat/pyreadstat.pyx":986 * variable_alignment,variable_display_width, variable_measure, variable_format, row_compression) * * def write_por(df, dst_path, str file_label="", object column_labels=None, dict variable_format=None): # <<<<<<<<<<<<<< @@ -11295,7 +13526,11 @@ static int __pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct__set_val static PyObject *__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels)))) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (CYTHON_COMPILING_IN_CPYTHON && likely((int)(__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels)))) { o = (PyObject*)__pyx_freelist_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels[--__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels]; memset(o, 0, sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels)); (void) PyObject_INIT(o, t); @@ -11304,14 +13539,22 @@ static PyObject *__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct__set_ o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } + #endif return o; } static void __pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels(PyObject *o) { struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels *p = (struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_labels); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels)))) { + if (CYTHON_COMPILING_IN_CPYTHON && ((int)(__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels)))) { __pyx_freelist_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels[__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels++] = ((struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels *)o); } else { (*Py_TYPE(o)->tp_free)(o); @@ -11335,10 +13578,26 @@ static int __pyx_tp_clear_10pyreadstat_10pyreadstat___pyx_scope_struct__set_valu Py_XDECREF(tmp); return 0; } +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels}, + {Py_tp_clear, (void *)__pyx_tp_clear_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels}, + {Py_tp_new, (void *)__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels}, + {0, 0}, +}; +static PyType_Spec __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels_spec = { + "pyreadstat.pyreadstat.__pyx_scope_struct__set_value_labels", + sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels_slots, +}; +#else static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels = { PyVarObject_HEAD_INIT(0, 0) - "pyreadstat.pyreadstat.__pyx_scope_struct__set_value_labels", /*tp_name*/ + "pyreadstat.pyreadstat.""__pyx_scope_struct__set_value_labels", /*tp_name*/ sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels, /*tp_dealloc*/ @@ -11366,7 +13625,7 @@ static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set 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_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels, /*tp_traverse*/ __pyx_tp_clear_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels, /*tp_clear*/ @@ -11381,7 +13640,9 @@ static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels, /*tp_new*/ @@ -11395,22 +13656,37 @@ static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ #endif - #if PY_VERSION_HEX >= 0x030800b1 + #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 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif }; +#endif static struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks *__pyx_freelist_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks[8]; static int __pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks = 0; static PyObject *__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; - if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks)))) { + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (CYTHON_COMPILING_IN_CPYTHON && likely((int)(__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks)))) { o = (PyObject*)__pyx_freelist_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks[--__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks]; memset(o, 0, sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks)); (void) PyObject_INIT(o, t); @@ -11419,11 +13695,19 @@ static PyObject *__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct_1_rea o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } + #endif return o; } static void __pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks(PyObject *o) { struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks *p = (struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v__); Py_CLEAR(p->__pyx_v_chunksize); @@ -11438,7 +13722,7 @@ static void __pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read Py_CLEAR(p->__pyx_v_numrows); Py_CLEAR(p->__pyx_v_offset); Py_CLEAR(p->__pyx_v_read_function); - if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks)))) { + if (CYTHON_COMPILING_IN_CPYTHON && ((int)(__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks)))) { __pyx_freelist_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks[__pyx_freecount_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks++] = ((struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks *)o); } else { (*Py_TYPE(o)->tp_free)(o); @@ -11489,10 +13773,25 @@ static int __pyx_tp_traverse_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read } return 0; } +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks}, + {Py_tp_new, (void *)__pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks}, + {0, 0}, +}; +static PyType_Spec __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks_spec = { + "pyreadstat.pyreadstat.__pyx_scope_struct_1_read_file_in_chunks", + sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, + __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks_slots, +}; +#else static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks = { PyVarObject_HEAD_INIT(0, 0) - "pyreadstat.pyreadstat.__pyx_scope_struct_1_read_file_in_chunks", /*tp_name*/ + "pyreadstat.pyreadstat.""__pyx_scope_struct_1_read_file_in_chunks", /*tp_name*/ sizeof(struct __pyx_obj_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks, /*tp_dealloc*/ @@ -11520,7 +13819,7 @@ static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_re 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_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks, /*tp_traverse*/ 0, /*tp_clear*/ @@ -11535,7 +13834,9 @@ static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_re 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks, /*tp_new*/ @@ -11549,51 +13850,30 @@ static PyTypeObject __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_re 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ #endif - #if PY_VERSION_HEX >= 0x030800b1 + #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 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, /*tp_pypy_flags*/ + #endif }; +#endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_pyreadstat(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_pyreadstat}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "pyreadstat", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -11603,240 +13883,259 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_Categorical, __pyx_k_Categorical, sizeof(__pyx_k_Categorical), 0, 0, 1, 1}, - {&__pyx_kp_s_F_var_width_0, __pyx_k_F_var_width_0, sizeof(__pyx_k_F_var_width_0), 0, 0, 1, 0}, - {&__pyx_kp_s_N_var_width, __pyx_k_N_var_width, sizeof(__pyx_k_N_var_width), 0, 0, 1, 0}, - {&__pyx_n_s_Pool, __pyx_k_Pool, sizeof(__pyx_k_Pool), 0, 0, 1, 1}, - {&__pyx_n_s_PyreadstatError, __pyx_k_PyreadstatError, sizeof(__pyx_k_PyreadstatError), 0, 0, 1, 1}, - {&__pyx_kp_s_The_number_of_rows_of_the_file_c, __pyx_k_The_number_of_rows_of_the_file_c, sizeof(__pyx_k_The_number_of_rows_of_the_file_c), 0, 0, 1, 0}, - {&__pyx_kp_s_Version_not_supported, __pyx_k_Version_not_supported, sizeof(__pyx_k_Version_not_supported), 0, 0, 1, 0}, - {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0}, - {&__pyx_n_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1}, - {&__pyx_n_s_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 0, 0, 1, 1}, - {&__pyx_n_s_apply_value_formats, __pyx_k_apply_value_formats, sizeof(__pyx_k_apply_value_formats), 0, 0, 1, 1}, - {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, - {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, - {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, - {&__pyx_n_s_catalog, __pyx_k_catalog, sizeof(__pyx_k_catalog), 0, 0, 1, 1}, - {&__pyx_n_s_catalog_file, __pyx_k_catalog_file, sizeof(__pyx_k_catalog_file), 0, 0, 1, 1}, - {&__pyx_n_s_catalog_metadata, __pyx_k_catalog_metadata, sizeof(__pyx_k_catalog_metadata), 0, 0, 1, 1}, - {&__pyx_n_s_catalog_metadata_copy, __pyx_k_catalog_metadata_copy, sizeof(__pyx_k_catalog_metadata_copy), 0, 0, 1, 1}, - {&__pyx_n_s_categories, __pyx_k_categories, sizeof(__pyx_k_categories), 0, 0, 1, 1}, - {&__pyx_n_s_category, __pyx_k_category, sizeof(__pyx_k_category), 0, 0, 1, 1}, - {&__pyx_n_s_chunks, __pyx_k_chunks, sizeof(__pyx_k_chunks), 0, 0, 1, 1}, - {&__pyx_n_s_chunksize, __pyx_k_chunksize, sizeof(__pyx_k_chunksize), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, - {&__pyx_n_s_col_format, __pyx_k_col_format, sizeof(__pyx_k_col_format), 0, 0, 1, 1}, - {&__pyx_n_s_col_name, __pyx_k_col_name, sizeof(__pyx_k_col_name), 0, 0, 1, 1}, - {&__pyx_n_s_column_labels, __pyx_k_column_labels, sizeof(__pyx_k_column_labels), 0, 0, 1, 1}, - {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1}, - {&__pyx_n_s_compress, __pyx_k_compress, sizeof(__pyx_k_compress), 0, 0, 1, 1}, - {&__pyx_kp_s_compress_and_row_compress_cannot, __pyx_k_compress_and_row_compress_cannot, sizeof(__pyx_k_compress_and_row_compress_cannot), 0, 0, 1, 0}, - {&__pyx_n_s_concat, __pyx_k_concat, sizeof(__pyx_k_concat), 0, 0, 1, 1}, - {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, - {&__pyx_n_s_cpu_count, __pyx_k_cpu_count, sizeof(__pyx_k_cpu_count), 0, 0, 1, 1}, - {&__pyx_n_s_curcat, __pyx_k_curcat, sizeof(__pyx_k_curcat), 0, 0, 1, 1}, - {&__pyx_n_s_current_labels, __pyx_k_current_labels, sizeof(__pyx_k_current_labels), 0, 0, 1, 1}, - {&__pyx_n_s_data_frame, __pyx_k_data_frame, sizeof(__pyx_k_data_frame), 0, 0, 1, 1}, - {&__pyx_n_s_dataframe, __pyx_k_dataframe, sizeof(__pyx_k_dataframe), 0, 0, 1, 1}, - {&__pyx_n_s_dates_as_pandas, __pyx_k_dates_as_pandas, sizeof(__pyx_k_dates_as_pandas), 0, 0, 1, 1}, - {&__pyx_n_s_dates_as_pandas_datetime, __pyx_k_dates_as_pandas_datetime, sizeof(__pyx_k_dates_as_pandas_datetime), 0, 0, 1, 1}, - {&__pyx_n_s_deepcopy, __pyx_k_deepcopy, sizeof(__pyx_k_deepcopy), 0, 0, 1, 1}, - {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1}, - {&__pyx_n_s_df_copy, __pyx_k_df_copy, sizeof(__pyx_k_df_copy), 0, 0, 1, 1}, - {&__pyx_n_s_disable_datetime_conversion, __pyx_k_disable_datetime_conversion, sizeof(__pyx_k_disable_datetime_conversion), 0, 0, 1, 1}, - {&__pyx_n_s_div, __pyx_k_div, sizeof(__pyx_k_div), 0, 0, 1, 1}, - {&__pyx_n_s_divs, __pyx_k_divs, sizeof(__pyx_k_divs), 0, 0, 1, 1}, - {&__pyx_n_s_dst_path, __pyx_k_dst_path, sizeof(__pyx_k_dst_path), 0, 0, 1, 1}, - {&__pyx_n_s_dta, __pyx_k_dta, sizeof(__pyx_k_dta), 0, 0, 1, 1}, - {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, - {&__pyx_n_s_extra_date_formats, __pyx_k_extra_date_formats, sizeof(__pyx_k_extra_date_formats), 0, 0, 1, 1}, - {&__pyx_n_s_extra_datetime_formats, __pyx_k_extra_datetime_formats, sizeof(__pyx_k_extra_datetime_formats), 0, 0, 1, 1}, - {&__pyx_n_s_file_format, __pyx_k_file_format, sizeof(__pyx_k_file_format), 0, 0, 1, 1}, - {&__pyx_n_s_file_format_version, __pyx_k_file_format_version, sizeof(__pyx_k_file_format_version), 0, 0, 1, 1}, - {&__pyx_n_s_file_label, __pyx_k_file_label, sizeof(__pyx_k_file_label), 0, 0, 1, 1}, - {&__pyx_n_s_file_path, __pyx_k_file_path, sizeof(__pyx_k_file_path), 0, 0, 1, 1}, - {&__pyx_n_s_filename_path, __pyx_k_filename_path, sizeof(__pyx_k_filename_path), 0, 0, 1, 1}, - {&__pyx_n_s_final, __pyx_k_final, sizeof(__pyx_k_final), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_formats_as_category, __pyx_k_formats_as_category, sizeof(__pyx_k_formats_as_category), 0, 0, 1, 1}, - {&__pyx_n_s_formats_as_ordered_category, __pyx_k_formats_as_ordered_category, sizeof(__pyx_k_formats_as_ordered_category), 0, 0, 1, 1}, - {&__pyx_n_s_formats_presets, __pyx_k_formats_presets, sizeof(__pyx_k_formats_presets), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_ignore_index, __pyx_k_ignore_index, sizeof(__pyx_k_ignore_index), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_indx, __pyx_k_indx, sizeof(__pyx_k_indx), 0, 0, 1, 1}, - {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1}, - {&__pyx_n_s_integer, __pyx_k_integer, sizeof(__pyx_k_integer), 0, 0, 1, 1}, - {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, - {&__pyx_n_s_jobs, __pyx_k_jobs, sizeof(__pyx_k_jobs), 0, 0, 1, 1}, - {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, - {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_label_name, __pyx_k_label_name, sizeof(__pyx_k_label_name), 0, 0, 1, 1}, - {&__pyx_n_s_labels, __pyx_k_labels, sizeof(__pyx_k_labels), 0, 0, 1, 1}, - {&__pyx_n_s_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1}, - {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1}, - {&__pyx_n_s_meta, __pyx_k_meta, sizeof(__pyx_k_meta), 0, 0, 1, 1}, - {&__pyx_n_s_metadata, __pyx_k_metadata, sizeof(__pyx_k_metadata), 0, 0, 1, 1}, - {&__pyx_n_s_metadataonly, __pyx_k_metadataonly, sizeof(__pyx_k_metadataonly), 0, 0, 1, 1}, - {&__pyx_n_s_metaonly, __pyx_k_metaonly, sizeof(__pyx_k_metaonly), 0, 0, 1, 1}, - {&__pyx_n_s_missing_ranges, __pyx_k_missing_ranges, sizeof(__pyx_k_missing_ranges), 0, 0, 1, 1}, - {&__pyx_n_s_missing_user_values, __pyx_k_missing_user_values, sizeof(__pyx_k_missing_user_values), 0, 0, 1, 1}, - {&__pyx_n_s_mp, __pyx_k_mp, sizeof(__pyx_k_mp), 0, 0, 1, 1}, - {&__pyx_n_s_multiprocess, __pyx_k_multiprocess, sizeof(__pyx_k_multiprocess), 0, 0, 1, 1}, - {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing, sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_no_datetime_conversion, __pyx_k_no_datetime_conversion, sizeof(__pyx_k_no_datetime_conversion), 0, 0, 1, 1}, - {&__pyx_n_s_note, __pyx_k_note, sizeof(__pyx_k_note), 0, 0, 1, 1}, - {&__pyx_n_s_num_processes, __pyx_k_num_processes, sizeof(__pyx_k_num_processes), 0, 0, 1, 1}, - {&__pyx_n_s_num_rows, __pyx_k_num_rows, sizeof(__pyx_k_num_rows), 0, 0, 1, 1}, - {&__pyx_kp_s_num_rows_must_be_specified_for_r, __pyx_k_num_rows_must_be_specified_for_r, sizeof(__pyx_k_num_rows_must_be_specified_for_r), 0, 0, 1, 0}, - {&__pyx_n_s_number_rows, __pyx_k_number_rows, sizeof(__pyx_k_number_rows), 0, 0, 1, 1}, - {&__pyx_n_s_numrows, __pyx_k_numrows, sizeof(__pyx_k_numrows), 0, 0, 1, 1}, - {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1}, - {&__pyx_n_s_offsets, __pyx_k_offsets, sizeof(__pyx_k_offsets), 0, 0, 1, 1}, - {&__pyx_n_s_ordered, __pyx_k_ordered, sizeof(__pyx_k_ordered), 0, 0, 1, 1}, - {&__pyx_n_s_original_values, __pyx_k_original_values, sizeof(__pyx_k_original_values), 0, 0, 1, 1}, - {&__pyx_n_s_orival, __pyx_k_orival, sizeof(__pyx_k_orival), 0, 0, 1, 1}, - {&__pyx_n_s_output_format, __pyx_k_output_format, sizeof(__pyx_k_output_format), 0, 0, 1, 1}, - {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, - {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1}, - {&__pyx_n_s_pool, __pyx_k_pool, sizeof(__pyx_k_pool), 0, 0, 1, 1}, - {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1}, - {&__pyx_n_s_por, __pyx_k_por, sizeof(__pyx_k_por), 0, 0, 1, 1}, - {&__pyx_n_s_prev_div, __pyx_k_prev_div, sizeof(__pyx_k_prev_div), 0, 0, 1, 1}, - {&__pyx_n_s_prev_offset, __pyx_k_prev_offset, sizeof(__pyx_k_prev_offset), 0, 0, 1, 1}, - {&__pyx_n_s_processes, __pyx_k_processes, sizeof(__pyx_k_processes), 0, 0, 1, 1}, - {&__pyx_n_s_pyreadstat_pyreadstat, __pyx_k_pyreadstat_pyreadstat, sizeof(__pyx_k_pyreadstat_pyreadstat), 0, 0, 1, 1}, - {&__pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_k_pyreadstat_pyreadstat_pyx, sizeof(__pyx_k_pyreadstat_pyreadstat_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_read_dta, __pyx_k_read_dta, sizeof(__pyx_k_read_dta), 0, 0, 1, 1}, - {&__pyx_n_s_read_file_in_chunks, __pyx_k_read_file_in_chunks, sizeof(__pyx_k_read_file_in_chunks), 0, 0, 1, 1}, - {&__pyx_n_s_read_file_multiprocessing, __pyx_k_read_file_multiprocessing, sizeof(__pyx_k_read_file_multiprocessing), 0, 0, 1, 1}, - {&__pyx_n_s_read_function, __pyx_k_read_function, sizeof(__pyx_k_read_function), 0, 0, 1, 1}, - {&__pyx_n_s_read_por, __pyx_k_read_por, sizeof(__pyx_k_read_por), 0, 0, 1, 1}, - {&__pyx_n_s_read_sas7bcat, __pyx_k_read_sas7bcat, sizeof(__pyx_k_read_sas7bcat), 0, 0, 1, 1}, - {&__pyx_kp_s_read_sas7bcat_is_not_supported, __pyx_k_read_sas7bcat_is_not_supported, sizeof(__pyx_k_read_sas7bcat_is_not_supported), 0, 0, 1, 0}, - {&__pyx_kp_s_read_sas7bcat_not_supported, __pyx_k_read_sas7bcat_not_supported, sizeof(__pyx_k_read_sas7bcat_not_supported), 0, 0, 1, 0}, - {&__pyx_n_s_read_sas7bdat, __pyx_k_read_sas7bdat, sizeof(__pyx_k_read_sas7bdat), 0, 0, 1, 1}, - {&__pyx_n_s_read_sav, __pyx_k_read_sav, sizeof(__pyx_k_read_sav), 0, 0, 1, 1}, - {&__pyx_n_s_read_xport, __pyx_k_read_xport, sizeof(__pyx_k_read_xport), 0, 0, 1, 1}, - {&__pyx_n_s_readstat_parser, __pyx_k_readstat_parser, sizeof(__pyx_k_readstat_parser), 0, 0, 1, 1}, - {&__pyx_n_s_restricted_integer, __pyx_k_restricted_integer, sizeof(__pyx_k_restricted_integer), 0, 0, 1, 1}, - {&__pyx_n_s_revdict, __pyx_k_revdict, sizeof(__pyx_k_revdict), 0, 0, 1, 1}, - {&__pyx_n_s_row_compress, __pyx_k_row_compress, sizeof(__pyx_k_row_compress), 0, 0, 1, 1}, - {&__pyx_n_s_row_compression, __pyx_k_row_compression, sizeof(__pyx_k_row_compression), 0, 0, 1, 1}, - {&__pyx_n_s_row_limit, __pyx_k_row_limit, sizeof(__pyx_k_row_limit), 0, 0, 1, 1}, - {&__pyx_n_s_row_offset, __pyx_k_row_offset, sizeof(__pyx_k_row_offset), 0, 0, 1, 1}, - {&__pyx_n_s_sas7bcat, __pyx_k_sas7bcat, sizeof(__pyx_k_sas7bcat), 0, 0, 1, 1}, - {&__pyx_n_s_sas7bdat, __pyx_k_sas7bdat, sizeof(__pyx_k_sas7bdat), 0, 0, 1, 1}, - {&__pyx_n_s_sas_dataframe, __pyx_k_sas_dataframe, sizeof(__pyx_k_sas_dataframe), 0, 0, 1, 1}, - {&__pyx_n_s_sas_metadata, __pyx_k_sas_metadata, sizeof(__pyx_k_sas_metadata), 0, 0, 1, 1}, - {&__pyx_kp_s_sav_zsav, __pyx_k_sav_zsav, sizeof(__pyx_k_sav_zsav), 0, 0, 1, 0}, - {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, - {&__pyx_n_s_set_catalog_to_sas, __pyx_k_set_catalog_to_sas, sizeof(__pyx_k_set_catalog_to_sas), 0, 0, 1, 1}, - {&__pyx_n_s_set_value_labels, __pyx_k_set_value_labels, sizeof(__pyx_k_set_value_labels), 0, 0, 1, 1}, - {&__pyx_n_s_set_value_labels_locals_lambda, __pyx_k_set_value_labels_locals_lambda, sizeof(__pyx_k_set_value_labels_locals_lambda), 0, 0, 1, 1}, - {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1}, - {&__pyx_n_s_table_name, __pyx_k_table_name, sizeof(__pyx_k_table_name), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, - {&__pyx_n_s_usecols, __pyx_k_usecols, sizeof(__pyx_k_usecols), 0, 0, 1, 1}, - {&__pyx_n_s_user_missing, __pyx_k_user_missing, sizeof(__pyx_k_user_missing), 0, 0, 1, 1}, - {&__pyx_n_s_usernan, __pyx_k_usernan, sizeof(__pyx_k_usernan), 0, 0, 1, 1}, - {&__pyx_n_s_value_labels, __pyx_k_value_labels, sizeof(__pyx_k_value_labels), 0, 0, 1, 1}, - {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, - {&__pyx_n_s_var_label, __pyx_k_var_label, sizeof(__pyx_k_var_label), 0, 0, 1, 1}, - {&__pyx_n_s_var_name, __pyx_k_var_name, sizeof(__pyx_k_var_name), 0, 0, 1, 1}, - {&__pyx_n_s_var_width, __pyx_k_var_width, sizeof(__pyx_k_var_width), 0, 0, 1, 1}, - {&__pyx_n_s_variable_alignment, __pyx_k_variable_alignment, sizeof(__pyx_k_variable_alignment), 0, 0, 1, 1}, - {&__pyx_n_s_variable_display_width, __pyx_k_variable_display_width, sizeof(__pyx_k_variable_display_width), 0, 0, 1, 1}, - {&__pyx_n_s_variable_format, __pyx_k_variable_format, sizeof(__pyx_k_variable_format), 0, 0, 1, 1}, - {&__pyx_n_s_variable_measure, __pyx_k_variable_measure, sizeof(__pyx_k_variable_measure), 0, 0, 1, 1}, - {&__pyx_n_s_variable_to_label, __pyx_k_variable_to_label, sizeof(__pyx_k_variable_to_label), 0, 0, 1, 1}, - {&__pyx_n_s_variable_value_labels, __pyx_k_variable_value_labels, sizeof(__pyx_k_variable_value_labels), 0, 0, 1, 1}, - {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, - {&__pyx_n_s_worker, __pyx_k_worker, sizeof(__pyx_k_worker), 0, 0, 1, 1}, - {&__pyx_n_s_write_dta, __pyx_k_write_dta, sizeof(__pyx_k_write_dta), 0, 0, 1, 1}, - {&__pyx_n_s_write_por, __pyx_k_write_por, sizeof(__pyx_k_write_por), 0, 0, 1, 1}, - {&__pyx_n_s_write_sav, __pyx_k_write_sav, sizeof(__pyx_k_write_sav), 0, 0, 1, 1}, - {&__pyx_n_s_write_xport, __pyx_k_write_xport, sizeof(__pyx_k_write_xport), 0, 0, 1, 1}, - {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, - {&__pyx_n_s_xport, __pyx_k_xport, sizeof(__pyx_k_xport), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_Categorical, __pyx_k_Categorical, sizeof(__pyx_k_Categorical), 0, 0, 1, 1}, + {&__pyx_kp_s_F_var_width_0, __pyx_k_F_var_width_0, sizeof(__pyx_k_F_var_width_0), 0, 0, 1, 0}, + {&__pyx_kp_s_N_var_width, __pyx_k_N_var_width, sizeof(__pyx_k_N_var_width), 0, 0, 1, 0}, + {&__pyx_n_s_Pool, __pyx_k_Pool, sizeof(__pyx_k_Pool), 0, 0, 1, 1}, + {&__pyx_n_s_PyreadstatError, __pyx_k_PyreadstatError, sizeof(__pyx_k_PyreadstatError), 0, 0, 1, 1}, + {&__pyx_kp_s_The_number_of_rows_of_the_file_c, __pyx_k_The_number_of_rows_of_the_file_c, sizeof(__pyx_k_The_number_of_rows_of_the_file_c), 0, 0, 1, 0}, + {&__pyx_kp_s_Version_not_supported, __pyx_k_Version_not_supported, sizeof(__pyx_k_Version_not_supported), 0, 0, 1, 0}, + {&__pyx_n_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 1}, + {&__pyx_n_s__44, __pyx_k__44, sizeof(__pyx_k__44), 0, 0, 1, 1}, + {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0}, + {&__pyx_n_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1}, + {&__pyx_kp_u__9, __pyx_k__9, sizeof(__pyx_k__9), 0, 1, 0, 0}, + {&__pyx_n_s_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 0, 0, 1, 1}, + {&__pyx_n_s_apply_value_formats, __pyx_k_apply_value_formats, sizeof(__pyx_k_apply_value_formats), 0, 0, 1, 1}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, + {&__pyx_n_s_catalog, __pyx_k_catalog, sizeof(__pyx_k_catalog), 0, 0, 1, 1}, + {&__pyx_n_s_catalog_file, __pyx_k_catalog_file, sizeof(__pyx_k_catalog_file), 0, 0, 1, 1}, + {&__pyx_n_s_catalog_metadata, __pyx_k_catalog_metadata, sizeof(__pyx_k_catalog_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_catalog_metadata_copy, __pyx_k_catalog_metadata_copy, sizeof(__pyx_k_catalog_metadata_copy), 0, 0, 1, 1}, + {&__pyx_n_s_categories, __pyx_k_categories, sizeof(__pyx_k_categories), 0, 0, 1, 1}, + {&__pyx_n_s_category, __pyx_k_category, sizeof(__pyx_k_category), 0, 0, 1, 1}, + {&__pyx_n_s_chunks, __pyx_k_chunks, sizeof(__pyx_k_chunks), 0, 0, 1, 1}, + {&__pyx_n_s_chunksize, __pyx_k_chunksize, sizeof(__pyx_k_chunksize), 0, 0, 1, 1}, + {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, + {&__pyx_n_s_col_format, __pyx_k_col_format, sizeof(__pyx_k_col_format), 0, 0, 1, 1}, + {&__pyx_n_s_col_name, __pyx_k_col_name, sizeof(__pyx_k_col_name), 0, 0, 1, 1}, + {&__pyx_n_s_column_labels, __pyx_k_column_labels, sizeof(__pyx_k_column_labels), 0, 0, 1, 1}, + {&__pyx_n_s_columns, __pyx_k_columns, sizeof(__pyx_k_columns), 0, 0, 1, 1}, + {&__pyx_n_s_compress, __pyx_k_compress, sizeof(__pyx_k_compress), 0, 0, 1, 1}, + {&__pyx_kp_s_compress_and_row_compress_cannot, __pyx_k_compress_and_row_compress_cannot, sizeof(__pyx_k_compress_and_row_compress_cannot), 0, 0, 1, 0}, + {&__pyx_n_s_concat, __pyx_k_concat, sizeof(__pyx_k_concat), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_count, __pyx_k_cpu_count, sizeof(__pyx_k_cpu_count), 0, 0, 1, 1}, + {&__pyx_n_s_curcat, __pyx_k_curcat, sizeof(__pyx_k_curcat), 0, 0, 1, 1}, + {&__pyx_n_s_current_labels, __pyx_k_current_labels, sizeof(__pyx_k_current_labels), 0, 0, 1, 1}, + {&__pyx_n_s_data_frame, __pyx_k_data_frame, sizeof(__pyx_k_data_frame), 0, 0, 1, 1}, + {&__pyx_n_s_dataframe, __pyx_k_dataframe, sizeof(__pyx_k_dataframe), 0, 0, 1, 1}, + {&__pyx_n_s_dates_as_pandas, __pyx_k_dates_as_pandas, sizeof(__pyx_k_dates_as_pandas), 0, 0, 1, 1}, + {&__pyx_n_s_dates_as_pandas_datetime, __pyx_k_dates_as_pandas_datetime, sizeof(__pyx_k_dates_as_pandas_datetime), 0, 0, 1, 1}, + {&__pyx_n_s_deepcopy, __pyx_k_deepcopy, sizeof(__pyx_k_deepcopy), 0, 0, 1, 1}, + {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1}, + {&__pyx_n_s_df_copy, __pyx_k_df_copy, sizeof(__pyx_k_df_copy), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_disable_datetime_conversion, __pyx_k_disable_datetime_conversion, sizeof(__pyx_k_disable_datetime_conversion), 0, 0, 1, 1}, + {&__pyx_n_s_div, __pyx_k_div, sizeof(__pyx_k_div), 0, 0, 1, 1}, + {&__pyx_n_s_divs, __pyx_k_divs, sizeof(__pyx_k_divs), 0, 0, 1, 1}, + {&__pyx_n_s_dst_path, __pyx_k_dst_path, sizeof(__pyx_k_dst_path), 0, 0, 1, 1}, + {&__pyx_n_s_dta, __pyx_k_dta, sizeof(__pyx_k_dta), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_extra_date_formats, __pyx_k_extra_date_formats, sizeof(__pyx_k_extra_date_formats), 0, 0, 1, 1}, + {&__pyx_n_s_extra_datetime_formats, __pyx_k_extra_datetime_formats, sizeof(__pyx_k_extra_datetime_formats), 0, 0, 1, 1}, + {&__pyx_n_s_file_extension, __pyx_k_file_extension, sizeof(__pyx_k_file_extension), 0, 0, 1, 1}, + {&__pyx_n_s_file_format, __pyx_k_file_format, sizeof(__pyx_k_file_format), 0, 0, 1, 1}, + {&__pyx_n_s_file_format_version, __pyx_k_file_format_version, sizeof(__pyx_k_file_format_version), 0, 0, 1, 1}, + {&__pyx_n_s_file_label, __pyx_k_file_label, sizeof(__pyx_k_file_label), 0, 0, 1, 1}, + {&__pyx_n_s_file_path, __pyx_k_file_path, sizeof(__pyx_k_file_path), 0, 0, 1, 1}, + {&__pyx_n_s_filename_path, __pyx_k_filename_path, sizeof(__pyx_k_filename_path), 0, 0, 1, 1}, + {&__pyx_n_s_final, __pyx_k_final, sizeof(__pyx_k_final), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_formats_as_category, __pyx_k_formats_as_category, sizeof(__pyx_k_formats_as_category), 0, 0, 1, 1}, + {&__pyx_n_s_formats_as_ordered_category, __pyx_k_formats_as_ordered_category, sizeof(__pyx_k_formats_as_ordered_category), 0, 0, 1, 1}, + {&__pyx_n_s_formats_presets, __pyx_k_formats_presets, sizeof(__pyx_k_formats_presets), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_ignore_index, __pyx_k_ignore_index, sizeof(__pyx_k_ignore_index), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_indx, __pyx_k_indx, sizeof(__pyx_k_indx), 0, 0, 1, 1}, + {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_integer, __pyx_k_integer, sizeof(__pyx_k_integer), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, + {&__pyx_n_s_jobs, __pyx_k_jobs, sizeof(__pyx_k_jobs), 0, 0, 1, 1}, + {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1}, + {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, + {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, + {&__pyx_n_s_label_name, __pyx_k_label_name, sizeof(__pyx_k_label_name), 0, 0, 1, 1}, + {&__pyx_n_s_labels, __pyx_k_labels, sizeof(__pyx_k_labels), 0, 0, 1, 1}, + {&__pyx_n_s_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_map, __pyx_k_map, sizeof(__pyx_k_map), 0, 0, 1, 1}, + {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1}, + {&__pyx_n_s_meta, __pyx_k_meta, sizeof(__pyx_k_meta), 0, 0, 1, 1}, + {&__pyx_n_s_metadata, __pyx_k_metadata, sizeof(__pyx_k_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_metadataonly, __pyx_k_metadataonly, sizeof(__pyx_k_metadataonly), 0, 0, 1, 1}, + {&__pyx_n_s_metaonly, __pyx_k_metaonly, sizeof(__pyx_k_metaonly), 0, 0, 1, 1}, + {&__pyx_n_s_missing_ranges, __pyx_k_missing_ranges, sizeof(__pyx_k_missing_ranges), 0, 0, 1, 1}, + {&__pyx_n_s_missing_user_values, __pyx_k_missing_user_values, sizeof(__pyx_k_missing_user_values), 0, 0, 1, 1}, + {&__pyx_n_s_mp, __pyx_k_mp, sizeof(__pyx_k_mp), 0, 0, 1, 1}, + {&__pyx_n_s_multiprocess, __pyx_k_multiprocess, sizeof(__pyx_k_multiprocess), 0, 0, 1, 1}, + {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing, sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_no_datetime_conversion, __pyx_k_no_datetime_conversion, sizeof(__pyx_k_no_datetime_conversion), 0, 0, 1, 1}, + {&__pyx_n_s_note, __pyx_k_note, sizeof(__pyx_k_note), 0, 0, 1, 1}, + {&__pyx_n_s_num_processes, __pyx_k_num_processes, sizeof(__pyx_k_num_processes), 0, 0, 1, 1}, + {&__pyx_n_s_num_rows, __pyx_k_num_rows, sizeof(__pyx_k_num_rows), 0, 0, 1, 1}, + {&__pyx_kp_s_num_rows_must_be_specified_for_r, __pyx_k_num_rows_must_be_specified_for_r, sizeof(__pyx_k_num_rows_must_be_specified_for_r), 0, 0, 1, 0}, + {&__pyx_n_s_number_rows, __pyx_k_number_rows, sizeof(__pyx_k_number_rows), 0, 0, 1, 1}, + {&__pyx_n_s_numrows, __pyx_k_numrows, sizeof(__pyx_k_numrows), 0, 0, 1, 1}, + {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1}, + {&__pyx_n_s_offsets, __pyx_k_offsets, sizeof(__pyx_k_offsets), 0, 0, 1, 1}, + {&__pyx_n_s_ordered, __pyx_k_ordered, sizeof(__pyx_k_ordered), 0, 0, 1, 1}, + {&__pyx_n_s_original_values, __pyx_k_original_values, sizeof(__pyx_k_original_values), 0, 0, 1, 1}, + {&__pyx_n_s_orival, __pyx_k_orival, sizeof(__pyx_k_orival), 0, 0, 1, 1}, + {&__pyx_n_s_output_format, __pyx_k_output_format, sizeof(__pyx_k_output_format), 0, 0, 1, 1}, + {&__pyx_n_s_pandas, __pyx_k_pandas, sizeof(__pyx_k_pandas), 0, 0, 1, 1}, + {&__pyx_n_s_pd, __pyx_k_pd, sizeof(__pyx_k_pd), 0, 0, 1, 1}, + {&__pyx_n_s_pool, __pyx_k_pool, sizeof(__pyx_k_pool), 0, 0, 1, 1}, + {&__pyx_n_s_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 0, 0, 1, 1}, + {&__pyx_n_s_por, __pyx_k_por, sizeof(__pyx_k_por), 0, 0, 1, 1}, + {&__pyx_n_s_prev_div, __pyx_k_prev_div, sizeof(__pyx_k_prev_div), 0, 0, 1, 1}, + {&__pyx_n_s_prev_offset, __pyx_k_prev_offset, sizeof(__pyx_k_prev_offset), 0, 0, 1, 1}, + {&__pyx_n_s_processes, __pyx_k_processes, sizeof(__pyx_k_processes), 0, 0, 1, 1}, + {&__pyx_n_s_pyreadstat_pyreadstat, __pyx_k_pyreadstat_pyreadstat, sizeof(__pyx_k_pyreadstat_pyreadstat), 0, 0, 1, 1}, + {&__pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_k_pyreadstat_pyreadstat_pyx, sizeof(__pyx_k_pyreadstat_pyreadstat_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_read_dta, __pyx_k_read_dta, sizeof(__pyx_k_read_dta), 0, 0, 1, 1}, + {&__pyx_n_s_read_file_in_chunks, __pyx_k_read_file_in_chunks, sizeof(__pyx_k_read_file_in_chunks), 0, 0, 1, 1}, + {&__pyx_n_s_read_file_multiprocessing, __pyx_k_read_file_multiprocessing, sizeof(__pyx_k_read_file_multiprocessing), 0, 0, 1, 1}, + {&__pyx_n_s_read_function, __pyx_k_read_function, sizeof(__pyx_k_read_function), 0, 0, 1, 1}, + {&__pyx_n_s_read_por, __pyx_k_read_por, sizeof(__pyx_k_read_por), 0, 0, 1, 1}, + {&__pyx_n_s_read_sas7bcat, __pyx_k_read_sas7bcat, sizeof(__pyx_k_read_sas7bcat), 0, 0, 1, 1}, + {&__pyx_kp_s_read_sas7bcat_is_not_supported, __pyx_k_read_sas7bcat_is_not_supported, sizeof(__pyx_k_read_sas7bcat_is_not_supported), 0, 0, 1, 0}, + {&__pyx_kp_s_read_sas7bcat_not_supported, __pyx_k_read_sas7bcat_not_supported, sizeof(__pyx_k_read_sas7bcat_not_supported), 0, 0, 1, 0}, + {&__pyx_n_s_read_sas7bdat, __pyx_k_read_sas7bdat, sizeof(__pyx_k_read_sas7bdat), 0, 0, 1, 1}, + {&__pyx_n_s_read_sav, __pyx_k_read_sav, sizeof(__pyx_k_read_sav), 0, 0, 1, 1}, + {&__pyx_n_s_read_xport, __pyx_k_read_xport, sizeof(__pyx_k_read_xport), 0, 0, 1, 1}, + {&__pyx_n_s_readstat_parser, __pyx_k_readstat_parser, sizeof(__pyx_k_readstat_parser), 0, 0, 1, 1}, + {&__pyx_n_s_restricted_integer, __pyx_k_restricted_integer, sizeof(__pyx_k_restricted_integer), 0, 0, 1, 1}, + {&__pyx_n_s_revdict, __pyx_k_revdict, sizeof(__pyx_k_revdict), 0, 0, 1, 1}, + {&__pyx_n_s_row_compress, __pyx_k_row_compress, sizeof(__pyx_k_row_compress), 0, 0, 1, 1}, + {&__pyx_n_s_row_compression, __pyx_k_row_compression, sizeof(__pyx_k_row_compression), 0, 0, 1, 1}, + {&__pyx_n_s_row_limit, __pyx_k_row_limit, sizeof(__pyx_k_row_limit), 0, 0, 1, 1}, + {&__pyx_n_s_row_offset, __pyx_k_row_offset, sizeof(__pyx_k_row_offset), 0, 0, 1, 1}, + {&__pyx_n_s_sas7bcat, __pyx_k_sas7bcat, sizeof(__pyx_k_sas7bcat), 0, 0, 1, 1}, + {&__pyx_n_s_sas7bdat, __pyx_k_sas7bdat, sizeof(__pyx_k_sas7bdat), 0, 0, 1, 1}, + {&__pyx_n_s_sas_dataframe, __pyx_k_sas_dataframe, sizeof(__pyx_k_sas_dataframe), 0, 0, 1, 1}, + {&__pyx_n_s_sas_metadata, __pyx_k_sas_metadata, sizeof(__pyx_k_sas_metadata), 0, 0, 1, 1}, + {&__pyx_kp_s_sav_zsav, __pyx_k_sav_zsav, sizeof(__pyx_k_sav_zsav), 0, 0, 1, 0}, + {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, + {&__pyx_n_s_set_catalog_to_sas, __pyx_k_set_catalog_to_sas, sizeof(__pyx_k_set_catalog_to_sas), 0, 0, 1, 1}, + {&__pyx_n_s_set_value_labels, __pyx_k_set_value_labels, sizeof(__pyx_k_set_value_labels), 0, 0, 1, 1}, + {&__pyx_n_s_set_value_labels_locals_lambda, __pyx_k_set_value_labels_locals_lambda, sizeof(__pyx_k_set_value_labels_locals_lambda), 0, 0, 1, 1}, + {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_table_name, __pyx_k_table_name, sizeof(__pyx_k_table_name), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, + {&__pyx_n_s_usecols, __pyx_k_usecols, sizeof(__pyx_k_usecols), 0, 0, 1, 1}, + {&__pyx_n_s_user_missing, __pyx_k_user_missing, sizeof(__pyx_k_user_missing), 0, 0, 1, 1}, + {&__pyx_n_s_usernan, __pyx_k_usernan, sizeof(__pyx_k_usernan), 0, 0, 1, 1}, + {&__pyx_n_s_value_labels, __pyx_k_value_labels, sizeof(__pyx_k_value_labels), 0, 0, 1, 1}, + {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, + {&__pyx_n_s_var_label, __pyx_k_var_label, sizeof(__pyx_k_var_label), 0, 0, 1, 1}, + {&__pyx_n_s_var_name, __pyx_k_var_name, sizeof(__pyx_k_var_name), 0, 0, 1, 1}, + {&__pyx_n_s_var_width, __pyx_k_var_width, sizeof(__pyx_k_var_width), 0, 0, 1, 1}, + {&__pyx_n_s_variable_alignment, __pyx_k_variable_alignment, sizeof(__pyx_k_variable_alignment), 0, 0, 1, 1}, + {&__pyx_n_s_variable_display_width, __pyx_k_variable_display_width, sizeof(__pyx_k_variable_display_width), 0, 0, 1, 1}, + {&__pyx_n_s_variable_format, __pyx_k_variable_format, sizeof(__pyx_k_variable_format), 0, 0, 1, 1}, + {&__pyx_n_s_variable_measure, __pyx_k_variable_measure, sizeof(__pyx_k_variable_measure), 0, 0, 1, 1}, + {&__pyx_n_s_variable_to_label, __pyx_k_variable_to_label, sizeof(__pyx_k_variable_to_label), 0, 0, 1, 1}, + {&__pyx_n_s_variable_value_labels, __pyx_k_variable_value_labels, sizeof(__pyx_k_variable_value_labels), 0, 0, 1, 1}, + {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, + {&__pyx_n_s_worker, __pyx_k_worker, sizeof(__pyx_k_worker), 0, 0, 1, 1}, + {&__pyx_n_s_write_dta, __pyx_k_write_dta, sizeof(__pyx_k_write_dta), 0, 0, 1, 1}, + {&__pyx_n_s_write_por, __pyx_k_write_por, sizeof(__pyx_k_write_por), 0, 0, 1, 1}, + {&__pyx_n_s_write_sav, __pyx_k_write_sav, sizeof(__pyx_k_write_sav), 0, 0, 1, 1}, + {&__pyx_n_s_write_xport, __pyx_k_write_xport, sizeof(__pyx_k_write_xport), 0, 0, 1, 1}, + {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, + {&__pyx_n_s_xport, __pyx_k_xport, sizeof(__pyx_k_xport), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 776, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 780, __pyx_L1_error) - __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 867, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 782, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 786, __pyx_L1_error) + __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 873, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "pyreadstat/pyreadstat.pyx":689 + /* "pyreadstat/pyreadstat.pyx":695 * * if read_function == read_sas7bcat: * raise Exception("read_sas7bcat not supported") # <<<<<<<<<<<<<< * * if "row_offset" in kwargs: */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_read_sas7bcat_not_supported); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 689, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_read_sas7bcat_not_supported); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "pyreadstat/pyreadstat.pyx":754 + /* "pyreadstat/pyreadstat.pyx":760 * * if read_function in (read_sas7bcat,): * raise Exception("read_sas7bcat is not supported") # <<<<<<<<<<<<<< * * if read_function in (read_xport, read_por) and num_rows is None: */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_read_sas7bcat_is_not_supported); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 754, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_read_sas7bcat_is_not_supported); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "pyreadstat/pyreadstat.pyx":757 + /* "pyreadstat/pyreadstat.pyx":763 * * if read_function in (read_xport, read_por) and num_rows is None: * raise Exception("num_rows must be specified for read_xport and read_por to be a number equal or larger than the number of rows in the dataset.") # <<<<<<<<<<<<<< * * if not num_processes: */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_num_rows_must_be_specified_for_r); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 757, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_num_rows_must_be_specified_for_r); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 763, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "pyreadstat/pyreadstat.pyx":770 + /* "pyreadstat/pyreadstat.pyx":776 * if numrows is None: * if num_rows is None: * raise Exception("The number of rows of the file cannot be determined from the file's metadata. If you still want to proceed, please set num_rows to a number equal or larger than the number of rows of your data") # <<<<<<<<<<<<<< * numrows = num_rows * elif numrows == 0: */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_The_number_of_rows_of_the_file_c); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 770, __pyx_L1_error) + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_The_number_of_rows_of_the_file_c); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "pyreadstat/pyreadstat.pyx":921 + /* "pyreadstat/pyreadstat.pyx":927 * file_format_version = 113 * else: * raise Exception("Version not supported") # <<<<<<<<<<<<<< * * cdef str note = "" */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Version_not_supported); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Version_not_supported); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); @@ -11847,179 +14146,202 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, */ - __pyx_tuple__9 = PyTuple_Pack(24, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_catalog_file, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_user_missing, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_data_frame, __pyx_n_s_metadata, __pyx_n_s__8, __pyx_n_s_catalog); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(15, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_sas7bdat, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(25, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_catalog_file, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_user_missing, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_file_extension, __pyx_n_s_data_frame, __pyx_n_s_metadata, __pyx_n_s__10, __pyx_n_s_catalog); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(15, 0, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_sas7bdat, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 41, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":140 + /* "pyreadstat/pyreadstat.pyx":141 * * * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, # <<<<<<<<<<<<<< * list usecols=None, disable_datetime_conversion=False, int row_limit=0, int row_offset=0, * str output_format=None, list extra_datetime_formats=None, list extra_date_formats=None): */ - __pyx_tuple__11 = PyTuple_Pack(18, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(11, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_xport, 140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(19, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_file_extension, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(11, 0, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_xport, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 141, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":212 + /* "pyreadstat/pyreadstat.pyx":214 * * * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, */ - __pyx_tuple__13 = PyTuple_Pack(22, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_apply_value_formats, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_user_missing, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(15, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_dta, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(23, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_apply_value_formats, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_user_missing, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_file_extension, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(15, 0, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_dta, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 214, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":304 + /* "pyreadstat/pyreadstat.pyx":307 * * * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, list extra_datetime_formats=None, */ - __pyx_tuple__15 = PyTuple_Pack(22, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_apply_value_formats, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_user_missing, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(15, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_sav, 304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 304, __pyx_L1_error) + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(15, 0, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_sav, 307, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 307, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":396 + /* "pyreadstat/pyreadstat.pyx":400 * * * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, */ - __pyx_tuple__17 = PyTuple_Pack(21, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_apply_value_formats, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(14, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_por, 396, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 396, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(22, __pyx_n_s_filename_path, __pyx_n_s_metadataonly, __pyx_n_s_dates_as_pandas_datetime, __pyx_n_s_apply_value_formats, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_encoding, __pyx_n_s_usecols, __pyx_n_s_disable_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_output_format, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_file_format, __pyx_n_s_file_extension, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(14, 0, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_por, 400, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 400, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":482 + /* "pyreadstat/pyreadstat.pyx":487 * * * def read_sas7bcat(filename_path, str encoding=None, str output_format=None): # <<<<<<<<<<<<<< * r""" * Read a SAS sas7bcat file. The returning dataframe will be empty. The metadata object will contain a dictionary */ - __pyx_tuple__19 = PyTuple_Pack(15, __pyx_n_s_filename_path, __pyx_n_s_encoding, __pyx_n_s_output_format, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usecols, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_file_format, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_sas7bcat, 482, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 482, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(16, __pyx_n_s_filename_path, __pyx_n_s_encoding, __pyx_n_s_output_format, __pyx_n_s_metaonly, __pyx_n_s_dates_as_pandas, __pyx_n_s_usecols, __pyx_n_s_usernan, __pyx_n_s_no_datetime_conversion, __pyx_n_s_row_limit, __pyx_n_s_row_offset, __pyx_n_s_extra_datetime_formats, __pyx_n_s_extra_date_formats, __pyx_n_s_file_format, __pyx_n_s_file_extension, __pyx_n_s_data_frame, __pyx_n_s_metadata); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_sas7bcat, 487, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 487, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); - /* "pyreadstat/pyreadstat.pyx":534 + /* "pyreadstat/pyreadstat.pyx":540 * * * def set_value_labels(dataframe, metadata, formats_as_category=True, formats_as_ordered_category=False): # <<<<<<<<<<<<<< * """ * Changes the values in the dataframe according to the value formats in the metadata. */ - __pyx_tuple__21 = PyTuple_Pack(13, __pyx_n_s_dataframe, __pyx_n_s_metadata, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_df_copy, __pyx_n_s_var_name, __pyx_n_s_label_name, __pyx_n_s_labels, __pyx_n_s_categories, __pyx_n_s_original_values, __pyx_n_s_revdict, __pyx_n_s_orival, __pyx_n_s_curcat); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_set_value_labels, 534, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 534, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(13, __pyx_n_s_dataframe, __pyx_n_s_metadata, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_df_copy, __pyx_n_s_var_name, __pyx_n_s_label_name, __pyx_n_s_labels, __pyx_n_s_categories, __pyx_n_s_original_values, __pyx_n_s_revdict, __pyx_n_s_orival, __pyx_n_s_curcat); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_set_value_labels, 540, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(2, ((PyObject *)Py_True), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); - /* "pyreadstat/pyreadstat.pyx":589 + /* "pyreadstat/pyreadstat.pyx":595 * return df_copy * * def set_catalog_to_sas(sas_dataframe, sas_metadata, catalog_metadata, formats_as_category=True, # <<<<<<<<<<<<<< * formats_as_ordered_category=False): * """ */ - __pyx_tuple__23 = PyTuple_Pack(12, __pyx_n_s_sas_dataframe, __pyx_n_s_sas_metadata, __pyx_n_s_catalog_metadata, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_catalog_metadata_copy, __pyx_n_s_metadata, __pyx_n_s_df_copy, __pyx_n_s_variable_value_labels, __pyx_n_s_var_name, __pyx_n_s_var_label, __pyx_n_s_current_labels); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_set_catalog_to_sas, 589, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 589, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(12, __pyx_n_s_sas_dataframe, __pyx_n_s_sas_metadata, __pyx_n_s_catalog_metadata, __pyx_n_s_formats_as_category, __pyx_n_s_formats_as_ordered_category, __pyx_n_s_catalog_metadata_copy, __pyx_n_s_metadata, __pyx_n_s_df_copy, __pyx_n_s_variable_value_labels, __pyx_n_s_var_name, __pyx_n_s_var_label, __pyx_n_s_current_labels); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_set_catalog_to_sas, 595, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(2, ((PyObject *)Py_True), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); - /* "pyreadstat/pyreadstat.pyx":642 + /* "pyreadstat/pyreadstat.pyx":648 * # convenience functions to read in chunks * * def read_file_in_chunks(read_function, file_path, chunksize=100000, offset=0, limit=0, # <<<<<<<<<<<<<< * multiprocess=False, num_processes=4, num_rows=None, **kwargs): * """ */ - __pyx_tuple__25 = PyTuple_Pack(13, __pyx_n_s_read_function, __pyx_n_s_file_path, __pyx_n_s_chunksize, __pyx_n_s_offset, __pyx_n_s_limit, __pyx_n_s_multiprocess, __pyx_n_s_num_processes, __pyx_n_s_num_rows, __pyx_n_s_kwargs, __pyx_n_s__8, __pyx_n_s_meta, __pyx_n_s_numrows, __pyx_n_s_df); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(8, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_file_in_chunks, 642, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 642, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(13, __pyx_n_s_read_function, __pyx_n_s_file_path, __pyx_n_s_chunksize, __pyx_n_s_offset, __pyx_n_s_limit, __pyx_n_s_multiprocess, __pyx_n_s_num_processes, __pyx_n_s_num_rows, __pyx_n_s_kwargs, __pyx_n_s__10, __pyx_n_s_meta, __pyx_n_s_numrows, __pyx_n_s_df); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_file_in_chunks, 648, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 648, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(6, ((PyObject *)__pyx_int_100000), ((PyObject *)__pyx_int_0), ((PyObject *)__pyx_int_0), ((PyObject *)Py_False), ((PyObject *)__pyx_int_4), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); - /* "pyreadstat/pyreadstat.pyx":723 + /* "pyreadstat/pyreadstat.pyx":729 * offset += chunksize * * def read_file_multiprocessing(read_function, file_path, num_processes=None, num_rows=None, **kwargs): # <<<<<<<<<<<<<< * """ * Reads a file in parallel using multiprocessing. */ - __pyx_tuple__26 = PyTuple_Pack(23, __pyx_n_s_read_function, __pyx_n_s_file_path, __pyx_n_s_num_processes, __pyx_n_s_num_rows, __pyx_n_s_kwargs, __pyx_n_s__8, __pyx_n_s_row_offset, __pyx_n_s_row_limit, __pyx_n_s_meta, __pyx_n_s_numrows, __pyx_n_s_final, __pyx_n_s_divs, __pyx_n_s_offsets, __pyx_n_s_prev_offset, __pyx_n_s_prev_div, __pyx_n_s_indx, __pyx_n_s_div, __pyx_n_s_offset, __pyx_n_s_jobs, __pyx_n_s_pool, __pyx_n_s_chunks, __pyx_n_s_x, __pyx_n_s_chunksize); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_file_multiprocessing, 723, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(23, __pyx_n_s_read_function, __pyx_n_s_file_path, __pyx_n_s_num_processes, __pyx_n_s_num_rows, __pyx_n_s_kwargs, __pyx_n_s__10, __pyx_n_s_row_offset, __pyx_n_s_row_limit, __pyx_n_s_meta, __pyx_n_s_numrows, __pyx_n_s_final, __pyx_n_s_divs, __pyx_n_s_offsets, __pyx_n_s_prev_offset, __pyx_n_s_prev_div, __pyx_n_s_indx, __pyx_n_s_div, __pyx_n_s_offset, __pyx_n_s_jobs, __pyx_n_s_pool, __pyx_n_s_chunks, __pyx_n_s_x, __pyx_n_s_chunksize); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 729, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_read_file_multiprocessing, 729, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 729, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 729, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); - /* "pyreadstat/pyreadstat.pyx":799 + /* "pyreadstat/pyreadstat.pyx":805 * # Write API * * def write_sav(df, dst_path, str file_label="", object column_labels=None, compress=False, row_compress=False, str note=None, # <<<<<<<<<<<<<< * dict variable_value_labels=None, dict missing_ranges=None, dict variable_display_width=None, * dict variable_measure=None, dict variable_format=None): */ - __pyx_tuple__28 = PyTuple_Pack(21, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_compress, __pyx_n_s_row_compress, __pyx_n_s_note, __pyx_n_s_variable_value_labels, __pyx_n_s_missing_ranges, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_variable_format, __pyx_n_s_file_format_version, __pyx_n_s_var_width, __pyx_n_s_row_compression, __pyx_n_s_table_name, __pyx_n_s_missing_user_values, __pyx_n_s_variable_alignment, __pyx_n_s_formats_presets, __pyx_n_s_col_name, __pyx_n_s_col_format); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(12, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_sav, 799, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 799, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(21, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_compress, __pyx_n_s_row_compress, __pyx_n_s_note, __pyx_n_s_variable_value_labels, __pyx_n_s_missing_ranges, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_variable_format, __pyx_n_s_file_format_version, __pyx_n_s_var_width, __pyx_n_s_row_compression, __pyx_n_s_table_name, __pyx_n_s_missing_user_values, __pyx_n_s_variable_alignment, __pyx_n_s_formats_presets, __pyx_n_s_col_name, __pyx_n_s_col_format); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(12, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_sav, 805, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 805, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(10, ((PyObject*)__pyx_kp_s__6), ((PyObject *)Py_None), ((PyObject *)Py_False), ((PyObject *)Py_False), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); - /* "pyreadstat/pyreadstat.pyx":874 + /* "pyreadstat/pyreadstat.pyx":880 * variable_alignment, variable_display_width, variable_measure, variable_format, row_compression) * * def write_dta(df, dst_path, str file_label="", object column_labels=None, int version=15, # <<<<<<<<<<<<<< * dict variable_value_labels=None, dict missing_user_values=None, dict variable_format=None): * """ */ - __pyx_tuple__30 = PyTuple_Pack(16, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_version, __pyx_n_s_variable_value_labels, __pyx_n_s_missing_user_values, __pyx_n_s_variable_format, __pyx_n_s_file_format_version, __pyx_n_s_note, __pyx_n_s_table_name, __pyx_n_s_missing_ranges, __pyx_n_s_variable_alignment, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_row_compression); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 874, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(8, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_dta, 874, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 874, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(16, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_version, __pyx_n_s_variable_value_labels, __pyx_n_s_missing_user_values, __pyx_n_s_variable_format, __pyx_n_s_file_format_version, __pyx_n_s_note, __pyx_n_s_table_name, __pyx_n_s_missing_ranges, __pyx_n_s_variable_alignment, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_row_compression); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_dta, 880, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 880, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":936 + /* "pyreadstat/pyreadstat.pyx":942 * variable_display_width, variable_measure, variable_format, row_compression) * * def write_xport(df, dst_path, str file_label="", object column_labels=None, str table_name=None, int file_format_version = 8, # <<<<<<<<<<<<<< * dict variable_format=None): * """ */ - __pyx_tuple__32 = PyTuple_Pack(15, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_table_name, __pyx_n_s_file_format_version, __pyx_n_s_variable_format, __pyx_n_s_variable_value_labels, __pyx_n_s_note, __pyx_n_s_missing_ranges, __pyx_n_s_missing_user_values, __pyx_n_s_variable_alignment, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_row_compression); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_xport, 936, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 936, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(15, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_table_name, __pyx_n_s_file_format_version, __pyx_n_s_variable_format, __pyx_n_s_variable_value_labels, __pyx_n_s_note, __pyx_n_s_missing_ranges, __pyx_n_s_missing_user_values, __pyx_n_s_variable_alignment, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_row_compression); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_xport, 942, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 942, __pyx_L1_error) - /* "pyreadstat/pyreadstat.pyx":980 + /* "pyreadstat/pyreadstat.pyx":986 * variable_alignment,variable_display_width, variable_measure, variable_format, row_compression) * * def write_por(df, dst_path, str file_label="", object column_labels=None, dict variable_format=None): # <<<<<<<<<<<<<< * """ * Writes a pandas data frame to a SPSS POR file. */ - __pyx_tuple__34 = PyTuple_Pack(15, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_variable_format, __pyx_n_s_note, __pyx_n_s_file_format_version, __pyx_n_s_variable_value_labels, __pyx_n_s_missing_ranges, __pyx_n_s_missing_user_values, __pyx_n_s_variable_alignment, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_table_name, __pyx_n_s_row_compression); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 980, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_por, 980, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 980, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(15, __pyx_n_s_df, __pyx_n_s_dst_path, __pyx_n_s_file_label, __pyx_n_s_column_labels, __pyx_n_s_variable_format, __pyx_n_s_note, __pyx_n_s_file_format_version, __pyx_n_s_variable_value_labels, __pyx_n_s_missing_ranges, __pyx_n_s_missing_user_values, __pyx_n_s_variable_alignment, __pyx_n_s_variable_display_width, __pyx_n_s_variable_measure, __pyx_n_s_table_name, __pyx_n_s_row_compression); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 986, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pyreadstat_pyreadstat_pyx, __pyx_n_s_write_por, 986, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 986, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(3, ((PyObject*)__pyx_kp_s__6), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 986, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } +/* #### Code section: init_constants ### */ -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_get.method_name = &__pyx_n_s_get; __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_items.method_name = &__pyx_n_s_items; __pyx_umethod_PyDict_Type_keys.type = (PyObject*)&PyDict_Type; + __pyx_umethod_PyDict_Type_keys.method_name = &__pyx_n_s_keys; __pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_umethod_PyDict_Type_pop.method_name = &__pyx_n_s_pop; + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -12028,6 +14350,12 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_L1_error:; return -1; } +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ @@ -12068,22 +14396,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_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels) < 0) __PYX_ERR(0, 534, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels.tp_dictoffset && __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; - } + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels_spec, NULL); if (unlikely(!__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels)) __PYX_ERR(0, 540, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels_spec, __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels) < 0) __PYX_ERR(0, 540, __pyx_L1_error) + #else __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels = &__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels; - if (PyType_Ready(&__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks) < 0) __PYX_ERR(0, 642, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks.tp_print = 0; #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks.tp_dictoffset && __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels) < 0) __PYX_ERR(0, 540, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels->tp_dictoffset && __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct__set_value_labels->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } + #endif + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks_spec, NULL); if (unlikely(!__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks)) __PYX_ERR(0, 648, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks_spec, __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks) < 0) __PYX_ERR(0, 648, __pyx_L1_error) + #else __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks = &__pyx_type_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks) < 0) __PYX_ERR(0, 648, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks->tp_dictoffset && __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_10pyreadstat_10pyreadstat___pyx_scope_struct_1_read_file_in_chunks->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; + } + #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -12099,10 +14449,9 @@ static int __Pyx_modinit_type_import_code(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 42, __pyx_L1_error) + __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_10pyreadstat_16_readstat_parser_data_container = __Pyx_ImportType(__pyx_t_1, "pyreadstat._readstat_parser", "data_container", sizeof(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_10pyreadstat_16_readstat_parser_data_container) __PYX_ERR(1, 42, __pyx_L1_error) + __pyx_ptype_10pyreadstat_16_readstat_parser_data_container = __Pyx_ImportType_3_0_0(__pyx_t_1, "pyreadstat._readstat_parser", "data_container", sizeof(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container), __PYX_GET_STRUCT_ALIGNMENT_3_0_0(struct __pyx_obj_10pyreadstat_16_readstat_parser_data_container),__Pyx_ImportType_CheckSize_Warn_3_0_0); if (!__pyx_ptype_10pyreadstat_16_readstat_parser_data_container) __PYX_ERR(1, 49, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -12122,22 +14471,22 @@ static int __Pyx_modinit_variable_import_code(void) { /*--- Variable import code ---*/ __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportVoidPtr(__pyx_t_1, "readstat_to_numpy_types", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "sas_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "spss_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "stata_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "readstat_to_numpy_types", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_readstat_to_numpy_types, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "sas_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_sas_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "spss_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_spss_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_datetime_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_datetime_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_date_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_date_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_time_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_time_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_all_formats", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_all_formats, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportVoidPtr_3_0_0(__pyx_t_1, "stata_origin", (void **)&__pyx_vp_10pyreadstat_16_readstat_parser_stata_origin, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -12157,11 +14506,11 @@ static int __Pyx_modinit_function_import_code(void) { /*--- Function import code ---*/ __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_parser"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "run_conversion", (void (**)(void))&__pyx_f_10pyreadstat_16_readstat_parser_run_conversion, "PyObject *(PyObject *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format, readstat_error_t (readstat_parser_t *, char const *, void *), PyObject *, int, int, PyObject *, int, int, long, long, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_0(__pyx_t_1, "run_conversion", (void (**)(void))&__pyx_f_10pyreadstat_16_readstat_parser_run_conversion, "PyObject *(PyObject *, __pyx_t_10pyreadstat_16_readstat_parser_py_file_format, __pyx_t_10pyreadstat_16_readstat_parser_py_file_extension, PyObject *, int, int, PyObject *, int, int, long, long, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyImport_ImportModule("pyreadstat._readstat_writer"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_ImportFunction(__pyx_t_1, "run_write", (void (**)(void))&__pyx_f_10pyreadstat_16_readstat_writer_run_write, "int (PyObject *, PyObject *, __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format, PyObject *, PyObject *, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ImportFunction_3_0_0(__pyx_t_1, "run_write", (void (**)(void))&__pyx_f_10pyreadstat_16_readstat_writer_run_write, "int (PyObject *, PyObject *, __pyx_t_10pyreadstat_16_readstat_writer_dst_file_format, PyObject *, PyObject *, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -12172,15 +14521,64 @@ static int __Pyx_modinit_function_import_code(void) { } -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_pyreadstat(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_pyreadstat}, + {0, NULL} +}; #endif -#else + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "pyreadstat", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else #ifdef __cplusplus #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else @@ -12222,12 +14620,21 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { } return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) +#endif +{ PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else result = PyDict_SetItemString(moddict, to_name, value); +#endif } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { @@ -12237,8 +14644,9 @@ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject } return result; } -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) @@ -12248,8 +14656,12 @@ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNU module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; +#endif if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; @@ -12265,8 +14677,14 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_pyreadstat(PyObject *__pyx_pyinit_ #endif #endif { + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -12280,6 +14698,35 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_pyreadstat(PyObject *__pyx_pyinit_ #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("pyreadstat", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to pyreadstat pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = 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(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { @@ -12298,48 +14745,31 @@ if (!__Pyx_RefNanny) { __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("pyreadstat", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __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(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -12351,7 +14781,7 @@ if (!__Pyx_RefNanny) { { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "pyreadstat.pyreadstat")) { - if (unlikely(PyDict_SetItemString(modules, "pyreadstat.pyreadstat", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((PyDict_SetItemString(modules, "pyreadstat.pyreadstat", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif @@ -12363,10 +14793,10 @@ if (!__Pyx_RefNanny) { (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_variable_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_variable_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -12379,43 +14809,43 @@ if (!__Pyx_RefNanny) { * * import pandas as pd */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mp, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_multiprocessing, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mp, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/pyreadstat.pyx":24 * import multiprocessing as mp * * import pandas as pd # <<<<<<<<<<<<<< * - * from readstat_api cimport readstat_parse_sas7bdat, readstat_parse_dta, readstat_parse_sav + * #from readstat_api cimport readstat_parse_sas7bdat, readstat_parse_dta, readstat_parse_sav */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_pandas, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_ImportDottedModuleRelFirst(__pyx_n_s_pandas, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pd, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "pyreadstat/pyreadstat.pyx":31 - * from readstat_api cimport readstat_begin_writing_dta, readstat_begin_writing_por, readstat_begin_writing_sav - * from _readstat_parser cimport py_file_format, run_conversion + * #from readstat_api cimport readstat_begin_writing_dta, readstat_begin_writing_por, readstat_begin_writing_sav + * from _readstat_parser cimport py_file_format, py_file_extension, run_conversion * from _readstat_parser import PyreadstatError # <<<<<<<<<<<<<< * from _readstat_writer cimport run_write * cimport _readstat_parser, _readstat_writer */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PyreadstatError); __Pyx_GIVEREF(__pyx_n_s_PyreadstatError); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PyreadstatError); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_readstat_parser, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PyreadstatError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_readstat_parser, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __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_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PyreadstatError, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PyreadstatError, __pyx_t_2) < 0) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pyreadstat/pyreadstat.pyx":34 * from _readstat_writer cimport run_write @@ -12424,19 +14854,19 @@ if (!__Pyx_RefNanny) { * from worker import worker * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_deepcopy); __Pyx_GIVEREF(__pyx_n_s_deepcopy); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_deepcopy); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_copy, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __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_deepcopy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_deepcopy); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_copy, __pyx_t_3, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_deepcopy, __pyx_t_2) < 0) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_deepcopy, __pyx_t_3) < 0) __PYX_ERR(0, 34, __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; /* "pyreadstat/pyreadstat.pyx":35 * cimport _readstat_parser, _readstat_writer @@ -12445,19 +14875,31 @@ if (!__Pyx_RefNanny) { * * # Public interface */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_worker); __Pyx_GIVEREF(__pyx_n_s_worker); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_worker); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_worker, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_worker); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_worker, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_worker); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __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_worker); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_worker, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_worker, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "pyreadstat/pyreadstat.pyx":43 + * def read_sas7bdat(filename_path, metadataonly=False, dates_as_pandas_datetime=False, catalog_file=None, + * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, + * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, # <<<<<<<<<<<<<< + * list extra_datetime_formats=None, list extra_date_formats=None): + * r""" + */ + __pyx_t_3 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); /* "pyreadstat/pyreadstat.pyx":41 * # Parsing functions @@ -12466,188 +14908,514 @@ if (!__Pyx_RefNanny) { * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_1read_sas7bdat, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_True)); + __Pyx_GIVEREF(((PyObject *)Py_True)); + PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)Py_True)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 5, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 6, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 7, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 8, ((PyObject *)Py_False)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 10, __pyx_t_2); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 11, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 12, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 13, ((PyObject *)Py_None)); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_1read_sas7bdat, 0, __pyx_n_s_read_sas7bdat, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_sas7bdat, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":140 + /* "pyreadstat/pyreadstat.pyx":142 + * + * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, + * list usecols=None, disable_datetime_conversion=False, int row_limit=0, int row_offset=0, # <<<<<<<<<<<<<< + * str output_format=None, list extra_datetime_formats=None, list extra_date_formats=None): + * r""" + */ + __pyx_t_2 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "pyreadstat/pyreadstat.pyx":141 * * * def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False, str encoding=None, # <<<<<<<<<<<<<< * list usecols=None, disable_datetime_conversion=False, int row_limit=0, int row_offset=0, * str output_format=None, list extra_datetime_formats=None, list extra_date_formats=None): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_3read_xport, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_xport, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyTuple_New(10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)Py_False)); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 7, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 8, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 9, ((PyObject *)Py_None)); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_3read_xport, 0, __pyx_n_s_read_xport, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_xport, __pyx_t_4) < 0) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":212 + /* "pyreadstat/pyreadstat.pyx":216 + * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, + * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, + * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, # <<<<<<<<<<<<<< + * list extra_datetime_formats=None, list extra_date_formats=None): + * r""" + */ + __pyx_t_4 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "pyreadstat/pyreadstat.pyx":214 * * * def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_5read_dta, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_dta, __pyx_t_2) < 0) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_True)); + __Pyx_GIVEREF(((PyObject *)Py_True)); + PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)Py_True)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)Py_False)); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 9, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 10, __pyx_t_3); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_2, 11, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_2, 12, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_2, 13, ((PyObject *)Py_None)); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_5read_dta, 0, __pyx_n_s_read_dta, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_dta, __pyx_t_3) < 0) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/pyreadstat.pyx":304 + /* "pyreadstat/pyreadstat.pyx":309 + * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, + * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, + * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, list extra_datetime_formats=None, # <<<<<<<<<<<<<< + * list extra_date_formats=None): + * r""" + */ + __pyx_t_3 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pyreadstat/pyreadstat.pyx":307 * * * def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, user_missing=False, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, list extra_datetime_formats=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_7read_sav, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_True)); + __Pyx_GIVEREF(((PyObject *)Py_True)); + PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)Py_True)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 5, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 6, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 7, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_4, 8, ((PyObject *)Py_False)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 10, __pyx_t_2); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 11, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 12, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_4, 13, ((PyObject *)Py_None)); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_7read_sav, 0, __pyx_n_s_read_sav, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_sav, __pyx_t_2) < 0) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_sav, __pyx_t_2) < 0) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/pyreadstat.pyx":396 + /* "pyreadstat/pyreadstat.pyx":402 + * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, + * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, + * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, # <<<<<<<<<<<<<< + * list extra_datetime_formats=None, list extra_date_formats=None): + * r""" + */ + __pyx_t_2 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_From_int(((int)0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "pyreadstat/pyreadstat.pyx":400 * * * def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, apply_value_formats=False, # <<<<<<<<<<<<<< * formats_as_category=True, formats_as_ordered_category=False, str encoding=None, list usecols=None, * disable_datetime_conversion=False, int row_limit=0, int row_offset=0, str output_format=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_9read_por, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_por, __pyx_t_2) < 0) __PYX_ERR(0, 396, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyTuple_New(13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_True)); + __Pyx_GIVEREF(((PyObject *)Py_True)); + PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)Py_True)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)Py_False)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 5, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 6, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + PyTuple_SET_ITEM(__pyx_t_3, 7, ((PyObject *)Py_False)); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 8, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 9, __pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 10, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 11, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 12, ((PyObject *)Py_None)); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_9read_por, 0, __pyx_n_s_read_por, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_por, __pyx_t_4) < 0) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":482 + /* "pyreadstat/pyreadstat.pyx":487 * * * def read_sas7bcat(filename_path, str encoding=None, str output_format=None): # <<<<<<<<<<<<<< * r""" * Read a SAS sas7bcat file. The returning dataframe will be empty. The metadata object will contain a dictionary */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_11read_sas7bcat, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_sas7bcat, __pyx_t_2) < 0) __PYX_ERR(0, 482, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_11read_sas7bcat, 0, __pyx_n_s_read_sas7bcat, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__22); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_sas7bcat, __pyx_t_4) < 0) __PYX_ERR(0, 487, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":534 + /* "pyreadstat/pyreadstat.pyx":540 * * * def set_value_labels(dataframe, metadata, formats_as_category=True, formats_as_ordered_category=False): # <<<<<<<<<<<<<< * """ * Changes the values in the dataframe according to the value formats in the metadata. */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_13set_value_labels, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_value_labels, __pyx_t_2) < 0) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_13set_value_labels, 0, __pyx_n_s_set_value_labels, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__25); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_value_labels, __pyx_t_4) < 0) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":589 + /* "pyreadstat/pyreadstat.pyx":595 * return df_copy * * def set_catalog_to_sas(sas_dataframe, sas_metadata, catalog_metadata, formats_as_category=True, # <<<<<<<<<<<<<< * formats_as_ordered_category=False): * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_15set_catalog_to_sas, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_catalog_to_sas, __pyx_t_2) < 0) __PYX_ERR(0, 589, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_15set_catalog_to_sas, 0, __pyx_n_s_set_catalog_to_sas, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__28); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_catalog_to_sas, __pyx_t_4) < 0) __PYX_ERR(0, 595, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":642 + /* "pyreadstat/pyreadstat.pyx":648 * # convenience functions to read in chunks * * def read_file_in_chunks(read_function, file_path, chunksize=100000, offset=0, limit=0, # <<<<<<<<<<<<<< * multiprocess=False, num_processes=4, num_rows=None, **kwargs): * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_17read_file_in_chunks, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_file_in_chunks, __pyx_t_2) < 0) __PYX_ERR(0, 642, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_17read_file_in_chunks, 0, __pyx_n_s_read_file_in_chunks, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__30); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_file_in_chunks, __pyx_t_4) < 0) __PYX_ERR(0, 648, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":723 + /* "pyreadstat/pyreadstat.pyx":729 * offset += chunksize * * def read_file_multiprocessing(read_function, file_path, num_processes=None, num_rows=None, **kwargs): # <<<<<<<<<<<<<< * """ * Reads a file in parallel using multiprocessing. */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_20read_file_multiprocessing, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_file_multiprocessing, __pyx_t_2) < 0) __PYX_ERR(0, 723, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_20read_file_multiprocessing, 0, __pyx_n_s_read_file_multiprocessing, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 729, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__33); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_file_multiprocessing, __pyx_t_4) < 0) __PYX_ERR(0, 729, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":799 + /* "pyreadstat/pyreadstat.pyx":805 * # Write API * * def write_sav(df, dst_path, str file_label="", object column_labels=None, compress=False, row_compress=False, str note=None, # <<<<<<<<<<<<<< * dict variable_value_labels=None, dict missing_ranges=None, dict variable_display_width=None, * dict variable_measure=None, dict variable_format=None): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_22write_sav, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_sav, __pyx_t_2) < 0) __PYX_ERR(0, 799, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_22write_sav, 0, __pyx_n_s_write_sav, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__36); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_sav, __pyx_t_4) < 0) __PYX_ERR(0, 805, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":874 + /* "pyreadstat/pyreadstat.pyx":880 * variable_alignment, variable_display_width, variable_measure, variable_format, row_compression) * * def write_dta(df, dst_path, str file_label="", object column_labels=None, int version=15, # <<<<<<<<<<<<<< * dict variable_value_labels=None, dict missing_user_values=None, dict variable_format=None): * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_24write_dta, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 874, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_dta, __pyx_t_2) < 0) __PYX_ERR(0, 874, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)15)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject*)__pyx_kp_s__6)); + __Pyx_GIVEREF(((PyObject*)__pyx_kp_s__6)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject*)__pyx_kp_s__6)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)Py_None)); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 5, ((PyObject *)Py_None)); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_24write_dta, 0, __pyx_n_s_write_dta, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_dta, __pyx_t_4) < 0) __PYX_ERR(0, 880, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":936 + /* "pyreadstat/pyreadstat.pyx":942 * variable_display_width, variable_measure, variable_format, row_compression) * * def write_xport(df, dst_path, str file_label="", object column_labels=None, str table_name=None, int file_format_version = 8, # <<<<<<<<<<<<<< * dict variable_format=None): * """ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_26write_xport, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 936, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_xport, __pyx_t_2) < 0) __PYX_ERR(0, 936, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(((int)8)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject*)__pyx_kp_s__6)); + __Pyx_GIVEREF(((PyObject*)__pyx_kp_s__6)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject*)__pyx_kp_s__6)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)Py_None)); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)Py_None)); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4); + __Pyx_INCREF(((PyObject *)Py_None)); + __Pyx_GIVEREF(((PyObject *)Py_None)); + PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)Py_None)); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_26write_xport, 0, __pyx_n_s_write_xport, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_xport, __pyx_t_4) < 0) __PYX_ERR(0, 942, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pyreadstat/pyreadstat.pyx":980 + /* "pyreadstat/pyreadstat.pyx":986 * variable_alignment,variable_display_width, variable_measure, variable_format, row_compression) * * def write_por(df, dst_path, str file_label="", object column_labels=None, dict variable_format=None): # <<<<<<<<<<<<<< * """ * Writes a pandas data frame to a SPSS POR file. */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_10pyreadstat_10pyreadstat_28write_por, NULL, __pyx_n_s_pyreadstat_pyreadstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_por, __pyx_t_2) < 0) __PYX_ERR(0, 980, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_10pyreadstat_10pyreadstat_28write_por, 0, __pyx_n_s_write_por, NULL, __pyx_n_s_pyreadstat_pyreadstat, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 986, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__43); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_write_por, __pyx_t_4) < 0) __PYX_ERR(0, 986, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "pyreadstat/pyreadstat.pyx":1 * # cython: c_string_type=unicode, c_string_encoding=utf8, language_level=2 # <<<<<<<<<<<<<< * * # ############################################################################# */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { - if (__pyx_d) { + if (__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init pyreadstat.pyreadstat", __pyx_clineno, __pyx_lineno, __pyx_filename); } + #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init pyreadstat.pyreadstat"); } @@ -12661,6 +15429,22 @@ if (!__Pyx_RefNanny) { return; #endif } +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ @@ -12680,6 +15464,106 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + /* PyObjectGetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { @@ -12694,10 +15578,32 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject } #endif +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); @@ -12708,6 +15614,213 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#endif + /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, @@ -12725,6 +15838,7 @@ static void __Pyx_RaiseDoubleKeywordsError( /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, + PyObject *const *kwvalues, PyObject **argnames[], PyObject *kwds2, PyObject *values[], @@ -12735,7 +15849,18 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + if (kwds_is_tuple) { + if (pos >= PyTuple_GET_SIZE(kwds)) break; + key = PyTuple_GET_ITEM(kwds, pos); + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; + } name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { @@ -12769,11 +15894,12 @@ static int __Pyx_ParseOptionalKeywords( #endif if (likely(PyUnicode_Check(key))) { while (*name) { - int cmp = (**name == key) ? 0 : + int cmp = ( #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif - PyUnicode_Compare(**name, key); + PyUnicode_Compare(**name, key) + ); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; @@ -12812,11 +15938,12 @@ static int __Pyx_ParseOptionalKeywords( "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: - PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else + PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); #endif @@ -12853,6 +15980,8 @@ static void __Pyx_RaiseArgtupleInvalid( /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; @@ -12865,9 +15994,13 @@ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *nam else { if (likely(__Pyx_TypeCheck(obj, type))) return 1; } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); return 0; } @@ -12886,37 +16019,16 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* exc_type = tstate->curexc_type; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType(); if (unlikely(exc_type)) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { + if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) return -1; - } + __Pyx_PyErr_Clear(); + return 0; } return 0; -#endif } /* UnpackItemEndCheck */ @@ -12925,10 +16037,8 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; - } else { - return __Pyx_IterFinish(); } - return 0; + return __Pyx_IterFinish(); } /* PyObjectSetAttrStr */ @@ -12988,6 +16098,14 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) } else if (unlikely(PyErr_Occurred())) { return NULL; } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) @@ -13026,13 +16144,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif -/* None */ +/* RaiseClosureNameError */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } /* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; @@ -13061,7 +16179,6 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args --tstate->recursion_depth; return result; } -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); @@ -13077,7 +16194,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { return NULL; } if ( @@ -13148,30 +16265,6 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, return result; } #endif -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON @@ -13193,101 +16286,87 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject } #endif -/* PyObjectCallNoArg */ +/* PyObjectFastCall */ +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + Py_DECREF(argstuple); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) + if (nargs == 0 && kwargs == NULL) { +#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) + if (__Pyx_IsCyOrPyCFunction(func)) #else - if (likely(PyCFunction_Check(func))) + if (PyCFunction_Check(func)) #endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } } } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); + else if (nargs == 1 && kwargs == NULL) { + if (PyCFunction_Check(func)) + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, args[0]); + } + } } #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); } } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); } #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); + #endif + #if CYTHON_VECTORCALL + vectorcallfunc f = _PyVectorcall_Function(func); + if (f) { + return f(func, args, (size_t)nargs, kwargs); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, kwargs); } #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); } /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (!j) return NULL; + if (unlikely(!j)) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; @@ -13348,10 +16427,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, 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); + PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; + PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; + if (mm && mm->mp_subscript) { + PyObject *r, *key = PyInt_FromSsize_t(i); + if (unlikely(!key)) return NULL; + r = mm->mp_subscript(o, key); + Py_DECREF(key); + return r; + } + if (likely(sm && sm->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { + Py_ssize_t l = sm->sq_length(o); if (likely(l >= 0)) { i += l; } else { @@ -13360,7 +16447,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyErr_Clear(); } } - return m->sq_item(o, i); + return sm->sq_item(o, i); } } #else @@ -13371,85 +16458,320 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { + PyObject *runerr = NULL; Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } key_value = __Pyx_PyIndex_AsSsize_t(index); if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + PyErr_Format(PyExc_IndexError, + "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); + __Pyx_DECREF_TypeName(index_type_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { + __Pyx_TypeName obj_type_name; + if (likely(PyType_Check(obj))) { + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); + if (meth) { + PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); + Py_DECREF(meth); + return result; + } } + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); return NULL; } -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { + PyTypeObject *tp = Py_TYPE(obj); + PyMappingMethods *mm = tp->tp_as_mapping; + PySequenceMethods *sm = tp->tp_as_sequence; + if (likely(mm && mm->mp_subscript)) { + return mm->mp_subscript(obj, key); + } + if (likely(sm && sm->sq_item)) { + return __Pyx_PyObject_GetIndex(obj, key); + } + return __Pyx_PyObject_GetItem_Slow(obj, key); +} +#endif + +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); + if (unlikely(!abi_module)) return NULL; + Py_INCREF(abi_module); + return abi_module; +} + +/* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; } - return __Pyx_PyObject_GetIndex(obj, key); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; } -#endif - -/* FetchCommonType */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { goto bad; } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; + goto done; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; done: - Py_DECREF(fake_module); - return cached_type; + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); + return NULL; + } + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif /* CythonFunctionShared */ -#include +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#endif +} static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { + CYTHON_UNUSED_VAR(closure); if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; @@ -13462,25 +16784,25 @@ __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure return op->func_doc; } static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp = op->func_doc; + CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_doc, value); return 0; } static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; @@ -13489,9 +16811,9 @@ __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_name; } static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -13502,22 +16824,21 @@ __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "__name__ must be set to a string object"); return -1; } - tmp = op->func_name; Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_name, value); return 0; } static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_qualname); return op->func_qualname; } static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -13528,25 +16849,14 @@ __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHO "__qualname__ must be set to a string object"); return -1; } - tmp = op->func_qualname; Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); return 0; } static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) @@ -13556,9 +16866,9 @@ __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *contex return op->func_dict; } static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); @@ -13569,28 +16879,30 @@ __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UN "setting function's dictionary to a non-dict"); return -1; } - tmp = op->func_dict; Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_dict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } @@ -13617,27 +16929,28 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { return result; } static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); return 0; } static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; @@ -13647,27 +16960,28 @@ __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *co return result; } static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { + } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " + "currently affect the values used in function calls", 1); Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); return 0; } static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; @@ -13677,24 +16991,23 @@ __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void * return result; } static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; - } else if (!PyDict_Check(value)) { + } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); return 0; } static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; @@ -13703,13 +17016,42 @@ __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void Py_INCREF(result); return result; } +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); + PyList_SET_ITEM(fromlist, 0, marker); + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, @@ -13722,20 +17064,37 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, +#endif +#endif {0, 0, 0, 0, 0} }; static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { + CYTHON_UNUSED_VAR(args); #if PY_MAJOR_VERSION >= 3 Py_INCREF(m->func_qualname); return m->func_qualname; #else - return PyString_FromString(m->func.m_ml->ml_name); + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { @@ -13745,26 +17104,31 @@ static PyMethodDef __pyx_CyFunction_methods[] = { #if PY_VERSION_HEX < 0x030500A0 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyCFunctionObject *cf = (PyCFunctionObject*) op; if (unlikely(op == NULL)) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; + cf->m_ml = ml; + cf->m_self = (PyObject *) op; Py_XINCREF(closure); op->func_closure = closure; Py_XINCREF(module); - op->func.m_module = module; + cf->m_module = module; op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); @@ -13776,23 +17140,56 @@ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef * op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; + } +#endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); + Py_CLEAR(((PyCFunctionObject*)m)->m_module); Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else + { + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -13808,7 +17205,7 @@ static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); + __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { @@ -13818,16 +17215,17 @@ static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); + Py_VISIT(((PyCFunctionObject*)m)->m_module); Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; @@ -13836,24 +17234,6 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, } return 0; } -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ -#if PY_MAJOR_VERSION < 3 - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; -#endif - return __Pyx_PyMethod_New(func, obj, type); -} static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { @@ -13910,9 +17290,7 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py } break; default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", @@ -13925,6 +17303,17 @@ static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *a static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; @@ -13936,6 +17325,14 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); @@ -13945,13 +17342,175 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P } return result; } +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif 0, 0, #if PY_MAJOR_VERSION < 3 @@ -13969,7 +17528,13 @@ static PyTypeObject __pyx_CyFunctionType_type = { 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#ifdef _Py_TPFLAGS_HAVE_VECTORCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, @@ -13986,7 +17551,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { __pyx_CyFunction_getsets, 0, 0, - __Pyx_CyFunction_descr_get, + __Pyx_PyMethod_New, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, @@ -14004,15 +17569,27 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030400a1 0, #endif -#if PY_VERSION_HEX >= 0x030800b1 +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 0, #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, #endif }; -static int __pyx_CyFunction_init(void) { +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } @@ -14058,6 +17635,19 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual } /* UnpackUnboundCMethod */ +static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { + PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); + if (unlikely(!selfless_args)) return NULL; + PyObject *result = PyObject_Call(method, selfless_args, kwargs); + Py_DECREF(selfless_args); + return result; +} +static PyMethodDef __Pyx_UnboundCMethod_Def = { + "CythonUnboundCMethod", + __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), + METH_VARARGS | METH_KEYWORDS, + NULL +}; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); @@ -14067,13 +17657,43 @@ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #else + if (likely(!PyCFunction_Check(method))) #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); - } + } else +#endif +#if defined(CYTHON_COMPILING_IN_PYPY) +#elif PY_VERSION_HEX >= 0x03090000 + if (PyCFunction_CheckExact(method)) +#else + if (PyCFunction_Check(method)) +#endif + { + PyObject *self; + int self_found; +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + self = PyObject_GetAttrString(method, "__self__"); + if (!self) { + PyErr_Clear(); + } +#else + self = PyCFunction_GET_SELF(method); #endif + self_found = (self && self != Py_None); +#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY + Py_XDECREF(self); +#endif + if (self_found) { + PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); + if (unlikely(!unbound_method)) return -1; + Py_DECREF(method); + target->method = unbound_method; + } + } return 0; } @@ -14084,13 +17704,13 @@ static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* 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) { + } 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 { + #else return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); - } - } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + #endif + } else if ((PY_VERSION_HEX >= 0x030700A0) && flag == (METH_FASTCALL | METH_KEYWORDS)) { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } } @@ -14188,7 +17808,7 @@ static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObje /* 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 +#if PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (unlikely(PyErr_Occurred())) @@ -14215,35 +17835,11 @@ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObjec return value; } -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - /* RaiseException */ #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); Py_XINCREF(type); if (!value || value == Py_None) value = NULL; @@ -14376,13 +17972,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -14390,6 +17982,12 @@ 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: @@ -14412,10 +18010,17 @@ static CYTHON_INLINE PyObject *__Pyx_PyDict_Pop(PyObject *d, PyObject *key, PyOb } } +/* PyObjectCallNoArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { + PyObject *arg = NULL; + return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* PyObjectGetMethod */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrgetfunc f = NULL; @@ -14432,11 +18037,13 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me descr = _PyType_Lookup(tp, name); if (likely(descr != NULL)) { Py_INCREF(descr); -#if PY_MAJOR_VERSION >= 3 +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else - if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) #endif #else #ifdef __Pyx_CyFunction_USED @@ -14477,18 +18084,20 @@ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **me Py_DECREF(descr); goto try_unpack; } - if (descr != NULL) { + if (likely(descr != NULL)) { *method = descr; return 0; } + type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); #endif + __Pyx_DECREF_TypeName(type_name); return 0; #else attr = __Pyx_PyObject_GetAttrStr(obj, name); @@ -14573,7 +18182,7 @@ static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyOb iter = PyObject_GetIter(tuple); if (unlikely(!iter)) goto bad; if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; } - iternext = Py_TYPE(iter)->tp_iternext; + iternext = __Pyx_PyObject_GetIterNextFunc(iter); value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; } value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; } if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad; @@ -14713,7 +18322,7 @@ static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) { iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict); if (unlikely(!iter)) { PyObject *args; - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) goto bad; PyErr_Clear(); args = PyTuple_Pack(1, source_mapping); if (likely(args)) { @@ -14740,41 +18349,158 @@ static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) { Py_DECREF(value); if (unlikely(result < 0)) goto bad; } - Py_XDECREF(iter); - return 0; -bad: - Py_XDECREF(iter); - return -1; + Py_XDECREF(iter); + return 0; +bad: + Py_XDECREF(iter); + return -1; +} + +/* pybytes_as_double */ +static double __Pyx_SlowPyString_AsDouble(PyObject *obj) { + PyObject *float_value; +#if PY_MAJOR_VERSION >= 3 + float_value = PyFloat_FromString(obj); +#else + float_value = PyFloat_FromString(obj, 0); +#endif + if (likely(float_value)) { + double value = PyFloat_AS_DOUBLE(float_value); + Py_DECREF(float_value); + return value; + } + return (double)-1; +} +static const char* __Pyx__PyBytes_AsDouble_Copy(const char* start, char* buffer, Py_ssize_t length) { + int last_was_punctuation = 1; + Py_ssize_t i; + for (i=0; i < length; i++) { + char chr = start[i]; + int is_punctuation = (chr == '_') | (chr == '.') | (chr == 'e') | (chr == 'E'); + *buffer = chr; + buffer += (chr != '_'); + if (unlikely(last_was_punctuation & is_punctuation)) goto parse_failure; + last_was_punctuation = is_punctuation; + } + if (unlikely(last_was_punctuation)) goto parse_failure; + *buffer = '\0'; + return buffer; +parse_failure: + return NULL; +} +static double __Pyx__PyBytes_AsDouble_inf_nan(const char* start, Py_ssize_t length) { + int matches = 1; + char sign = start[0]; + int is_signed = (sign == '+') | (sign == '-'); + start += is_signed; + length -= is_signed; + switch (start[0]) { + #ifdef Py_NAN + case 'n': + case 'N': + if (unlikely(length != 3)) goto parse_failure; + matches &= (start[1] == 'a' || start[1] == 'A'); + matches &= (start[2] == 'n' || start[2] == 'N'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_NAN : Py_NAN; + #endif + case 'i': + case 'I': + if (unlikely(length < 3)) goto parse_failure; + matches &= (start[1] == 'n' || start[1] == 'N'); + matches &= (start[2] == 'f' || start[2] == 'F'); + if (likely(length == 3 && matches)) + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + if (unlikely(length != 8)) goto parse_failure; + matches &= (start[3] == 'i' || start[3] == 'I'); + matches &= (start[4] == 'n' || start[4] == 'N'); + matches &= (start[5] == 'i' || start[5] == 'I'); + matches &= (start[6] == 't' || start[6] == 'T'); + matches &= (start[7] == 'y' || start[7] == 'Y'); + if (unlikely(!matches)) goto parse_failure; + return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL; + case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + break; + default: + goto parse_failure; + } + return 0.0; +parse_failure: + return -1.0; +} +static CYTHON_INLINE int __Pyx__PyBytes_AsDouble_IsSpace(char ch) { + return (ch == 0x20) | !((ch < 0x9) | (ch > 0xd)); +} +CYTHON_UNUSED static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length) { + double value; + Py_ssize_t i, digits; + const char *last = start + length; + char *end; + while (__Pyx__PyBytes_AsDouble_IsSpace(*start)) + start++; + while (start < last - 1 && __Pyx__PyBytes_AsDouble_IsSpace(last[-1])) + last--; + length = last - start; + if (unlikely(length <= 0)) goto fallback; + value = __Pyx__PyBytes_AsDouble_inf_nan(start, length); + if (unlikely(value == -1.0)) goto fallback; + if (value != 0.0) return value; + digits = 0; + for (i=0; i < length; digits += start[i++] != '_'); + if (likely(digits == length)) { + value = PyOS_string_to_double(start, &end, NULL); + } else if (digits < 40) { + char number[40]; + last = __Pyx__PyBytes_AsDouble_Copy(start, number, length); + if (unlikely(!last)) goto fallback; + value = PyOS_string_to_double(number, &end, NULL); + } else { + char *number = (char*) PyMem_Malloc((digits + 1) * sizeof(char)); + if (unlikely(!number)) goto fallback; + last = __Pyx__PyBytes_AsDouble_Copy(start, number, length); + if (unlikely(!last)) { + PyMem_Free(number); + goto fallback; + } + value = PyOS_string_to_double(number, &end, NULL); + PyMem_Free(number); + } + if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) { + return value; + } +fallback: + return __Pyx_SlowPyString_AsDouble(obj); } /* PyIntCompare */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { +static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_UNUSED_VAR(inplace); if (op1 == op2) { - Py_RETURN_TRUE; + return 1; } #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; + return (a == b); } #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; + Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); + const digit* digits = __Pyx_PyLong_Digits(op1); if (intval == 0) { - if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + return (__Pyx_PyLong_IsZero(op1) == 1); } else if (intval < 0) { - if (size >= 0) - Py_RETURN_FALSE; + if (__Pyx_PyLong_IsNonNeg(op1)) + return 0; intval = -intval; - size = -size; } else { - if (size <= 0) - Py_RETURN_FALSE; + if (__Pyx_PyLong_IsNeg(op1)) + return 0; } uintval = (unsigned long) intval; #if PyLong_SHIFT * 4 < SIZEOF_LONG*8 @@ -14802,29 +18528,35 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, } else #endif unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; + return (unequal == 0); } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; +#endif + return ((double)a == (double)b); } - return ( + return __Pyx_PyObject_IsTrueAndDecref( PyObject_RichCompare(op1, op2, Py_EQ)); } /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { + CYTHON_MAYBE_UNUSED_VAR(intval); + CYTHON_MAYBE_UNUSED_VAR(inplace); + CYTHON_UNUSED_VAR(zerodivision_check); #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); + + x = (long)((unsigned long)a + (unsigned long)b); if (likely((x^a) >= 0 || (x^b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -14838,77 +18570,79 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; + if (unlikely(__Pyx_PyLong_IsZero(op1))) { + return __Pyx_NewRef(op2); + } + if (likely(__Pyx_PyLong_IsCompact(op1))) { + a = __Pyx_PyLong_CompactValue(op1); } else { + const digit* digits = __Pyx_PyLong_Digits(op1); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; -#ifdef HAVE_LONG_LONG + #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; -#endif + #endif } CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_add(op1, op2); @@ -14927,8 +18661,13 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif if (PyFloat_CheckExact(op1)) { const long b = intval; +#if CYTHON_COMPILING_IN_LIMITED_API + double a = __pyx_PyFloat_AsDouble(op1); +#else double a = PyFloat_AS_DOUBLE(op1); +#endif double result; + PyFPE_START_PROTECT("add", return NULL) result = ((double)a) + (double)b; PyFPE_END_PROTECT(result) @@ -14939,12 +18678,12 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif /* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE 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) && + while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; @@ -14956,21 +18695,46 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* 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 + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + PyObject *exc_value = exc_info->exc_value; + if (exc_value == NULL || exc_value == Py_None) { + *value = NULL; + *type = NULL; + *tb = NULL; + } else { + *value = exc_value; + Py_INCREF(*value); + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + *tb = PyException_GetTraceback(exc_value); + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; - #else + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); + #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; - #endif Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); + #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + PyObject *tmp_value = exc_info->exc_value; + exc_info->exc_value = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); + #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; @@ -14991,6 +18755,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); + #endif } #endif @@ -15001,20 +18766,32 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { - PyObject *local_type, *local_value, *local_tb; + PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; + #endif #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) @@ -15036,12 +18813,21 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; + #endif } #else tmp_type = tstate->exc_type; @@ -15072,7 +18858,26 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #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 + #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_value = exc_info->exc_value; + exc_info->exc_value = *value; + if (tmp_value == NULL || tmp_value == Py_None) { + Py_XDECREF(tmp_value); + tmp_value = NULL; + tmp_type = NULL; + tmp_tb = NULL; + } else { + tmp_type = (PyObject*) Py_TYPE(tmp_value); + Py_INCREF(tmp_type); + #if CYTHON_COMPILING_IN_CPYTHON + tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; + Py_XINCREF(tmp_tb); + #else + tmp_tb = PyException_GetTraceback(tmp_value); + #endif + } + #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; @@ -15080,14 +18885,14 @@ static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject * exc_info->exc_type = *type; exc_info->exc_value = *value; exc_info->exc_traceback = *tb; - #else + #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 + #endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; @@ -15138,6 +18943,17 @@ static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) { return PyDict_Keys(d); } +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + /* DictGetItem */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { @@ -15162,17 +18978,143 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { } #endif +/* ValidateBasesTuple */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n = PyTuple_GET_SIZE(bases); + for (i = 1; i < n; i++) + { + PyObject *b0 = PyTuple_GET_ITEM(bases, i); + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } + if (dictoffset == 0 && b->tp_dictoffset) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + return -1; + } + } + return 0; +} +#endif + +/* PyType_Ready */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; +#endif +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } +#endif + return r; +#endif +} + /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); #endif + __Pyx_DECREF_TypeName(type_name); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { @@ -15203,16 +19145,18 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj #endif /* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) +#ifndef __PYX_HAVE_RT_ImportType_3_0_0 +#define __PYX_HAVE_RT_ImportType_3_0_0 +static PyTypeObject *__Pyx_ImportType_3_0_0(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_0 check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; -#ifdef Py_LIMITED_API + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; + PyObject *py_itemsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) @@ -15223,8 +19167,9 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, module_name, class_name); goto bad; } -#ifndef Py_LIMITED_API +#if !CYTHON_COMPILING_IN_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) @@ -15234,22 +19179,38 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; #endif - if ((size_t)basicsize < size) { + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_0 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_0 && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", @@ -15265,39 +19226,37 @@ static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; PyObject *module = 0; - PyObject *global_dict = 0; PyObject *empty_dict = 0; - PyObject *list; + PyObject *empty_list = 0; #if PY_MAJOR_VERSION < 3 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) + if (unlikely(!py_import)) goto bad; - #endif - if (from_list) - list = from_list; - else { + if (!from_list) { empty_list = PyList_New(0); - if (!empty_list) + if (unlikely(!empty_list)) goto bad; - list = empty_list; + from_list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; + #endif empty_dict = PyDict_New(); - if (!empty_dict) + if (unlikely(!empty_dict)) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + #if CYTHON_COMPILING_IN_LIMITED_API module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) + name, empty_dict, empty_dict, from_list, 1); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + #endif + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) goto bad; PyErr_Clear(); } @@ -15308,30 +19267,220 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); - if (!py_level) + if (unlikely(!py_level)) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else + #if CYTHON_COMPILING_IN_LIMITED_API + module = PyImport_ImportModuleLevelObject( + name, empty_dict, empty_dict, from_list, level); + #else module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); + name, __pyx_d, empty_dict, from_list, level); + #endif #endif } } bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_import); #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); return module; } +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) + goto bad; + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); + } + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); +#else +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); +#endif +bad: + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); +#else + imported_module = PyImport_GetModule(name); +#endif + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__8; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); + } + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); + } +#endif + return __Pyx__ImportDottedModule(name, parts_tuple); +} + +/* ImportDottedModuleRelFirst */ +static PyObject *__Pyx_ImportDottedModuleRelFirst(PyObject *name, PyObject *parts_tuple) { + PyObject *module; + PyObject *from_list = NULL; +#if PY_MAJOR_VERSION < 3 + PyObject *star = __pyx_n_s__8; + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); +#endif + module = __Pyx_Import(name, from_list, -1); + Py_XDECREF(from_list); + if (module) { + #if PY_MAJOR_VERSION >= 3 + if (parts_tuple) { + module = __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); + } + #endif + return module; + } + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + return NULL; + PyErr_Clear(); + return __Pyx_ImportDottedModule(name, parts_tuple); +} + /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + const char* module_name_str = 0; + PyObject* module_name = 0; + PyObject* module_dot = 0; + PyObject* full_name = 0; + PyErr_Clear(); + module_name_str = PyModule_GetName(module); + if (unlikely(!module_name_str)) { goto modbad; } + module_name = PyUnicode_FromString(module_name_str); + if (unlikely(!module_name)) { goto modbad; } + module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__9); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + goto modbad; + value = PyObject_GetItem(modules, full_name); + } + #else + value = PyImport_GetModule(full_name); + #endif + modbad: + Py_XDECREF(full_name); + Py_XDECREF(module_dot); + Py_XDECREF(module_name); + } + if (unlikely(!value)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); @@ -15344,12 +19493,13 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -15363,7 +19513,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -15374,7 +19524,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -15385,6 +19535,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -15463,44 +19614,63 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + _PyTraceback_Add(funcname, filename, py_line); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -15513,11 +19683,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -15525,14 +19700,24 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); - if (!py_code) goto bad; + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( @@ -15548,6 +19733,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ @@ -15584,7 +19770,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15598,40 +19784,45 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -15644,109 +19835,181 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 2: + if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -3: + if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 3: + if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case -4: + if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + break; + case 4: + if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -15767,6 +20030,44 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { 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); + } +} + /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -15805,6 +20106,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } } +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__44)); + } + return name; +} +#endif + /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -15818,7 +20134,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15832,40 +20148,45 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_DigitCount(x)) { + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -15878,109 +20199,181 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) + } else { + const digit* digits = __Pyx_PyLong_Digits(x); + assert(__Pyx_PyLong_DigitCount(x) > 1); + switch (__Pyx_PyLong_SignedDigitCount(x)) { + case -2: + if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 2: + if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -3: + if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 3: + if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case -4: + if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + break; + case 4: + if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (long) 0; + mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; + shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; + for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -16005,7 +20398,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -16026,6 +20419,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } return __Pyx_InBases(a, b); } +static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (cls == a || cls == b) return 1; + mro = cls->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + PyObject *base = PyTuple_GET_ITEM(mro, i); + if (base == (PyObject *)a || base == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); +} #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; @@ -16050,11 +20459,11 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc } #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); + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } - return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { @@ -16101,6 +20510,12 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj } #endif +/* PyObjectCall2Args */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* PyObjectCallMethod1 */ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); @@ -16120,12 +20535,18 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name } /* 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) { +static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { PyObject *et, *ev, *tb; PyObject *value = NULL; + CYTHON_UNUSED_VAR(__pyx_tstate); __Pyx_ErrFetch(&et, &ev, &tb); if (!et) { Py_XDECREF(tb); @@ -16140,7 +20561,7 @@ static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__p value = Py_None; } #if PY_VERSION_HEX >= 0x030300A0 - else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { + else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); @@ -16204,6 +20625,9 @@ static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__p } static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_CLEAR(exc_state->exc_value); +#else PyObject *t, *v, *tb; t = exc_state->exc_type; v = exc_state->exc_value; @@ -16214,10 +20638,12 @@ void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { Py_XDECREF(t); Py_XDECREF(v); Py_XDECREF(tb); +#endif } #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) -static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) { +static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); if ((0)) { #ifdef __Pyx_Coroutine_USED } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { @@ -16233,8 +20659,9 @@ static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineOb 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) { +static void __Pyx__Coroutine_NotStartedError(PyObject *gen) { const char *msg; + CYTHON_MAYBE_UNUSED_VAR(gen); if ((0)) { #ifdef __Pyx_Coroutine_USED } else if (__Pyx_Coroutine_Check(gen)) { @@ -16250,7 +20677,9 @@ static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) { 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) { +static void __Pyx__Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { + CYTHON_MAYBE_UNUSED_VAR(gen); + CYTHON_MAYBE_UNUSED_VAR(closing); #ifdef __Pyx_Coroutine_USED if (!closing && __Pyx_Coroutine_Check(gen)) { PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); @@ -16287,15 +20716,30 @@ PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, i 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 + if (exc_state->exc_value) { + #if CYTHON_COMPILING_IN_PYPY + #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #elif PY_VERSION_HEX >= 0x030B00a4 + exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback; #else - if (exc_state->exc_traceback) { - PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback; + exc_tb = exc_state->exc_traceback; + #endif + if (exc_tb) { + PyTracebackObject *tb = (PyTracebackObject *) exc_tb; PyFrameObject *f = tb->tb_frame; - Py_XINCREF(tstate->frame); assert(f->f_back == NULL); + #if PY_VERSION_HEX >= 0x030B00A1 + f->f_back = PyThreadState_GetFrame(tstate); + #else + Py_XINCREF(tstate->frame); f->f_back = tstate->frame; + #endif + #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON + Py_DECREF(exc_tb); + #endif } #endif } @@ -16311,7 +20755,7 @@ PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, i } #endif self->is_running = 1; - retval = self->body((PyObject *) self, tstate, value); + retval = self->body(self, tstate, value); self->is_running = 0; #if CYTHON_USE_EXC_INFO_STACK exc_state = &self->gi_exc_state; @@ -16322,18 +20766,29 @@ PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, i 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 +#if CYTHON_COMPILING_IN_PYPY + CYTHON_UNUSED_VAR(exc_state); #else + PyObject *exc_tb; + #if PY_VERSION_HEX >= 0x030B00a4 + if (!exc_state->exc_value) return; + exc_tb = PyException_GetTraceback(exc_state->exc_value); + #else + exc_tb = exc_state->exc_traceback; + #endif + if (likely(exc_tb)) { PyTracebackObject *tb = (PyTracebackObject *) exc_tb; PyFrameObject *f = tb->tb_frame; Py_CLEAR(f->f_back); -#endif + #if PY_VERSION_HEX >= 0x030B00a4 + Py_DECREF(exc_tb); + #endif } +#endif } static CYTHON_INLINE -PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) { +PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) { + CYTHON_MAYBE_UNUSED_VAR(gen); if (unlikely(!retval)) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -16418,7 +20873,7 @@ static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { #endif { if (value == Py_None) - ret = Py_TYPE(yf)->tp_iternext(yf); + ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); else ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); } @@ -16465,16 +20920,15 @@ static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { { PyObject *meth; gen->is_running = 1; - meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); + meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close); if (unlikely(!meth)) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + if (unlikely(PyErr_Occurred())) { PyErr_WriteUnraisable(yf); } - PyErr_Clear(); } else { - retval = PyObject_CallFunction(meth, NULL); + retval = __Pyx_PyObject_CallNoArg(meth); Py_DECREF(meth); - if (!retval) + if (unlikely(!retval)) err = -1; } gen->is_running = 0; @@ -16505,7 +20959,7 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) { ret = __Pyx_Coroutine_Send(yf, Py_None); } else #endif - ret = Py_TYPE(yf)->tp_iternext(yf); + ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); gen->is_running = 0; if (likely(ret)) { return ret; @@ -16514,7 +20968,8 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) { } return __Pyx_Coroutine_SendEx(gen, Py_None, 0); } -static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) { +static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { + CYTHON_UNUSED_VAR(arg); return __Pyx_Coroutine_Close(self); } static PyObject *__Pyx_Coroutine_Close(PyObject *self) { @@ -16595,22 +21050,22 @@ static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject 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); + PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_throw); if (unlikely(!meth)) { Py_DECREF(yf); - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + if (unlikely(PyErr_Occurred())) { 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); + ret = __Pyx_PyObject_Call(meth, args, NULL); } else { - ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL); + PyObject *cargs[4] = {NULL, typ, val, tb}; + ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } Py_DECREF(meth); } @@ -16629,14 +21084,18 @@ 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)) + if (unlikely(!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))) return NULL; return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); } static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { +#if PY_VERSION_HEX >= 0x030B00a4 + Py_VISIT(exc_state->exc_value); +#else Py_VISIT(exc_state->exc_type); Py_VISIT(exc_state->exc_value); Py_VISIT(exc_state->exc_traceback); +#endif return 0; } static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { @@ -16671,10 +21130,10 @@ static void __Pyx_Coroutine_dealloc(PyObject *self) { if (gen->resume_label >= 0) { PyObject_GC_Track(self); #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE - if (PyObject_CallFinalizerFromDealloc(self)) + if (unlikely(PyObject_CallFinalizerFromDealloc(self))) #else Py_TYPE(gen)->tp_del(self); - if (Py_REFCNT(self) > 0) + if (unlikely(Py_REFCNT(self) > 0)) #endif { return; @@ -16690,7 +21149,7 @@ static void __Pyx_Coroutine_dealloc(PyObject *self) { } #endif __Pyx_Coroutine_clear(self); - PyObject_GC_Del(gen); + __Pyx_PyHeapTypeObject_GC_Del(gen); } static void __Pyx_Coroutine_del(PyObject *self) { PyObject *error_type, *error_value, *error_traceback; @@ -16769,7 +21228,7 @@ static void __Pyx_Coroutine_del(PyObject *self) { __Pyx_ErrRestore(error_type, error_value, error_traceback); #if !CYTHON_USE_TP_FINALIZE assert(Py_REFCNT(self) > 0); - if (--self->ob_refcnt == 0) { + if (likely(--self->ob_refcnt == 0)) { return; } { @@ -16789,17 +21248,18 @@ static void __Pyx_Coroutine_del(PyObject *self) { #endif } static PyObject * -__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) { PyObject *name = self->gi_name; + CYTHON_UNUSED_VAR(context); if (unlikely(!name)) name = Py_None; Py_INCREF(name); return name; } static int -__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -16810,24 +21270,23 @@ __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UN "__name__ must be set to a string object"); return -1; } - tmp = self->gi_name; Py_INCREF(value); - self->gi_name = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(self->gi_name, value); return 0; } static PyObject * -__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) { PyObject *name = self->gi_qualname; + CYTHON_UNUSED_VAR(context); if (unlikely(!name)) name = Py_None; Py_INCREF(name); return name; } static int -__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context) +__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) { - PyObject *tmp; + CYTHON_UNUSED_VAR(context); #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) #else @@ -16838,16 +21297,15 @@ __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHO "__qualname__ must be set to a string object"); return -1; } - tmp = self->gi_qualname; Py_INCREF(value); - self->gi_qualname = value; - Py_XDECREF(tmp); + __Pyx_Py_XDECREF_SET(self->gi_qualname, value); return 0; } static PyObject * -__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) { PyObject *frame = self->gi_frame; + CYTHON_UNUSED_VAR(context); if (!frame) { if (unlikely(!self->gi_code)) { Py_RETURN_NONE; @@ -16883,9 +21341,13 @@ static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( gen->resume_label = 0; gen->classobj = NULL; gen->yieldfrom = NULL; + #if PY_VERSION_HEX >= 0x030B00a4 + gen->gi_exc_state.exc_value = NULL; + #else gen->gi_exc_state.exc_type = NULL; gen->gi_exc_state.exc_value = NULL; gen->gi_exc_state.exc_traceback = NULL; + #endif #if CYTHON_USE_EXC_INFO_STACK gen->gi_exc_state.previous_item = NULL; #endif @@ -16970,7 +21432,7 @@ static int __Pyx_patch_abc(void) { if (CYTHON_REGISTER_ABCS && !abc_patched) { PyObject *module; module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); - if (!module) { + if (unlikely(!module)) { PyErr_WriteUnraisable(NULL); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, ((PY_MAJOR_VERSION >= 3) ? @@ -17015,6 +21477,10 @@ static PyMemberDef __pyx_Generator_memberlist[] = { {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, +#if CYTHON_USE_TYPE_SPECS + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, +#endif {0, 0, 0, 0, 0} }; static PyGetSetDef __pyx_Generator_getsets[] = { @@ -17026,9 +21492,32 @@ static PyGetSetDef __pyx_Generator_getsets[] = { (char*) PyDoc_STR("Frame of the generator"), 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_GeneratorType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, + {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, + {Py_tp_iter, (void *)PyObject_SelfIter}, + {Py_tp_iternext, (void *)__Pyx_Generator_Next}, + {Py_tp_methods, (void *)__pyx_Generator_methods}, + {Py_tp_members, (void *)__pyx_Generator_memberlist}, + {Py_tp_getset, (void *)__pyx_Generator_getsets}, + {Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict}, +#if CYTHON_USE_TP_FINALIZE + {Py_tp_finalize, (void *)__Pyx_Coroutine_del}, +#endif + {0, 0}, +}; +static PyType_Spec __pyx_GeneratorType_spec = { + __PYX_TYPE_MODULE_PREFIX "generator", + sizeof(__pyx_CoroutineObject), + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, + __pyx_GeneratorType_slots +}; +#else static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) - "generator", + __PYX_TYPE_MODULE_PREFIX "generator", sizeof(__pyx_CoroutineObject), 0, (destructor) __Pyx_Coroutine_dealloc, @@ -17083,17 +21572,29 @@ static PyTypeObject __pyx_GeneratorType_type = { #elif PY_VERSION_HEX >= 0x030400a1 0, #endif -#if PY_VERSION_HEX >= 0x030800b1 +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 0, #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, #endif }; -static int __pyx_Generator_init(void) { +#endif +static int __pyx_Generator_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_GeneratorType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); +#endif if (unlikely(!__pyx_GeneratorType)) { return -1; } @@ -17102,13 +21603,35 @@ static int __pyx_Generator_init(void) { /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char ctversion[5]; + int same=1, i, found_dot; + const char* rt_from_call = Py_GetVersion(); + PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + found_dot = 0; + for (i = 0; i < 4; i++) { + if (!ctversion[i]) { + same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); + break; + } + if (rt_from_call[i] != ctversion[i]) { + same = 0; + break; + } + } + if (!same) { + char rtversion[5] = {'\0'}; char message[200]; + for (i=0; i<4; ++i) { + if (rt_from_call[i] == '.') { + if (found_dot) break; + found_dot = 1; + } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { + break; + } + rtversion[i] = rt_from_call[i]; + } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " + "compile time version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); @@ -17117,9 +21640,9 @@ static int __Pyx_check_binary_version(void) { } /* VoidPtrImport */ -#ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { +#ifndef __PYX_HAVE_RT_ImportVoidPtr_3_0_0 +#define __PYX_HAVE_RT_ImportVoidPtr_3_0_0 +static int __Pyx_ImportVoidPtr_3_0_0(PyObject *module, const char *name, void **p, const char *sig) { PyObject *d = 0; PyObject *cobj = 0; d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); @@ -17132,7 +21655,6 @@ static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, con PyModule_GetName(module), name); goto bad; } -#if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", @@ -17140,21 +21662,6 @@ static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, con goto bad; } *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif if (!(*p)) goto bad; Py_DECREF(d); @@ -17166,9 +21673,9 @@ static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, con #endif /* FunctionImport */ -#ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { +#ifndef __PYX_HAVE_RT_ImportFunction_3_0_0 +#define __PYX_HAVE_RT_ImportFunction_3_0_0 +static int __Pyx_ImportFunction_3_0_0(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { @@ -17185,7 +21692,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** PyModule_GetName(module), funcname); goto bad; } -#if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", @@ -17193,21 +21699,6 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** goto bad; } tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif *f = tmp.fp; if (!(*f)) goto bad; @@ -17220,9 +21711,31 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (** #endif /* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -17230,23 +21743,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; @@ -17308,7 +21809,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -17337,22 +21838,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -17418,13 +21923,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -17467,6 +21970,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } @@ -17475,4 +21995,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */ diff --git a/pyreadstat/pyreadstat.pyx b/pyreadstat/pyreadstat.pyx index f00dc6c..2fb9f99 100644 --- a/pyreadstat/pyreadstat.pyx +++ b/pyreadstat/pyreadstat.pyx @@ -23,11 +23,11 @@ import multiprocessing as mp import pandas as pd -from readstat_api cimport readstat_parse_sas7bdat, readstat_parse_dta, readstat_parse_sav -from readstat_api cimport readstat_parse_por, readstat_parse_xport -from readstat_api cimport readstat_parse_sas7bcat -from readstat_api cimport readstat_begin_writing_dta, readstat_begin_writing_por, readstat_begin_writing_sav -from _readstat_parser cimport py_file_format, run_conversion +#from readstat_api cimport readstat_parse_sas7bdat, readstat_parse_dta, readstat_parse_sav +#from readstat_api cimport readstat_parse_por, readstat_parse_xport +#from readstat_api cimport readstat_parse_sas7bcat +#from readstat_api cimport readstat_begin_writing_dta, readstat_begin_writing_por, readstat_begin_writing_sav +from _readstat_parser cimport py_file_format, py_file_extension, run_conversion from _readstat_parser import PyreadstatError from _readstat_writer cimport run_write cimport _readstat_parser, _readstat_writer @@ -124,7 +124,8 @@ def read_sas7bdat(filename_path, metadataonly=False, dates_as_pandas_datetime=Fa no_datetime_conversion = 1 cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS - data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sas7bdat, encoding, metaonly, + cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BDAT + data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, output_format, extra_datetime_formats, extra_date_formats) metadata.file_format = "sas7bdat" @@ -201,7 +202,8 @@ def read_xport(filename_path, metadataonly=False, dates_as_pandas_datetime=False no_datetime_conversion = 1 cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS - data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_xport, encoding, metaonly, + cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_XPORT + data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, output_format, extra_datetime_formats, extra_date_formats) metadata.file_format = "xport" @@ -289,7 +291,8 @@ def read_dta(filename_path, metadataonly=False, dates_as_pandas_datetime=False, no_datetime_conversion = 1 cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_STATA - data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_dta, encoding, metaonly, + cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_DTA + data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, output_format, extra_datetime_formats, extra_date_formats) metadata.file_format = "dta" @@ -381,7 +384,8 @@ def read_sav(filename_path, metadataonly=False, dates_as_pandas_datetime=False, no_datetime_conversion = 1 cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS - data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sav, encoding, metaonly, + cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAV + data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, output_format, extra_datetime_formats, extra_date_formats) metadata.file_format = "sav/zsav" @@ -468,7 +472,8 @@ def read_por(filename_path, metadataonly=False, dates_as_pandas_datetime=False, no_datetime_conversion = 1 cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SPSS - data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_por, encoding, metaonly, + cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_POR + data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, output_format, extra_datetime_formats, extra_date_formats) metadata.file_format = "por" @@ -521,7 +526,8 @@ def read_sas7bcat(filename_path, str encoding=None, str output_format=None): cdef list extra_date_formats=None cdef py_file_format file_format = _readstat_parser.FILE_FORMAT_SAS - data_frame, metadata = run_conversion(filename_path, file_format, readstat_parse_sas7bcat, encoding, metaonly, + cdef py_file_extension file_extension = _readstat_parser.FILE_EXT_SAS7BCAT + data_frame, metadata = run_conversion(filename_path, file_format, file_extension, encoding, metaonly, dates_as_pandas, usecols, usernan, no_datetime_conversion, row_limit, row_offset, output_format, extra_datetime_formats, extra_date_formats) metadata.file_format = "sas7bcat" diff --git a/pyreadstat/readstat_api.pxd b/pyreadstat/readstat_api.pxd index f4edd2f..b1a785a 100644 --- a/pyreadstat/readstat_api.pxd +++ b/pyreadstat/readstat_api.pxd @@ -34,11 +34,11 @@ cdef extern from "" nogil: ctypedef signed long int64_t ctypedef unsigned char uint8_t -IF UNAME_SYSNAME != 'Windows': - cdef extern from '': - int close(int fd) - ssize_t write(int fd, const void *buf, size_t nbyte) - +#cdef extern from "conditional_includes.h": +# int close(int fd) +# ssize_t write(int fd, const void *buf, size_t nbyte) + + cdef extern from "readstat.h": @@ -264,3 +264,7 @@ cdef extern from "readstat.h": cdef readstat_error_t readstat_end_writing(readstat_writer_t *writer); cdef void readstat_writer_free(readstat_writer_t *writer); + +cdef extern from "readstat_io_unistd.h": + cdef struct unistd_io_ctx_t "unistd_io_ctx_s": + int fd \ No newline at end of file diff --git a/setup.py b/setup.py index 95e48ea..ce96f08 100644 --- a/setup.py +++ b/setup.py @@ -26,9 +26,9 @@ if PY_MAJOR_VERSION < 3 and os.name == 'nt': raise Exception("Python 2 is not supported on Windows.") -cyver = int(Cython.__version__.split(".")[1]) -if cyver < 28: - msg = "Cython version 0.28 or newer required" +cyver = int(Cython.__version__.split(".")[0]) +if cyver < 3: + msg = "Cython version 3 or newer required" raise Exception(msg) ext = '.pyx' @@ -127,7 +127,7 @@ setup( name='pyreadstat', - version='1.2.2', + version='1.2.3', description=short_description, author="Otto Fajardo", author_email="pleasecontactviagithub@notvalid.com",