diff --git a/README.md b/README.md index 58687b6..145b252 100644 --- a/README.md +++ b/README.md @@ -747,10 +747,6 @@ user defined missing values in stata/sas where characters (a to z, A to Z, \_) w pyreadstat builds on top of Readstat and therefore inherits its limitations. Currently those include: -* XPT files v8 with labels are not read correctly (see [here](/~https://github.com/WizardMac/ReadStat/issues/208)) -* Cannot read sas7bdat dataset labels (see [here](/~https://github.com/WizardMac/ReadStat/issues/180)) -* Dates, datetimes and times in SPSS POR files are not translated to python dates, datetimes and times, but stay as - timestamps. (see [here](/~https://github.com/WizardMac/ReadStat/issues/160)) * Cannot write SAS sas7bdat. Those files can be written but not read in SAS and therefore are not supported in pyreadstat. (see [here](/~https://github.com/WizardMac/ReadStat/issues/98)) @@ -765,7 +761,7 @@ Converting data types from foreign applications into python some times also brin OverflowError: date value out of range ``` - The workarounds to deal with this include using the keyword argument disable_datetime_conversion so that you will + The workaround is to deal with this include using the keyword argument disable_datetime_conversion so that you will get numbers instead of datetime objects or skipping reading such columns with the argument usecols. ## Python 2.7 support. @@ -777,8 +773,10 @@ 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). +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. ## Change log diff --git a/change_log.md b/change_log.md index 8392029..2ce822b 100644 --- a/change_log.md +++ b/change_log.md @@ -1,3 +1,8 @@ +# 1.0.6 (github, pypi and conda 2020.12.17) +* Updated Readstat to version 1.1.5, this fixes: reading sas7bdat file labels, + reading newer por files date-like columns, and few others. +* Corrected writing columns with numpy.float32 format. + # 1.0.5 (github, pypi and conda 2020.11.13) * fixed sharing permissions when reading files on windows, fixes #87 diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index 0c77f84..1925735 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree index 7ec81b4..5cf09e8 100644 Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo index e09ce27..43a9f32 100644 --- a/docs/_build/html/.buildinfo +++ b/docs/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 0e6aa8dad2e26ffbb7cd3a5536c8b463 +config: 91713509866076208214b3c819ac7b2d tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_build/html/_sources/index.rst.txt b/docs/_build/html/_sources/index.rst.txt index 1fb749a..4f28294 100644 --- a/docs/_build/html/_sources/index.rst.txt +++ b/docs/_build/html/_sources/index.rst.txt @@ -35,6 +35,7 @@ object contains the following fields: in the value_labels coming from the sas7bcat file. * original_variable_types : a dict of variable name to variable format in the original file. For debugging purposes. * table_name : table name (string) + * file_label : file label (SAS) (string) * missing_ranges: a dict with keys being variable names. Values are a list of dicts. Each dict contains two keys, 'lo' and 'hi' being the lower boundary and higher boundary for the missing range. Even if the value in both lo and hi are the same, the two elements will always be present. This appears for SPSS (sav) files when using the diff --git a/docs/_build/html/_static/documentation_options.js b/docs/_build/html/_static/documentation_options.js index 8314691..42185a7 100644 --- a/docs/_build/html/_static/documentation_options.js +++ b/docs/_build/html/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '1.0.5', + VERSION: '1.0.6', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index 3e3988a..0f00dce 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -7,7 +7,7 @@ - Index — pyreadstat 1.0.5 documentation + Index — pyreadstat 1.0.6 documentation diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index d834c3e..f4f27fc 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -7,7 +7,7 @@ - Welcome to pyreadstat’s documentation! — pyreadstat 1.0.5 documentation + Welcome to pyreadstat’s documentation! — pyreadstat 1.0.6 documentation @@ -181,6 +181,7 @@

Metadata Object Description - Python Module Index — pyreadstat 1.0.5 documentation + Python Module Index — pyreadstat 1.0.6 documentation diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index 842cff5..1f026d2 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -7,7 +7,7 @@ - Search — pyreadstat 1.0.5 documentation + Search — pyreadstat 1.0.6 documentation diff --git a/docs/conf.py b/docs/conf.py index cdffda8..df35cbe 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.0.5' +release = '1.0.6' # -- General configuration --------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index 1fb749a..4f28294 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -35,6 +35,7 @@ object contains the following fields: in the value_labels coming from the sas7bcat file. * original_variable_types : a dict of variable name to variable format in the original file. For debugging purposes. * table_name : table name (string) + * file_label : file label (SAS) (string) * missing_ranges: a dict with keys being variable names. Values are a list of dicts. Each dict contains two keys, 'lo' and 'hi' being the lower boundary and higher boundary for the missing range. Even if the value in both lo and hi are the same, the two elements will always be present. This appears for SPSS (sav) files when using the diff --git a/pyreadstat/__init__.py b/pyreadstat/__init__.py index 15b6c87..ccf4da8 100644 --- a/pyreadstat/__init__.py +++ b/pyreadstat/__init__.py @@ -20,4 +20,4 @@ from .pyreadstat import read_file_in_chunks, read_file_multiprocessing from ._readstat_parser import ReadstatError, metadata_container -__version__ = "1.0.5" +__version__ = "1.0.6" diff --git a/pyreadstat/_readstat_writer.c b/pyreadstat/_readstat_writer.c index 5d481a6..076f524 100644 --- a/pyreadstat/_readstat_writer.c +++ b/pyreadstat/_readstat_writer.c @@ -1660,7 +1660,7 @@ 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__13[] = "_"; +static const char __pyx_k__14[] = "_"; static const char __pyx_k_any[] = "any"; static const char __pyx_k_chr[] = "chr"; static const char __pyx_k_get[] = "get"; @@ -1719,6 +1719,7 @@ static const char __pyx_k_values[] = "values"; static const char __pyx_k_asarray[] = "asarray"; static const char __pyx_k_columns[] = "columns"; static const char __pyx_k_combine[] = "combine"; +static const char __pyx_k_float32[] = "float32"; static const char __pyx_k_isalpha[] = "isalpha"; static const char __pyx_k_nominal[] = "nominal"; static const char __pyx_k_ordinal[] = "ordinal"; @@ -1800,7 +1801,7 @@ static PyObject *__pyx_n_s_UInt64Dtype; static PyObject *__pyx_n_s_UInt8Dtype; static PyObject *__pyx_kp_s_Unknown_data_format_to_insert; static PyObject *__pyx_kp_s_Unknown_pywriter_variable_format; -static PyObject *__pyx_n_s__13; +static PyObject *__pyx_n_s__14; static PyObject *__pyx_kp_s__2; static PyObject *__pyx_kp_s_alignment_for_variable_s_must_be; static PyObject *__pyx_n_s_any; @@ -1832,6 +1833,7 @@ static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_expanduser; 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_get; static PyObject *__pyx_n_s_hi; static PyObject *__pyx_n_s_iloc; @@ -1934,6 +1936,7 @@ 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; /* Late includes */ /* "pyreadstat/_readstat_writer.pyx":60 @@ -3643,7 +3646,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * # 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_6, __pyx_n_s_pd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); @@ -3668,8 +3671,8 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * # 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_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); @@ -3702,35 +3705,35 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * # 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: */ } - /* "pyreadstat/_readstat_writer.pyx":201 + /* "pyreadstat/_readstat_writer.pyx":200 + * 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)) * elif col_type in float_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, 201, __pyx_L1_error) + __PYX_ERR(0, 200, __pyx_L1_error) } - __pyx_t_11 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_11 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_int_types, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 200, __pyx_L1_error) __pyx_t_10 = (__pyx_t_11 != 0); if (__pyx_t_10) { - /* "pyreadstat/_readstat_writer.pyx":202 - * + /* "pyreadstat/_readstat_writer.pyx":201 + * 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, 202, __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, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -3741,12 +3744,12 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_0); __pyx_t_3 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "pyreadstat/_readstat_writer.pyx":201 + /* "pyreadstat/_readstat_writer.pyx":200 + * 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)) * elif col_type in float_types: @@ -3754,7 +3757,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L9; } - /* "pyreadstat/_readstat_writer.pyx":203 + /* "pyreadstat/_readstat_writer.pyx":202 * if col_type in int_types: * result.append((PYWRITER_INTEGER, 0,0)) * elif col_type in float_types: # <<<<<<<<<<<<<< @@ -3763,27 +3766,27 @@ 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, 203, __pyx_L1_error) + __PYX_ERR(0, 202, __pyx_L1_error) } - __pyx_t_10 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_float_types, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 203, __pyx_L1_error) + __pyx_t_10 = (__Pyx_PySet_ContainsTF(__pyx_v_col_type, __pyx_v_10pyreadstat_16_readstat_writer_float_types, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) __pyx_t_11 = (__pyx_t_10 != 0); if (__pyx_t_11) { - /* "pyreadstat/_readstat_writer.pyx":204 + /* "pyreadstat/_readstat_writer.pyx":203 * 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, 204, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_any); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_isna); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_isna); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; @@ -3798,7 +3801,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types } __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_8, __pyx_v_curseries) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_v_curseries); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = NULL; @@ -3814,23 +3817,23 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __pyx_t_6 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __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_6)) __PYX_ERR(0, 204, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_11) { - /* "pyreadstat/_readstat_writer.pyx":205 + /* "pyreadstat/_readstat_writer.pyx":204 * 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_6 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); @@ -3841,10 +3844,10 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_1); __pyx_t_6 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 205, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "pyreadstat/_readstat_writer.pyx":204 + /* "pyreadstat/_readstat_writer.pyx":203 * result.append((PYWRITER_INTEGER, 0,0)) * elif col_type in float_types: * if np.any(pd.isna(curseries)): # <<<<<<<<<<<<<< @@ -3854,7 +3857,7 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L10; } - /* "pyreadstat/_readstat_writer.pyx":207 + /* "pyreadstat/_readstat_writer.pyx":206 * result.append((PYWRITER_DOUBLE, 0, 1)) * else: * result.append((PYWRITER_DOUBLE, 0, 0)) # <<<<<<<<<<<<<< @@ -3862,9 +3865,9 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types * result.append((PYWRITER_LOGICAL, 0,0)) */ /*else*/ { - __pyx_t_7 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); @@ -3875,12 +3878,12 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_0); __pyx_t_7 = 0; - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_6); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_L10:; - /* "pyreadstat/_readstat_writer.pyx":203 + /* "pyreadstat/_readstat_writer.pyx":202 * if col_type in int_types: * result.append((PYWRITER_INTEGER, 0,0)) * elif col_type in float_types: # <<<<<<<<<<<<<< @@ -3890,34 +3893,34 @@ static PyObject *__pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types goto __pyx_L9; } - /* "pyreadstat/_readstat_writer.pyx":208 + /* "pyreadstat/_readstat_writer.pyx":207 * else: * result.append((PYWRITER_DOUBLE, 0, 0)) * elif col_type == np.bool: # <<<<<<<<<<<<<< * result.append((PYWRITER_LOGICAL, 0,0)) * # np.datetime64[ns] */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_bool); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_bool); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_RichCompare(__pyx_v_col_type, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_6 = PyObject_RichCompare(__pyx_v_col_type, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_11) { - /* "pyreadstat/_readstat_writer.pyx":209 + /* "pyreadstat/_readstat_writer.pyx":208 * result.append((PYWRITER_DOUBLE, 0, 0)) * elif col_type == np.bool: * result.append((PYWRITER_LOGICAL, 0,0)) # <<<<<<<<<<<<<< * # np.datetime64[ns] * elif col_type == np.dtype('tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L1_error) + __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 301, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -5611,17 +5614,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, 302, __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, 301, __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, 302, __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, 301, __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, 302, __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, 301, __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, 302, __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, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -5631,7 +5634,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, 302, __pyx_L1_error) + else __PYX_ERR(0, 301, __pyx_L1_error) } break; } @@ -5643,7 +5646,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, 302, __pyx_L1_error) + __PYX_ERR(0, 301, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -5656,15 +5659,15 @@ 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, 302, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 301, __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, 302, __pyx_L1_error) + __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 301, __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; @@ -5672,7 +5675,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __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, 302, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 301, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L6_unpacking_done; @@ -5680,7 +5683,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, 302, __pyx_L1_error) + __PYX_ERR(0, 301, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_7); @@ -5688,28 +5691,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":304 + /* "pyreadstat/_readstat_writer.pyx":303 * 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, 304, __pyx_L1_error) - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 304, __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, 303, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":305 + /* "pyreadstat/_readstat_writer.pyx":304 * * 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, 305, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_label); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 305, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 304, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); @@ -5717,20 +5720,20 @@ 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, 305, __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, 304, __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":306 + /* "pyreadstat/_readstat_writer.pyx":305 * 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, 306, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { @@ -5744,14 +5747,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 306, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __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, 306, __pyx_L1_error) + __PYX_ERR(0, 305, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":304 + /* "pyreadstat/_readstat_writer.pyx":303 * for value, label in value_labels.items(): * * if type(label) != str: # <<<<<<<<<<<<<< @@ -5760,7 +5763,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":308 + /* "pyreadstat/_readstat_writer.pyx":307 * raise PyreadstatError(msg) * * if user_missing_tags and value in user_missing_tags: # <<<<<<<<<<<<<< @@ -5773,13 +5776,13 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l __pyx_t_11 = __pyx_t_12; 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, 308, __pyx_L1_error) + __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, 307, __pyx_L1_error) __pyx_t_13 = (__pyx_t_12 != 0); __pyx_t_11 = __pyx_t_13; __pyx_L9_bool_binop_done:; if (__pyx_t_11) { - /* "pyreadstat/_readstat_writer.pyx":309 + /* "pyreadstat/_readstat_writer.pyx":308 * * if user_missing_tags and value in user_missing_tags: * if curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -5790,26 +5793,26 @@ 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":310 + /* "pyreadstat/_readstat_writer.pyx":309 * 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, 310, __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, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_msg = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":311 + /* "pyreadstat/_readstat_writer.pyx":310 * 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, 311, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { @@ -5823,14 +5826,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 311, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __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, 311, __pyx_L1_error) + __PYX_ERR(0, 310, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":309 + /* "pyreadstat/_readstat_writer.pyx":308 * * if user_missing_tags and value in user_missing_tags: * if curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -5841,15 +5844,15 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l default: break; } - /* "pyreadstat/_readstat_writer.pyx":313 + /* "pyreadstat/_readstat_writer.pyx":312 * 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, 313, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 313, __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, 312, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { @@ -5863,14 +5866,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 313, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __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, 313, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 312, __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":314 + /* "pyreadstat/_readstat_writer.pyx":313 * * readstat_label_tagged_value(label_set, ord(value), label.encode("utf-8")) * continue # <<<<<<<<<<<<<< @@ -5879,7 +5882,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ goto __pyx_L3_continue; - /* "pyreadstat/_readstat_writer.pyx":308 + /* "pyreadstat/_readstat_writer.pyx":307 * raise PyreadstatError(msg) * * if user_missing_tags and value in user_missing_tags: # <<<<<<<<<<<<<< @@ -5888,7 +5891,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":317 + /* "pyreadstat/_readstat_writer.pyx":316 * * * if curpytype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< @@ -5898,7 +5901,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":318 + /* "pyreadstat/_readstat_writer.pyx":317 * * if curpytype == PYWRITER_DOUBLE: * if type(value) not in numeric_types: # <<<<<<<<<<<<<< @@ -5907,22 +5910,22 @@ 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, 318, __pyx_L1_error) + __PYX_ERR(0, 317, __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, 318, __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, 317, __pyx_L1_error) __pyx_t_13 = (__pyx_t_11 != 0); if (unlikely(__pyx_t_13)) { - /* "pyreadstat/_readstat_writer.pyx":319 + /* "pyreadstat/_readstat_writer.pyx":318 * 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, 319, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); @@ -5930,20 +5933,20 @@ 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, 319, __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, 318, __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":320 + /* "pyreadstat/_readstat_writer.pyx":319 * 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, 320, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { @@ -5957,14 +5960,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 320, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __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, 320, __pyx_L1_error) + __PYX_ERR(0, 319, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":318 + /* "pyreadstat/_readstat_writer.pyx":317 * * if curpytype == PYWRITER_DOUBLE: * if type(value) not in numeric_types: # <<<<<<<<<<<<<< @@ -5973,15 +5976,15 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":321 + /* "pyreadstat/_readstat_writer.pyx":320 * 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, 321, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 321, __pyx_L1_error) + __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { @@ -5995,14 +5998,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 321, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __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, 321, __pyx_L1_error) + __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 320, __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":317 + /* "pyreadstat/_readstat_writer.pyx":316 * * * if curpytype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< @@ -6012,7 +6015,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":324 + /* "pyreadstat/_readstat_writer.pyx":323 * * elif curpytype == PYWRITER_INTEGER: * if type(value) not in int_types: # <<<<<<<<<<<<<< @@ -6021,22 +6024,22 @@ 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, 324, __pyx_L1_error) + __PYX_ERR(0, 323, __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, 324, __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, 323, __pyx_L1_error) __pyx_t_11 = (__pyx_t_13 != 0); if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":325 + /* "pyreadstat/_readstat_writer.pyx":324 * 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, 325, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); 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, 325, __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); @@ -6044,20 +6047,20 @@ 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, 325, __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, 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":326 + /* "pyreadstat/_readstat_writer.pyx":325 * 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, 326, __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; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { @@ -6071,14 +6074,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 326, __pyx_L1_error) + 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, 326, __pyx_L1_error) + __PYX_ERR(0, 325, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":324 + /* "pyreadstat/_readstat_writer.pyx":323 * * elif curpytype == PYWRITER_INTEGER: * if type(value) not in int_types: # <<<<<<<<<<<<<< @@ -6087,15 +6090,15 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":327 + /* "pyreadstat/_readstat_writer.pyx":326 * 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, 327, __pyx_L1_error) - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 327, __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, 326, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { @@ -6109,14 +6112,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 327, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __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, 327, __pyx_L1_error) + __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 326, __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":323 + /* "pyreadstat/_readstat_writer.pyx":322 * readstat_label_double_value(label_set, value, label.encode("utf-8")) * * elif curpytype == PYWRITER_INTEGER: # <<<<<<<<<<<<<< @@ -6126,48 +6129,48 @@ 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":330 + /* "pyreadstat/_readstat_writer.pyx":329 * * 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, 330, __pyx_L1_error) - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 330, __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, 329, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 329, __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, 330, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_v_value, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __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, 330, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 329, __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_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_v_value, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __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, 330, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_11 = __pyx_t_13; __pyx_L14_bool_binop_done:; if (unlikely(__pyx_t_11)) { - /* "pyreadstat/_readstat_writer.pyx":331 + /* "pyreadstat/_readstat_writer.pyx":330 * 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, 331, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 331, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); @@ -6175,20 +6178,20 @@ 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, 331, __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, 330, __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":332 + /* "pyreadstat/_readstat_writer.pyx":331 * 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, 332, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { @@ -6202,14 +6205,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 332, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __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, 332, __pyx_L1_error) + __PYX_ERR(0, 331, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":330 + /* "pyreadstat/_readstat_writer.pyx":329 * * elif curpytype == PYWRITER_LOGICAL: * if type(value) != bool and (value != 0 and value != 1): # <<<<<<<<<<<<<< @@ -6218,18 +6221,18 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":333 + /* "pyreadstat/_readstat_writer.pyx":332 * 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, 333, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __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, 333, __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, 332, __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, 333, __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; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { @@ -6243,14 +6246,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 333, __pyx_L1_error) + 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_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 333, __pyx_L1_error) + __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 332, __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":329 + /* "pyreadstat/_readstat_writer.pyx":328 * readstat_label_int32_value(label_set, value, label.encode("utf-8")) * * elif curpytype == PYWRITER_LOGICAL: # <<<<<<<<<<<<<< @@ -6260,7 +6263,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":335 + /* "pyreadstat/_readstat_writer.pyx":334 * readstat_label_int32_value(label_set, int(value), label.encode("utf-8")) * * elif curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -6269,26 +6272,26 @@ 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":336 + /* "pyreadstat/_readstat_writer.pyx":335 * * 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, 336, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __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":337 + /* "pyreadstat/_readstat_writer.pyx":336 * 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): */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_encode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { @@ -6302,11 +6305,11 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 337, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 336, __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, 337, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 337, __pyx_L1_error) + __pyx_t_20 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_20) && PyErr_Occurred())) __PYX_ERR(0, 336, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { @@ -6320,15 +6323,15 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 337, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 336, __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, 337, __pyx_L1_error) + __pyx_t_21 = __Pyx_PyObject_AsString(__pyx_t_8); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 336, __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":335 + /* "pyreadstat/_readstat_writer.pyx":334 * readstat_label_int32_value(label_set, int(value), label.encode("utf-8")) * * elif curpytype == PYWRITER_CHARACTER or curpytype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -6338,7 +6341,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":339 + /* "pyreadstat/_readstat_writer.pyx":338 * readstat_label_string_value(label_set, value.encode("utf-8"), label.encode("utf-8")) * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME): # <<<<<<<<<<<<<< @@ -6348,7 +6351,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME: case __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME: - /* "pyreadstat/_readstat_writer.pyx":340 + /* "pyreadstat/_readstat_writer.pyx":339 * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME): * if type(value) not in nat_types: # <<<<<<<<<<<<<< @@ -6357,22 +6360,22 @@ 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, 340, __pyx_L1_error) + __PYX_ERR(0, 339, __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, 340, __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, 339, __pyx_L1_error) __pyx_t_13 = (__pyx_t_11 != 0); if (unlikely(__pyx_t_13)) { - /* "pyreadstat/_readstat_writer.pyx":341 + /* "pyreadstat/_readstat_writer.pyx":340 * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME): * 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, 341, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); @@ -6380,20 +6383,20 @@ 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, 341, __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, 340, __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":342 + /* "pyreadstat/_readstat_writer.pyx":341 * 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, 342, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -6407,14 +6410,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 342, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 341, __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, 342, __pyx_L1_error) + __PYX_ERR(0, 341, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":340 + /* "pyreadstat/_readstat_writer.pyx":339 * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME): * if type(value) not in nat_types: # <<<<<<<<<<<<<< @@ -6423,24 +6426,24 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l */ } - /* "pyreadstat/_readstat_writer.pyx":343 + /* "pyreadstat/_readstat_writer.pyx":342 * 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, 343, __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, 342, __pyx_L1_error) __pyx_v_double_val = __pyx_t_16; - /* "pyreadstat/_readstat_writer.pyx":344 + /* "pyreadstat/_readstat_writer.pyx":343 * 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, 344, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_label, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { @@ -6454,14 +6457,14 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l } __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, 344, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __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, 344, __pyx_L1_error) + __pyx_t_17 = __Pyx_PyObject_AsString(__pyx_t_8); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 343, __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":339 + /* "pyreadstat/_readstat_writer.pyx":338 * readstat_label_string_value(label_set, value.encode("utf-8"), label.encode("utf-8")) * * elif curpytype in (PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME): # <<<<<<<<<<<<<< @@ -6472,7 +6475,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l default: break; } - /* "pyreadstat/_readstat_writer.pyx":302 + /* "pyreadstat/_readstat_writer.pyx":301 * label_set = readstat_add_label_set(writer, curtype, labelset_name.encode("utf-8")) * * for value, label in value_labels.items(): # <<<<<<<<<<<<<< @@ -6483,7 +6486,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":346 + /* "pyreadstat/_readstat_writer.pyx":345 * readstat_label_double_value(label_set, double_val, label.encode("utf-8")) * * return label_set # <<<<<<<<<<<<<< @@ -6493,7 +6496,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":288 + /* "pyreadstat/_readstat_writer.pyx":287 * return result * * cdef readstat_label_set_t *set_value_label(readstat_writer_t *writer, dict value_labels, str labelset_name, # <<<<<<<<<<<<<< @@ -6518,7 +6521,7 @@ static readstat_label_set_t *__pyx_f_10pyreadstat_16_readstat_writer_set_value_l return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":348 +/* "pyreadstat/_readstat_writer.pyx":347 * return label_set * * cdef void add_missing_ranges(list cur_ranges, readstat_variable_t *variable) except *: # <<<<<<<<<<<<<< @@ -6552,7 +6555,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":354 + /* "pyreadstat/_readstat_writer.pyx":353 * """ * * cdef int range_values = 0 # <<<<<<<<<<<<<< @@ -6561,7 +6564,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_range_values = 0; - /* "pyreadstat/_readstat_writer.pyx":355 + /* "pyreadstat/_readstat_writer.pyx":354 * * cdef int range_values = 0 * cdef int discrete_values = 0 # <<<<<<<<<<<<<< @@ -6570,7 +6573,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_values = 0; - /* "pyreadstat/_readstat_writer.pyx":356 + /* "pyreadstat/_readstat_writer.pyx":355 * cdef int range_values = 0 * cdef int discrete_values = 0 * cdef int discrete_strings = 0 # <<<<<<<<<<<<<< @@ -6579,7 +6582,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ __pyx_v_discrete_strings = 0; - /* "pyreadstat/_readstat_writer.pyx":358 + /* "pyreadstat/_readstat_writer.pyx":357 * cdef int discrete_strings = 0 * * for cur_range in cur_ranges: # <<<<<<<<<<<<<< @@ -6588,21 +6591,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, 358, __pyx_L1_error) + __PYX_ERR(0, 357, __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, 358, __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, 357, __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, 358, __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, 357, __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":359 + /* "pyreadstat/_readstat_writer.pyx":358 * * for cur_range in cur_ranges: * if isinstance(cur_range, dict): # <<<<<<<<<<<<<< @@ -6613,14 +6616,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":360 + /* "pyreadstat/_readstat_writer.pyx":359 * 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, 360, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -6634,20 +6637,20 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 360, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_hi, __pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":361 + /* "pyreadstat/_readstat_writer.pyx":360 * 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, 361, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -6661,13 +6664,13 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 361, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_lo, __pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":362 + /* "pyreadstat/_readstat_writer.pyx":361 * hi = cur_range.get("hi") * lo = cur_range.get("lo") * if hi is None or lo is None: # <<<<<<<<<<<<<< @@ -6687,7 +6690,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_L7_bool_binop_done:; if (unlikely(__pyx_t_5)) { - /* "pyreadstat/_readstat_writer.pyx":363 + /* "pyreadstat/_readstat_writer.pyx":362 * 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" # <<<<<<<<<<<<<< @@ -6697,14 +6700,14 @@ 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":364 + /* "pyreadstat/_readstat_writer.pyx":363 * 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 hi == lo: */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -6718,14 +6721,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 364, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 364, __pyx_L1_error) + __PYX_ERR(0, 363, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":362 + /* "pyreadstat/_readstat_writer.pyx":361 * hi = cur_range.get("hi") * lo = cur_range.get("lo") * if hi is None or lo is None: # <<<<<<<<<<<<<< @@ -6734,7 +6737,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":365 + /* "pyreadstat/_readstat_writer.pyx":364 * 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: # <<<<<<<<<<<<<< @@ -6743,9 +6746,9 @@ 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, 365, __pyx_L1_error) + __PYX_ERR(0, 364, __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, 365, __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, 364, __pyx_L1_error) __pyx_t_8 = (__pyx_t_4 != 0); if (__pyx_t_8) { } else { @@ -6754,37 +6757,37 @@ 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, 365, __pyx_L1_error) + __PYX_ERR(0, 364, __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, 365, __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, 364, __pyx_L1_error) __pyx_t_4 = (__pyx_t_8 != 0); __pyx_t_5 = __pyx_t_4; __pyx_L10_bool_binop_done:; if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":366 + /* "pyreadstat/_readstat_writer.pyx":365 * raise PyreadstatError(msg) * if type(hi) in numeric_types and type(lo) in numeric_types: * 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, 366, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 366, __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, 365, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { - /* "pyreadstat/_readstat_writer.pyx":367 + /* "pyreadstat/_readstat_writer.pyx":366 * if type(hi) in numeric_types and type(lo) in numeric_types: * 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, 367, __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, 367, __pyx_L1_error) + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_hi); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 366, __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, 366, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":368 + /* "pyreadstat/_readstat_writer.pyx":367 * if hi == lo: * check_exit_status(readstat_variable_add_missing_double_value(variable, hi)) * discrete_values += 1 # <<<<<<<<<<<<<< @@ -6793,7 +6796,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":366 + /* "pyreadstat/_readstat_writer.pyx":365 * raise PyreadstatError(msg) * if type(hi) in numeric_types and type(lo) in numeric_types: * if hi == lo: # <<<<<<<<<<<<<< @@ -6803,7 +6806,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L12; } - /* "pyreadstat/_readstat_writer.pyx":370 + /* "pyreadstat/_readstat_writer.pyx":369 * discrete_values += 1 * else: * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) # <<<<<<<<<<<<<< @@ -6811,11 +6814,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, 370, __pyx_L1_error) - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_hi); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 370, __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, 370, __pyx_L1_error) + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_lo); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L1_error) + __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_hi); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __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, 369, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":371 + /* "pyreadstat/_readstat_writer.pyx":370 * else: * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) * range_values += 1 # <<<<<<<<<<<<<< @@ -6826,7 +6829,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __pyx_L12:; - /* "pyreadstat/_readstat_writer.pyx":365 + /* "pyreadstat/_readstat_writer.pyx":364 * 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: # <<<<<<<<<<<<<< @@ -6836,52 +6839,52 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L9; } - /* "pyreadstat/_readstat_writer.pyx":372 + /* "pyreadstat/_readstat_writer.pyx":371 * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) * range_values += 1 * elif type(hi) == str and type(lo) == str: # <<<<<<<<<<<<<< * if hi == lo: * if len(hi) > 8: */ - __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, 372, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 372, __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, 371, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { } else { __pyx_t_5 = __pyx_t_4; goto __pyx_L13_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, 372, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 372, __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, 371, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __pyx_t_4; __pyx_L13_bool_binop_done:; if (likely(__pyx_t_5)) { - /* "pyreadstat/_readstat_writer.pyx":373 + /* "pyreadstat/_readstat_writer.pyx":372 * range_values += 1 * elif type(hi) == str and type(lo) == str: * 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, 373, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 373, __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, 372, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_5)) { - /* "pyreadstat/_readstat_writer.pyx":374 + /* "pyreadstat/_readstat_writer.pyx":373 * elif type(hi) == str and type(lo) == str: * 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, 374, __pyx_L1_error) + __pyx_t_11 = PyObject_Length(__pyx_v_hi); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 373, __pyx_L1_error) __pyx_t_5 = ((__pyx_t_11 > 8) != 0); if (unlikely(__pyx_t_5)) { - /* "pyreadstat/_readstat_writer.pyx":375 + /* "pyreadstat/_readstat_writer.pyx":374 * if hi == lo: * if len(hi) > 8: * msg = "missing_ranges: string values length must not be larger than 8" # <<<<<<<<<<<<<< @@ -6891,14 +6894,14 @@ 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":376 + /* "pyreadstat/_readstat_writer.pyx":375 * 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, 376, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -6912,14 +6915,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 376, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 376, __pyx_L1_error) + __PYX_ERR(0, 375, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":374 + /* "pyreadstat/_readstat_writer.pyx":373 * elif type(hi) == str and type(lo) == str: * if hi == lo: * if len(hi) > 8: # <<<<<<<<<<<<<< @@ -6928,14 +6931,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":377 + /* "pyreadstat/_readstat_writer.pyx":376 * 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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_hi, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 377, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_hi, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 376, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -6949,14 +6952,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_utf_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 377, __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, 377, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 376, __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, 376, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":378 + /* "pyreadstat/_readstat_writer.pyx":377 * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_string_value(variable, hi.encode("utf-8"))) * discrete_strings += 1 # <<<<<<<<<<<<<< @@ -6965,7 +6968,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":373 + /* "pyreadstat/_readstat_writer.pyx":372 * range_values += 1 * elif type(hi) == str and type(lo) == str: * if hi == lo: # <<<<<<<<<<<<<< @@ -6975,7 +6978,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L15; } - /* "pyreadstat/_readstat_writer.pyx":381 + /* "pyreadstat/_readstat_writer.pyx":380 * 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" # <<<<<<<<<<<<<< @@ -6986,14 +6989,14 @@ 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":382 + /* "pyreadstat/_readstat_writer.pyx":381 * #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, 382, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7007,16 +7010,16 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 382, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 382, __pyx_L1_error) + __PYX_ERR(0, 381, __pyx_L1_error) } __pyx_L15:; - /* "pyreadstat/_readstat_writer.pyx":372 + /* "pyreadstat/_readstat_writer.pyx":371 * check_exit_status(readstat_variable_add_missing_double_range(variable, lo, hi)) * range_values += 1 * elif type(hi) == str and type(lo) == str: # <<<<<<<<<<<<<< @@ -7026,7 +7029,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L9; } - /* "pyreadstat/_readstat_writer.pyx":384 + /* "pyreadstat/_readstat_writer.pyx":383 * raise PyreadstatError(msg) * else: * msg = "missing_ranges: hi and lo values must be both either of numeric or string type" # <<<<<<<<<<<<<< @@ -7037,14 +7040,14 @@ 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":385 + /* "pyreadstat/_readstat_writer.pyx":384 * 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, 385, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7058,16 +7061,16 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 385, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 385, __pyx_L1_error) + __PYX_ERR(0, 384, __pyx_L1_error) } __pyx_L9:; - /* "pyreadstat/_readstat_writer.pyx":359 + /* "pyreadstat/_readstat_writer.pyx":358 * * for cur_range in cur_ranges: * if isinstance(cur_range, dict): # <<<<<<<<<<<<<< @@ -7077,7 +7080,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L5; } - /* "pyreadstat/_readstat_writer.pyx":387 + /* "pyreadstat/_readstat_writer.pyx":386 * raise PyreadstatError(msg) * else: * if type(cur_range) in numeric_types: # <<<<<<<<<<<<<< @@ -7087,23 +7090,23 @@ 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, 387, __pyx_L1_error) + __PYX_ERR(0, 386, __pyx_L1_error) } - __pyx_t_5 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_cur_range)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 387, __pyx_L1_error) + __pyx_t_5 = (__Pyx_PySet_ContainsTF(((PyObject *)Py_TYPE(__pyx_v_cur_range)), __pyx_v_10pyreadstat_16_readstat_writer_numeric_types, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 386, __pyx_L1_error) __pyx_t_4 = (__pyx_t_5 != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":388 + /* "pyreadstat/_readstat_writer.pyx":387 * else: * if type(cur_range) in numeric_types: * 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, 388, __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, 388, __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, 387, __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, 387, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":389 + /* "pyreadstat/_readstat_writer.pyx":388 * if type(cur_range) in numeric_types: * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) * discrete_values += 1 # <<<<<<<<<<<<<< @@ -7112,7 +7115,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":387 + /* "pyreadstat/_readstat_writer.pyx":386 * raise PyreadstatError(msg) * else: * if type(cur_range) in numeric_types: # <<<<<<<<<<<<<< @@ -7122,30 +7125,30 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L17; } - /* "pyreadstat/_readstat_writer.pyx":390 + /* "pyreadstat/_readstat_writer.pyx":389 * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) * discrete_values += 1 * elif type(cur_range) == str: # <<<<<<<<<<<<<< * if len(cur_range) > 8: * msg = "missing_ranges: string values length must not be larger than 8" */ - __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, 390, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 390, __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, 389, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":391 + /* "pyreadstat/_readstat_writer.pyx":390 * discrete_values += 1 * elif type(cur_range) == str: * 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, 391, __pyx_L1_error) + __pyx_t_11 = PyObject_Length(__pyx_v_cur_range); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 390, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_11 > 8) != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":392 + /* "pyreadstat/_readstat_writer.pyx":391 * elif type(cur_range) == str: * if len(cur_range) > 8: * msg = "missing_ranges: string values length must not be larger than 8" # <<<<<<<<<<<<<< @@ -7155,14 +7158,14 @@ 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":393 + /* "pyreadstat/_readstat_writer.pyx":392 * 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, 393, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7176,14 +7179,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 393, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 393, __pyx_L1_error) + __PYX_ERR(0, 392, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":391 + /* "pyreadstat/_readstat_writer.pyx":390 * discrete_values += 1 * elif type(cur_range) == str: * if len(cur_range) > 8: # <<<<<<<<<<<<<< @@ -7192,14 +7195,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":394 + /* "pyreadstat/_readstat_writer.pyx":393 * 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_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 394, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cur_range, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { @@ -7213,14 +7216,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_utf_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 394, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 394, __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, 394, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 393, __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, 393, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pyreadstat/_readstat_writer.pyx":395 + /* "pyreadstat/_readstat_writer.pyx":394 * raise PyreadstatError(msg) * check_exit_status(readstat_variable_add_missing_string_value(variable, cur_range.encode("utf-8"))) * discrete_strings += 1 # <<<<<<<<<<<<<< @@ -7229,7 +7232,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":390 + /* "pyreadstat/_readstat_writer.pyx":389 * check_exit_status(readstat_variable_add_missing_double_value(variable, cur_range)) * discrete_values += 1 * elif type(cur_range) == str: # <<<<<<<<<<<<<< @@ -7239,7 +7242,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject goto __pyx_L17; } - /* "pyreadstat/_readstat_writer.pyx":397 + /* "pyreadstat/_readstat_writer.pyx":396 * discrete_strings += 1 * else: * msg = "missing_ranges: values must be both either of numeric or string type" # <<<<<<<<<<<<<< @@ -7250,14 +7253,14 @@ 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":398 + /* "pyreadstat/_readstat_writer.pyx":397 * 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, 398, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7271,18 +7274,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 398, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 398, __pyx_L1_error) + __PYX_ERR(0, 397, __pyx_L1_error) } __pyx_L17:; } __pyx_L5:; - /* "pyreadstat/_readstat_writer.pyx":400 + /* "pyreadstat/_readstat_writer.pyx":399 * raise PyreadstatError(msg) * * if discrete_strings > 3: # <<<<<<<<<<<<<< @@ -7292,7 +7295,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_t_4 = ((__pyx_v_discrete_strings > 3) != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":401 + /* "pyreadstat/_readstat_writer.pyx":400 * * if discrete_strings > 3: * msg = "missing_ranges: max 3 string values per variable allowed" # <<<<<<<<<<<<<< @@ -7302,14 +7305,14 @@ 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":402 + /* "pyreadstat/_readstat_writer.pyx":401 * 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, 402, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7323,14 +7326,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 402, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 402, __pyx_L1_error) + __PYX_ERR(0, 401, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":400 + /* "pyreadstat/_readstat_writer.pyx":399 * raise PyreadstatError(msg) * * if discrete_strings > 3: # <<<<<<<<<<<<<< @@ -7339,7 +7342,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":403 + /* "pyreadstat/_readstat_writer.pyx":402 * msg = "missing_ranges: max 3 string values per variable allowed" * raise PyreadstatError(msg) * if range_values: # <<<<<<<<<<<<<< @@ -7349,7 +7352,7 @@ 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":404 + /* "pyreadstat/_readstat_writer.pyx":403 * raise PyreadstatError(msg) * if range_values: * if range_values > 1: # <<<<<<<<<<<<<< @@ -7359,7 +7362,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_t_4 = ((__pyx_v_range_values > 1) != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":405 + /* "pyreadstat/_readstat_writer.pyx":404 * if range_values: * if range_values > 1: * msg = "missing_ranges: max 1 range value per variable allowed" # <<<<<<<<<<<<<< @@ -7369,14 +7372,14 @@ 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":406 + /* "pyreadstat/_readstat_writer.pyx":405 * 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, 406, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7390,14 +7393,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 406, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 406, __pyx_L1_error) + __PYX_ERR(0, 405, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":404 + /* "pyreadstat/_readstat_writer.pyx":403 * raise PyreadstatError(msg) * if range_values: * if range_values > 1: # <<<<<<<<<<<<<< @@ -7406,7 +7409,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":407 + /* "pyreadstat/_readstat_writer.pyx":406 * msg = "missing_ranges: max 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values > 1: # <<<<<<<<<<<<<< @@ -7416,7 +7419,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_t_4 = ((__pyx_v_discrete_values > 1) != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":408 + /* "pyreadstat/_readstat_writer.pyx":407 * raise PyreadstatError(msg) * if discrete_values > 1: * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" # <<<<<<<<<<<<<< @@ -7426,14 +7429,14 @@ 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":409 + /* "pyreadstat/_readstat_writer.pyx":408 * 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, 409, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7447,14 +7450,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 409, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 409, __pyx_L1_error) + __PYX_ERR(0, 408, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":407 + /* "pyreadstat/_readstat_writer.pyx":406 * msg = "missing_ranges: max 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values > 1: # <<<<<<<<<<<<<< @@ -7463,7 +7466,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":403 + /* "pyreadstat/_readstat_writer.pyx":402 * msg = "missing_ranges: max 3 string values per variable allowed" * raise PyreadstatError(msg) * if range_values: # <<<<<<<<<<<<<< @@ -7472,7 +7475,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":410 + /* "pyreadstat/_readstat_writer.pyx":409 * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values >3: # <<<<<<<<<<<<<< @@ -7482,7 +7485,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __pyx_t_4 = ((__pyx_v_discrete_values > 3) != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":411 + /* "pyreadstat/_readstat_writer.pyx":410 * raise PyreadstatError(msg) * if discrete_values >3: * msg = "missing_ranges: max 3 discrete numeric values per variable allowed" # <<<<<<<<<<<<<< @@ -7492,14 +7495,14 @@ 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":412 + /* "pyreadstat/_readstat_writer.pyx":411 * 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, 412, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7513,14 +7516,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject } __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, 412, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 412, __pyx_L1_error) + __PYX_ERR(0, 411, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":410 + /* "pyreadstat/_readstat_writer.pyx":409 * msg = "missing_ranges: max 1 discrete numeric value if combined with 1 range value per variable allowed" * raise PyreadstatError(msg) * if discrete_values >3: # <<<<<<<<<<<<<< @@ -7529,7 +7532,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject */ } - /* "pyreadstat/_readstat_writer.pyx":358 + /* "pyreadstat/_readstat_writer.pyx":357 * cdef int discrete_strings = 0 * * for cur_range in cur_ranges: # <<<<<<<<<<<<<< @@ -7539,7 +7542,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":348 + /* "pyreadstat/_readstat_writer.pyx":347 * return label_set * * cdef void add_missing_ranges(list cur_ranges, readstat_variable_t *variable) except *: # <<<<<<<<<<<<<< @@ -7563,7 +7566,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(PyObject __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":414 +/* "pyreadstat/_readstat_writer.pyx":413 * raise PyreadstatError(msg) * * cdef void set_variable_alignment(readstat_variable_t *variable, str alignment_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -7585,18 +7588,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_variable_alignment", 0); - /* "pyreadstat/_readstat_writer.pyx":421 + /* "pyreadstat/_readstat_writer.pyx":420 * 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, 421, __pyx_L1_error) + __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, 420, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pyreadstat/_readstat_writer.pyx":422 + /* "pyreadstat/_readstat_writer.pyx":421 * * if alignment_str == "right": * alignment = READSTAT_ALIGNMENT_RIGHT # <<<<<<<<<<<<<< @@ -7605,7 +7608,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_RIGHT; - /* "pyreadstat/_readstat_writer.pyx":421 + /* "pyreadstat/_readstat_writer.pyx":420 * cdef readstat_alignment_t alignment * * if alignment_str == "right": # <<<<<<<<<<<<<< @@ -7615,18 +7618,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":423 + /* "pyreadstat/_readstat_writer.pyx":422 * 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, 423, __pyx_L1_error) + __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, 422, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":424 + /* "pyreadstat/_readstat_writer.pyx":423 * alignment = READSTAT_ALIGNMENT_RIGHT * elif alignment_str == "left": * alignment = READSTAT_ALIGNMENT_LEFT # <<<<<<<<<<<<<< @@ -7635,7 +7638,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_LEFT; - /* "pyreadstat/_readstat_writer.pyx":423 + /* "pyreadstat/_readstat_writer.pyx":422 * if alignment_str == "right": * alignment = READSTAT_ALIGNMENT_RIGHT * elif alignment_str == "left": # <<<<<<<<<<<<<< @@ -7645,18 +7648,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":425 + /* "pyreadstat/_readstat_writer.pyx":424 * 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, 425, __pyx_L1_error) + __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, 424, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pyreadstat/_readstat_writer.pyx":426 + /* "pyreadstat/_readstat_writer.pyx":425 * alignment = READSTAT_ALIGNMENT_LEFT * elif alignment_str == "center": * alignment = READSTAT_ALIGNMENT_CENTER # <<<<<<<<<<<<<< @@ -7665,7 +7668,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_CENTER; - /* "pyreadstat/_readstat_writer.pyx":425 + /* "pyreadstat/_readstat_writer.pyx":424 * elif alignment_str == "left": * alignment = READSTAT_ALIGNMENT_LEFT * elif alignment_str == "center": # <<<<<<<<<<<<<< @@ -7675,18 +7678,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":427 + /* "pyreadstat/_readstat_writer.pyx":426 * 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, 427, __pyx_L1_error) + __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, 426, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (likely(__pyx_t_1)) { - /* "pyreadstat/_readstat_writer.pyx":428 + /* "pyreadstat/_readstat_writer.pyx":427 * alignment = READSTAT_ALIGNMENT_CENTER * elif alignment_str == "unknown": * alignment = READSTAT_ALIGNMENT_UNKNOWN # <<<<<<<<<<<<<< @@ -7695,7 +7698,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads */ __pyx_v_alignment = READSTAT_ALIGNMENT_UNKNOWN; - /* "pyreadstat/_readstat_writer.pyx":427 + /* "pyreadstat/_readstat_writer.pyx":426 * elif alignment_str == "center": * alignment = READSTAT_ALIGNMENT_CENTER * elif alignment_str == "unknown": # <<<<<<<<<<<<<< @@ -7705,7 +7708,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":430 + /* "pyreadstat/_readstat_writer.pyx":429 * 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) # <<<<<<<<<<<<<< @@ -7713,7 +7716,7 @@ 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, 430, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_var_name); __Pyx_GIVEREF(__pyx_v_var_name); @@ -7721,20 +7724,20 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads __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, 430, __pyx_L1_error) + __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, 429, __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; - /* "pyreadstat/_readstat_writer.pyx":431 + /* "pyreadstat/_readstat_writer.pyx":430 * 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, 431, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -7748,16 +7751,16 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads } __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, 431, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 431, __pyx_L1_error) + __PYX_ERR(0, 430, __pyx_L1_error) } __pyx_L3:; - /* "pyreadstat/_readstat_writer.pyx":433 + /* "pyreadstat/_readstat_writer.pyx":432 * raise PyreadstatError(msg) * * readstat_variable_set_alignment(variable, alignment) # <<<<<<<<<<<<<< @@ -7766,7 +7769,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":414 + /* "pyreadstat/_readstat_writer.pyx":413 * raise PyreadstatError(msg) * * cdef void set_variable_alignment(readstat_variable_t *variable, str alignment_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -7786,7 +7789,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_alignment(reads __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":435 +/* "pyreadstat/_readstat_writer.pyx":434 * readstat_variable_set_alignment(variable, alignment) * * cdef void set_variable_display_width(readstat_variable_t *variable, int display_width, str var_name) except *: # <<<<<<<<<<<<<< @@ -7798,7 +7801,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":440 + /* "pyreadstat/_readstat_writer.pyx":439 * """ * * readstat_variable_set_display_width(variable, display_width) # <<<<<<<<<<<<<< @@ -7807,7 +7810,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":435 + /* "pyreadstat/_readstat_writer.pyx":434 * readstat_variable_set_alignment(variable, alignment) * * cdef void set_variable_display_width(readstat_variable_t *variable, int display_width, str var_name) except *: # <<<<<<<<<<<<<< @@ -7819,7 +7822,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(r __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":442 +/* "pyreadstat/_readstat_writer.pyx":441 * readstat_variable_set_display_width(variable, display_width) * * cdef void set_variable_measure(readstat_variable_t *variable, str measure_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -7841,18 +7844,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_variable_measure", 0); - /* "pyreadstat/_readstat_writer.pyx":449 + /* "pyreadstat/_readstat_writer.pyx":448 * 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, 449, __pyx_L1_error) + __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, 448, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pyreadstat/_readstat_writer.pyx":450 + /* "pyreadstat/_readstat_writer.pyx":449 * * if measure_str == "nominal": * measure = READSTAT_MEASURE_NOMINAL # <<<<<<<<<<<<<< @@ -7861,7 +7864,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_NOMINAL; - /* "pyreadstat/_readstat_writer.pyx":449 + /* "pyreadstat/_readstat_writer.pyx":448 * cdef readstat_measure_t measure * * if measure_str == "nominal": # <<<<<<<<<<<<<< @@ -7871,18 +7874,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":451 + /* "pyreadstat/_readstat_writer.pyx":450 * 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, 451, __pyx_L1_error) + __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, 450, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "pyreadstat/_readstat_writer.pyx":452 + /* "pyreadstat/_readstat_writer.pyx":451 * measure = READSTAT_MEASURE_NOMINAL * elif measure_str == "ordinal": * measure = READSTAT_MEASURE_ORDINAL # <<<<<<<<<<<<<< @@ -7891,7 +7894,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_ORDINAL; - /* "pyreadstat/_readstat_writer.pyx":451 + /* "pyreadstat/_readstat_writer.pyx":450 * if measure_str == "nominal": * measure = READSTAT_MEASURE_NOMINAL * elif measure_str == "ordinal": # <<<<<<<<<<<<<< @@ -7901,18 +7904,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":453 + /* "pyreadstat/_readstat_writer.pyx":452 * 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, 453, __pyx_L1_error) + __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, 452, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "pyreadstat/_readstat_writer.pyx":454 + /* "pyreadstat/_readstat_writer.pyx":453 * measure = READSTAT_MEASURE_ORDINAL * elif measure_str == "scale": * measure = READSTAT_MEASURE_SCALE # <<<<<<<<<<<<<< @@ -7921,7 +7924,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_SCALE; - /* "pyreadstat/_readstat_writer.pyx":453 + /* "pyreadstat/_readstat_writer.pyx":452 * elif measure_str == "ordinal": * measure = READSTAT_MEASURE_ORDINAL * elif measure_str == "scale": # <<<<<<<<<<<<<< @@ -7931,18 +7934,18 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":455 + /* "pyreadstat/_readstat_writer.pyx":454 * 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, 455, __pyx_L1_error) + __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, 454, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (likely(__pyx_t_1)) { - /* "pyreadstat/_readstat_writer.pyx":456 + /* "pyreadstat/_readstat_writer.pyx":455 * measure = READSTAT_MEASURE_SCALE * elif measure_str == "unknown": * measure = READSTAT_MEASURE_UNKNOWN # <<<<<<<<<<<<<< @@ -7951,7 +7954,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta */ __pyx_v_measure = READSTAT_MEASURE_UNKNOWN; - /* "pyreadstat/_readstat_writer.pyx":455 + /* "pyreadstat/_readstat_writer.pyx":454 * elif measure_str == "scale": * measure = READSTAT_MEASURE_SCALE * elif measure_str == "unknown": # <<<<<<<<<<<<<< @@ -7961,7 +7964,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":458 + /* "pyreadstat/_readstat_writer.pyx":457 * 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) # <<<<<<<<<<<<<< @@ -7969,7 +7972,7 @@ 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, 458, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_var_name); __Pyx_GIVEREF(__pyx_v_var_name); @@ -7977,20 +7980,20 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta __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, 458, __pyx_L1_error) + __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, 457, __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; - /* "pyreadstat/_readstat_writer.pyx":459 + /* "pyreadstat/_readstat_writer.pyx":458 * 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, 459, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -8004,16 +8007,16 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta } __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, 459, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 459, __pyx_L1_error) + __PYX_ERR(0, 458, __pyx_L1_error) } __pyx_L3:; - /* "pyreadstat/_readstat_writer.pyx":461 + /* "pyreadstat/_readstat_writer.pyx":460 * raise PyreadstatError(msg) * * readstat_variable_set_measure(variable, measure); # <<<<<<<<<<<<<< @@ -8022,7 +8025,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":442 + /* "pyreadstat/_readstat_writer.pyx":441 * readstat_variable_set_display_width(variable, display_width) * * cdef void set_variable_measure(readstat_variable_t *variable, str measure_str, str var_name) except *: # <<<<<<<<<<<<<< @@ -8042,7 +8045,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer_set_variable_measure(readsta __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":464 +/* "pyreadstat/_readstat_writer.pyx":463 * * * cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx): # <<<<<<<<<<<<<< @@ -8056,7 +8059,7 @@ static Py_ssize_t __pyx_f_10pyreadstat_16_readstat_writer_write_bytes(void const __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write_bytes", 0); - /* "pyreadstat/_readstat_writer.pyx":469 + /* "pyreadstat/_readstat_writer.pyx":468 * """ * cdef int fd * fd = (ctx)[0] # <<<<<<<<<<<<<< @@ -8065,7 +8068,7 @@ static Py_ssize_t __pyx_f_10pyreadstat_16_readstat_writer_write_bytes(void const */ __pyx_v_fd = (((int *)__pyx_v_ctx)[0]); - /* "pyreadstat/_readstat_writer.pyx":470 + /* "pyreadstat/_readstat_writer.pyx":469 * cdef int fd * fd = (ctx)[0] * return write(fd, data, _len) # <<<<<<<<<<<<<< @@ -8075,7 +8078,7 @@ static Py_ssize_t __pyx_f_10pyreadstat_16_readstat_writer_write_bytes(void const __pyx_r = write(__pyx_v_fd, __pyx_v_data, __pyx_v__len); goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":464 + /* "pyreadstat/_readstat_writer.pyx":463 * * * cdef ssize_t write_bytes(const void *data, size_t _len, void *ctx): # <<<<<<<<<<<<<< @@ -8089,7 +8092,7 @@ static Py_ssize_t __pyx_f_10pyreadstat_16_readstat_writer_write_bytes(void const return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":472 +/* "pyreadstat/_readstat_writer.pyx":471 * return write(fd, data, _len) * * cdef void _check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< @@ -8110,7 +8113,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_check_exit_status", 0); - /* "pyreadstat/_readstat_writer.pyx":479 + /* "pyreadstat/_readstat_writer.pyx":478 * cdef char * err_readstat * cdef str err_message * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< @@ -8120,7 +8123,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ __pyx_t_1 = ((__pyx_v_retcode != READSTAT_OK) != 0); if (unlikely(__pyx_t_1)) { - /* "pyreadstat/_readstat_writer.pyx":480 + /* "pyreadstat/_readstat_writer.pyx":479 * cdef str err_message * if retcode != READSTAT_OK: * err_readstat = readstat_error_message(retcode) # <<<<<<<<<<<<<< @@ -8129,14 +8132,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":481 + /* "pyreadstat/_readstat_writer.pyx":480 * 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, 481, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyStr_FromString(__pyx_v_err_readstat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); @@ -8144,14 +8147,14 @@ 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":482 + /* "pyreadstat/_readstat_writer.pyx":481 * err_readstat = readstat_error_message(retcode) * err_message = err_readstat * raise ReadstatError(err_message) # <<<<<<<<<<<<<< * * cdef int open_file(str filename_path): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ReadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ReadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -8165,14 +8168,14 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ } __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, 482, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __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, 482, __pyx_L1_error) + __PYX_ERR(0, 481, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":479 + /* "pyreadstat/_readstat_writer.pyx":478 * cdef char * err_readstat * cdef str err_message * if retcode != READSTAT_OK: # <<<<<<<<<<<<<< @@ -8181,7 +8184,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ */ } - /* "pyreadstat/_readstat_writer.pyx":472 + /* "pyreadstat/_readstat_writer.pyx":471 * return write(fd, data, _len) * * cdef void _check_exit_status(readstat_error_t retcode) except *: # <<<<<<<<<<<<<< @@ -8201,7 +8204,7 @@ static void __pyx_f_10pyreadstat_16_readstat_writer__check_exit_status(readstat_ __Pyx_RefNannyFinishContext(); } -/* "pyreadstat/_readstat_writer.pyx":484 +/* "pyreadstat/_readstat_writer.pyx":483 * raise ReadstatError(err_message) * * cdef int open_file(str filename_path): # <<<<<<<<<<<<<< @@ -8227,23 +8230,23 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f int __pyx_clineno = 0; __Pyx_RefNannySetupContext("open_file", 0); - /* "pyreadstat/_readstat_writer.pyx":495 + /* "pyreadstat/_readstat_writer.pyx":494 * IF PY_MAJOR_VERSION >2: * * if os.name == "nt": # <<<<<<<<<<<<<< * u16_path = PyUnicode_AsWideCharString(filename_path, &length) * flags = _O_WRONLY | _O_CREAT | _O_BINARY */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __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, 495, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __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, 495, __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, 494, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":496 + /* "pyreadstat/_readstat_writer.pyx":495 * * if os.name == "nt": * u16_path = PyUnicode_AsWideCharString(filename_path, &length) # <<<<<<<<<<<<<< @@ -8252,7 +8255,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f */ __pyx_v_u16_path = PyUnicode_AsWideCharString(__pyx_v_filename_path, (&__pyx_v_length)); - /* "pyreadstat/_readstat_writer.pyx":497 + /* "pyreadstat/_readstat_writer.pyx":496 * if os.name == "nt": * u16_path = PyUnicode_AsWideCharString(filename_path, &length) * flags = _O_WRONLY | _O_CREAT | _O_BINARY # <<<<<<<<<<<<<< @@ -8261,7 +8264,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f */ __pyx_v_flags = ((_O_WRONLY | _O_CREAT) | _O_BINARY); - /* "pyreadstat/_readstat_writer.pyx":498 + /* "pyreadstat/_readstat_writer.pyx":497 * u16_path = PyUnicode_AsWideCharString(filename_path, &length) * flags = _O_WRONLY | _O_CREAT | _O_BINARY * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) # <<<<<<<<<<<<<< @@ -8270,7 +8273,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f */ __pyx_v_fd = _wsopen(__pyx_v_u16_path, __pyx_v_flags, _SH_DENYRW, (_S_IREAD | _S_IWRITE)); - /* "pyreadstat/_readstat_writer.pyx":495 + /* "pyreadstat/_readstat_writer.pyx":494 * IF PY_MAJOR_VERSION >2: * * if os.name == "nt": # <<<<<<<<<<<<<< @@ -8280,7 +8283,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f goto __pyx_L3; } - /* "pyreadstat/_readstat_writer.pyx":500 + /* "pyreadstat/_readstat_writer.pyx":499 * fd = _wsopen(u16_path, flags, _SH_DENYRW, _S_IREAD | _S_IWRITE) * else: * filename_bytes = filename_path.encode("utf-8") # <<<<<<<<<<<<<< @@ -8288,13 +8291,13 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f * flags = O_WRONLY | O_CREAT | O_TRUNC */ /*else*/ { - __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_filename_path, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_filename_path, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - 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, 500, __pyx_L1_error) + 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, 499, __pyx_L1_error) __pyx_v_filename_bytes = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":501 + /* "pyreadstat/_readstat_writer.pyx":500 * else: * filename_bytes = filename_path.encode("utf-8") * path = filename_bytes # <<<<<<<<<<<<<< @@ -8303,12 +8306,12 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f */ if (unlikely(__pyx_v_filename_bytes == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(0, 501, __pyx_L1_error) + __PYX_ERR(0, 500, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename_bytes); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename_bytes); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 500, __pyx_L1_error) __pyx_v_path = ((char *)__pyx_t_4); - /* "pyreadstat/_readstat_writer.pyx":502 + /* "pyreadstat/_readstat_writer.pyx":501 * filename_bytes = filename_path.encode("utf-8") * path = filename_bytes * flags = O_WRONLY | O_CREAT | O_TRUNC # <<<<<<<<<<<<<< @@ -8317,7 +8320,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f */ __pyx_v_flags = ((O_WRONLY | O_CREAT) | O_TRUNC); - /* "pyreadstat/_readstat_writer.pyx":503 + /* "pyreadstat/_readstat_writer.pyx":502 * path = filename_bytes * flags = O_WRONLY | O_CREAT | O_TRUNC * fd = open(path, flags, 0644) # <<<<<<<<<<<<<< @@ -8328,7 +8331,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f } __pyx_L3:; - /* "pyreadstat/_readstat_writer.pyx":514 + /* "pyreadstat/_readstat_writer.pyx":513 * fd = open(path, flags, 0644) * * return fd # <<<<<<<<<<<<<< @@ -8338,7 +8341,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":484 + /* "pyreadstat/_readstat_writer.pyx":483 * raise ReadstatError(err_message) * * cdef int open_file(str filename_path): # <<<<<<<<<<<<<< @@ -8358,7 +8361,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_open_file(PyObject *__pyx_v_f return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":516 +/* "pyreadstat/_readstat_writer.pyx":515 * return fd * * cdef int close_file(int fd): # <<<<<<<<<<<<<< @@ -8377,23 +8380,23 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_close_file(int __pyx_v_fd) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("close_file", 0); - /* "pyreadstat/_readstat_writer.pyx":517 + /* "pyreadstat/_readstat_writer.pyx":516 * * 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, 517, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __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, 517, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __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, 517, __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, 516, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":518 + /* "pyreadstat/_readstat_writer.pyx":517 * cdef int close_file(int fd): * if os.name == "nt": * return _close(fd) # <<<<<<<<<<<<<< @@ -8403,7 +8406,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_close_file(int __pyx_v_fd) { __pyx_r = _close(__pyx_v_fd); goto __pyx_L0; - /* "pyreadstat/_readstat_writer.pyx":517 + /* "pyreadstat/_readstat_writer.pyx":516 * * cdef int close_file(int fd): * if os.name == "nt": # <<<<<<<<<<<<<< @@ -8412,7 +8415,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_close_file(int __pyx_v_fd) { */ } - /* "pyreadstat/_readstat_writer.pyx":520 + /* "pyreadstat/_readstat_writer.pyx":519 * return _close(fd) * else: * return close(fd) # <<<<<<<<<<<<<< @@ -8424,7 +8427,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_close_file(int __pyx_v_fd) { goto __pyx_L0; } - /* "pyreadstat/_readstat_writer.pyx":516 + /* "pyreadstat/_readstat_writer.pyx":515 * return fd * * cdef int close_file(int fd): # <<<<<<<<<<<<<< @@ -8443,7 +8446,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_close_file(int __pyx_v_fd) { return __pyx_r; } -/* "pyreadstat/_readstat_writer.pyx":522 +/* "pyreadstat/_readstat_writer.pyx":521 * return close(fd) * * cdef int run_write(df, str filename_path, dst_file_format file_format, str file_label, list column_labels, # <<<<<<<<<<<<<< @@ -8542,31 +8545,31 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_RefNannySetupContext("run_write", 0); __Pyx_INCREF(__pyx_v_filename_path); - /* "pyreadstat/_readstat_writer.pyx":536 + /* "pyreadstat/_readstat_writer.pyx":535 * 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") * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __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, 536, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_DataFrame); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __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, 536, __pyx_L1_error) + __pyx_t_3 = PyObject_IsInstance(__pyx_v_df, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":537 + /* "pyreadstat/_readstat_writer.pyx":536 * * 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, 537, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -8580,14 +8583,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __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, 537, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __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, 537, __pyx_L1_error) + __PYX_ERR(0, 536, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":536 + /* "pyreadstat/_readstat_writer.pyx":535 * raise PyreadstatError("Writing API not supported on python 2 on windows") * * if not isinstance(df, pd.DataFrame): # <<<<<<<<<<<<<< @@ -8596,17 +8599,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":539 + /* "pyreadstat/_readstat_writer.pyx":538 * 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, 539, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_value_labels); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 538, __pyx_L1_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":540 + /* "pyreadstat/_readstat_writer.pyx":539 * * if variable_value_labels: * for k,v in variable_value_labels.items(): # <<<<<<<<<<<<<< @@ -8615,17 +8618,17 @@ 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, 540, __pyx_L1_error) + __PYX_ERR(0, 539, __pyx_L1_error) } - __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_variable_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_variable_value_labels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __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; } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __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, 540, __pyx_L1_error) + __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 539, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -8633,17 +8636,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_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, 540, __pyx_L1_error) + __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, 539, __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, 540, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_6 >= 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, 540, __pyx_L1_error) + __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, 539, __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, 540, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -8653,7 +8656,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 540, __pyx_L1_error) + else __PYX_ERR(0, 539, __pyx_L1_error) } break; } @@ -8665,7 +8668,7 @@ 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, 540, __pyx_L1_error) + __PYX_ERR(0, 539, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -8678,15 +8681,15 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_8); #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 539, __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, 540, __pyx_L1_error) + __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 539, __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; @@ -8694,7 +8697,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __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, 540, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 539, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L8_unpacking_done; @@ -8702,7 +8705,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 540, __pyx_L1_error) + __PYX_ERR(0, 539, __pyx_L1_error) __pyx_L8_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5); @@ -8710,28 +8713,28 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8); __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":541 + /* "pyreadstat/_readstat_writer.pyx":540 * 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, 541, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 541, __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, 540, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":542 + /* "pyreadstat/_readstat_writer.pyx":541 * 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, 542, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_v))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 542, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); @@ -8739,20 +8742,20 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 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, 542, __pyx_L1_error) + __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, 541, __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":543 + /* "pyreadstat/_readstat_writer.pyx":542 * 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, 543, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { @@ -8766,14 +8769,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __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, 543, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __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, 543, __pyx_L1_error) + __PYX_ERR(0, 542, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":541 + /* "pyreadstat/_readstat_writer.pyx":540 * if variable_value_labels: * for k,v in variable_value_labels.items(): * if type(v) != dict: # <<<<<<<<<<<<<< @@ -8782,7 +8785,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":540 + /* "pyreadstat/_readstat_writer.pyx":539 * * if variable_value_labels: * for k,v in variable_value_labels.items(): # <<<<<<<<<<<<<< @@ -8792,7 +8795,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":539 + /* "pyreadstat/_readstat_writer.pyx":538 * raise PyreadstatError("first argument must be a pandas data frame") * * if variable_value_labels: # <<<<<<<<<<<<<< @@ -8801,17 +8804,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":545 + /* "pyreadstat/_readstat_writer.pyx":544 * 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, 545, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":546 + /* "pyreadstat/_readstat_writer.pyx":545 * * if missing_user_values: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -8821,7 +8824,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":547 + /* "pyreadstat/_readstat_writer.pyx":546 * if missing_user_values: * if file_format == FILE_FORMAT_DTA: * valid_user_missing = valid_user_missing_stata # <<<<<<<<<<<<<< @@ -8831,7 +8834,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":546 + /* "pyreadstat/_readstat_writer.pyx":545 * * if missing_user_values: * if file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -8841,7 +8844,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":548 + /* "pyreadstat/_readstat_writer.pyx":547 * 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: # <<<<<<<<<<<<<< @@ -8850,7 +8853,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":549 + /* "pyreadstat/_readstat_writer.pyx":548 * 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 # <<<<<<<<<<<<<< @@ -8860,7 +8863,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":548 + /* "pyreadstat/_readstat_writer.pyx":547 * 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: # <<<<<<<<<<<<<< @@ -8871,7 +8874,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d default: break; } - /* "pyreadstat/_readstat_writer.pyx":550 + /* "pyreadstat/_readstat_writer.pyx":549 * 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(): # <<<<<<<<<<<<<< @@ -8880,17 +8883,17 @@ 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, 550, __pyx_L1_error) + __PYX_ERR(0, 549, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_missing_user_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_missing_user_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __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; } else { - __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __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, 550, __pyx_L1_error) + __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 549, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -8898,17 +8901,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d 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_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, 550, __pyx_L1_error) + __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, 549, __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, 550, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_6 >= 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, 550, __pyx_L1_error) + __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, 549, __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, 550, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -8918,7 +8921,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 550, __pyx_L1_error) + else __PYX_ERR(0, 549, __pyx_L1_error) } break; } @@ -8930,7 +8933,7 @@ 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, 550, __pyx_L1_error) + __PYX_ERR(0, 549, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -8943,15 +8946,15 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_5); #else - __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 550, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 549, __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, 550, __pyx_L1_error) + __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; @@ -8959,7 +8962,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __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_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 550, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 549, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L14_unpacking_done; @@ -8967,7 +8970,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 550, __pyx_L1_error) + __PYX_ERR(0, 549, __pyx_L1_error) __pyx_L14_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_8); @@ -8975,7 +8978,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XDECREF_SET(__pyx_v_missing_values, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":551 + /* "pyreadstat/_readstat_writer.pyx":550 * valid_user_missing = valid_user_missing_sas * for key, missing_values in missing_user_values.items(): * if not isinstance(missing_values, list): # <<<<<<<<<<<<<< @@ -8986,7 +8989,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0); if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":552 + /* "pyreadstat/_readstat_writer.pyx":551 * 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" # <<<<<<<<<<<<<< @@ -8996,14 +8999,14 @@ 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":553 + /* "pyreadstat/_readstat_writer.pyx":552 * 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, 553, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -9017,14 +9020,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __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, 553, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __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, 553, __pyx_L1_error) + __PYX_ERR(0, 552, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":551 + /* "pyreadstat/_readstat_writer.pyx":550 * valid_user_missing = valid_user_missing_sas * for key, missing_values in missing_user_values.items(): * if not isinstance(missing_values, list): # <<<<<<<<<<<<<< @@ -9033,7 +9036,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":554 + /* "pyreadstat/_readstat_writer.pyx":553 * msg = "missing_user_values: values in dictionary must be list" * raise PyreadstatError(msg) * for val in missing_values: # <<<<<<<<<<<<<< @@ -9044,26 +9047,26 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_1 = __pyx_v_missing_values; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error) + __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_missing_values); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __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, 554, __pyx_L1_error) + __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 553, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_12)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_11 >= 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, 554, __pyx_L1_error) + __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, 553, __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, 554, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_11 >= 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, 554, __pyx_L1_error) + __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, 553, __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, 554, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -9073,7 +9076,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 554, __pyx_L1_error) + else __PYX_ERR(0, 553, __pyx_L1_error) } break; } @@ -9082,41 +9085,41 @@ 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":555 + /* "pyreadstat/_readstat_writer.pyx":554 * 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, 555, __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, 555, __pyx_L1_error) + if (unlikely(!__pyx_v_valid_user_missing)) { __Pyx_RaiseUnboundLocalError("valid_user_missing"); __PYX_ERR(0, 554, __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, 554, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":556 + /* "pyreadstat/_readstat_writer.pyx":555 * 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, 556, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_val); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __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, 556, __pyx_L1_error) + __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, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_msg = __pyx_t_8; __pyx_t_8 = 0; - /* "pyreadstat/_readstat_writer.pyx":557 + /* "pyreadstat/_readstat_writer.pyx":556 * 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, 557, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -9130,14 +9133,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __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, 557, __pyx_L1_error) + if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 556, __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, 557, __pyx_L1_error) + __PYX_ERR(0, 556, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":555 + /* "pyreadstat/_readstat_writer.pyx":554 * raise PyreadstatError(msg) * for val in missing_values: * if val not in valid_user_missing: # <<<<<<<<<<<<<< @@ -9146,7 +9149,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":554 + /* "pyreadstat/_readstat_writer.pyx":553 * msg = "missing_user_values: values in dictionary must be list" * raise PyreadstatError(msg) * for val in missing_values: # <<<<<<<<<<<<<< @@ -9156,7 +9159,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":550 + /* "pyreadstat/_readstat_writer.pyx":549 * 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(): # <<<<<<<<<<<<<< @@ -9166,7 +9169,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":545 + /* "pyreadstat/_readstat_writer.pyx":544 * raise PyreadstatError(msg) * * if missing_user_values: # <<<<<<<<<<<<<< @@ -9175,19 +9178,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":568 + /* "pyreadstat/_readstat_writer.pyx":567 * cdef char *file_labl * * cdef list col_names = df.columns.values.tolist() # <<<<<<<<<<<<<< * * for variable_name in col_names: */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_columns); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __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, 568, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __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, 568, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_tolist); 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; __pyx_t_8 = NULL; @@ -9202,14 +9205,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __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, 568, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __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, 568, __pyx_L1_error) + 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, 567, __pyx_L1_error) __pyx_v_col_names = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":570 + /* "pyreadstat/_readstat_writer.pyx":569 * cdef list col_names = df.columns.values.tolist() * * for variable_name in col_names: # <<<<<<<<<<<<<< @@ -9218,44 +9221,44 @@ 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, 570, __pyx_L1_error) + __PYX_ERR(0, 569, __pyx_L1_error) } __pyx_t_2 = __pyx_v_col_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0; for (;;) { if (__pyx_t_6 >= 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, 570, __pyx_L1_error) + __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, 569, __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, 570, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __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":571 + /* "pyreadstat/_readstat_writer.pyx":570 * * 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, 571, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 571, __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, 570, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 570, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":572 + /* "pyreadstat/_readstat_writer.pyx":571 * 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, 572, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 571, __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, 572, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)Py_TYPE(__pyx_v_variable_name))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 572, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_variable_name); __Pyx_GIVEREF(__pyx_v_variable_name); @@ -9263,7 +9266,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 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, 572, __pyx_L1_error) + __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, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; @@ -9279,14 +9282,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __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, 572, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 572, __pyx_L1_error) + __PYX_ERR(0, 571, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":571 + /* "pyreadstat/_readstat_writer.pyx":570 * * for variable_name in col_names: * if type(variable_name) != str: # <<<<<<<<<<<<<< @@ -9295,16 +9298,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":573 + /* "pyreadstat/_readstat_writer.pyx":572 * 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, 573, __pyx_L1_error) + __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, 572, __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, 573, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_isalpha); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; @@ -9319,32 +9322,32 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __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, 573, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __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, 573, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 572, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_4) != 0); if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":574 + /* "pyreadstat/_readstat_writer.pyx":573 * 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, 574, __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 = __Pyx_GetItemInt(__pyx_v_variable_name, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 574, __pyx_L1_error) + __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, 573, __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, 574, __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, 573, __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, 574, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_Ord(__pyx_t_9); if (unlikely(__pyx_t_13 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 573, __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, 574, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 574, __pyx_L1_error) + __pyx_t_14 = PyTuple_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(__pyx_v_variable_name); __Pyx_GIVEREF(__pyx_v_variable_name); @@ -9355,7 +9358,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_9); __pyx_t_8 = 0; __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, 574, __pyx_L1_error) + __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, 573, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = NULL; @@ -9371,14 +9374,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __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, 574, __pyx_L1_error) + 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, 574, __pyx_L1_error) + __PYX_ERR(0, 573, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":573 + /* "pyreadstat/_readstat_writer.pyx":572 * 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(): # <<<<<<<<<<<<<< @@ -9387,27 +9390,27 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":575 + /* "pyreadstat/_readstat_writer.pyx":574 * 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, 575, __pyx_L1_error) + __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, 574, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":576 + /* "pyreadstat/_readstat_writer.pyx":575 * 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, 576, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 575, __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, 576, __pyx_L1_error) + __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, 575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -9422,14 +9425,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __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, 576, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __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, 576, __pyx_L1_error) + __PYX_ERR(0, 575, __pyx_L1_error) - /* "pyreadstat/_readstat_writer.pyx":575 + /* "pyreadstat/_readstat_writer.pyx":574 * 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: # <<<<<<<<<<<<<< @@ -9438,7 +9441,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":570 + /* "pyreadstat/_readstat_writer.pyx":569 * cdef list col_names = df.columns.values.tolist() * * for variable_name in col_names: # <<<<<<<<<<<<<< @@ -9448,7 +9451,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":578 + /* "pyreadstat/_readstat_writer.pyx":577 * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) * * if file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -9458,31 +9461,31 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_4 = ((__pyx_v_file_format == __pyx_e_10pyreadstat_16_readstat_writer_FILE_FORMAT_POR) != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":579 + /* "pyreadstat/_readstat_writer.pyx":578 * * 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) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __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, 579, __pyx_L1_error) + __PYX_ERR(0, 578, __pyx_L1_error) } __pyx_t_1 = __pyx_v_col_names; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; for (;;) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 578, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __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, 579, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_upper); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { @@ -9496,17 +9499,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __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, 579, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __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, 579, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 578, __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":578 + /* "pyreadstat/_readstat_writer.pyx":577 * raise PyreadstatError("variable name '%s' contains a space, which is not allowed" % variable_name) * * if file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -9515,29 +9518,29 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":581 + /* "pyreadstat/_readstat_writer.pyx":580 * col_names = [x.upper() for x in col_names] * * cdef list col_types = get_pandas_column_types(df, missing_user_values) # <<<<<<<<<<<<<< * 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); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) + __pyx_t_2 = __pyx_f_10pyreadstat_16_readstat_writer_get_pandas_column_types(__pyx_v_df, __pyx_v_missing_user_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_col_types = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":582 + /* "pyreadstat/_readstat_writer.pyx":581 * * cdef list col_types = get_pandas_column_types(df, missing_user_values) * 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_6 = PyObject_Length(__pyx_v_df); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 582, __pyx_L1_error) + __pyx_t_6 = PyObject_Length(__pyx_v_df); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 581, __pyx_L1_error) __pyx_v_row_count = __pyx_t_6; - /* "pyreadstat/_readstat_writer.pyx":583 + /* "pyreadstat/_readstat_writer.pyx":582 * cdef list col_types = get_pandas_column_types(df, missing_user_values) * cdef int row_count = len(df) * cdef int col_count = len(col_names) # <<<<<<<<<<<<<< @@ -9546,12 +9549,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, 583, __pyx_L1_error) + __PYX_ERR(0, 582, __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, 583, __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, 582, __pyx_L1_error) __pyx_v_col_count = __pyx_t_6; - /* "pyreadstat/_readstat_writer.pyx":584 + /* "pyreadstat/_readstat_writer.pyx":583 * 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)} # <<<<<<<<<<<<<< @@ -9559,9 +9562,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, 584, __pyx_L29_error) + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_col_names); __Pyx_GIVEREF(__pyx_v_col_names); @@ -9569,16 +9572,16 @@ 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, 584, __pyx_L29_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 583, __pyx_L29_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_6 = 0; __pyx_t_7 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 583, __pyx_L29_error) } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { @@ -9586,17 +9589,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 583, __pyx_L29_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 583, __pyx_L29_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -9606,7 +9609,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 584, __pyx_L29_error) + else __PYX_ERR(0, 583, __pyx_L29_error) } break; } @@ -9618,7 +9621,7 @@ 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, 584, __pyx_L29_error) + __PYX_ERR(0, 583, __pyx_L29_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -9631,15 +9634,15 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_14); #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 584, __pyx_L29_error) + __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_GOTREF(__pyx_t_14); #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, 584, __pyx_L29_error) + __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 583, __pyx_L29_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; @@ -9647,7 +9650,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_14 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_14)) goto __pyx_L32_unpacking_failed; __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 584, __pyx_L29_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 583, __pyx_L29_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L33_unpacking_done; @@ -9655,16 +9658,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 584, __pyx_L29_error) + __PYX_ERR(0, 583, __pyx_L29_error) __pyx_L33_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, 584, __pyx_L29_error) + __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, 583, __pyx_L29_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, 584, __pyx_L29_error) + if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 583, __pyx_L29_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9680,7 +9683,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_v_col_names_to_types = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":592 + /* "pyreadstat/_readstat_writer.pyx":591 * cdef int col_indx * cdef bytes cur_col_label * cdef int col_label_count = 0 # <<<<<<<<<<<<<< @@ -9689,7 +9692,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":601 + /* "pyreadstat/_readstat_writer.pyx":600 * cdef object values * cdef dict value_labels * cdef int lblset_cnt = 0 # <<<<<<<<<<<<<< @@ -9698,19 +9701,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_lblset_cnt = 0; - /* "pyreadstat/_readstat_writer.pyx":604 + /* "pyreadstat/_readstat_writer.pyx":603 * cdef readstat_label_set_t *label_set * * filename_path = os.path.expanduser(filename_path) # <<<<<<<<<<<<<< * cdef int fd = open_file(filename_path) * writer = readstat_writer_init() */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 604, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; @@ -9725,14 +9728,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_filename_path) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_filename_path); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - 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, 604, __pyx_L1_error) + 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, 603, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_filename_path, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":605 + /* "pyreadstat/_readstat_writer.pyx":604 * * filename_path = os.path.expanduser(filename_path) * cdef int fd = open_file(filename_path) # <<<<<<<<<<<<<< @@ -9741,7 +9744,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_fd = __pyx_f_10pyreadstat_16_readstat_writer_open_file(__pyx_v_filename_path); - /* "pyreadstat/_readstat_writer.pyx":606 + /* "pyreadstat/_readstat_writer.pyx":605 * filename_path = os.path.expanduser(filename_path) * cdef int fd = open_file(filename_path) * writer = readstat_writer_init() # <<<<<<<<<<<<<< @@ -9750,7 +9753,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":608 + /* "pyreadstat/_readstat_writer.pyx":607 * writer = readstat_writer_init() * * try: # <<<<<<<<<<<<<< @@ -9767,39 +9770,39 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XGOTREF(__pyx_t_17); /*try:*/ { - /* "pyreadstat/_readstat_writer.pyx":610 + /* "pyreadstat/_readstat_writer.pyx":609 * 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, 610, __pyx_L38_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, 609, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":612 + /* "pyreadstat/_readstat_writer.pyx":611 * 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_file_label); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 612, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_file_label); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 611, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":613 + /* "pyreadstat/_readstat_writer.pyx":612 * * 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_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_file_label, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L38_error) + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_file_label, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); - 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, 613, __pyx_L38_error) + 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, 612, __pyx_L38_error) __pyx_v_file_label_bytes = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":614 + /* "pyreadstat/_readstat_writer.pyx":613 * if file_label: * file_label_bytes = file_label.encode("utf-8") * file_labl = file_label_bytes # <<<<<<<<<<<<<< @@ -9808,21 +9811,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, 614, __pyx_L38_error) + __PYX_ERR(0, 613, __pyx_L38_error) } - __pyx_t_18 = __Pyx_PyBytes_AsWritableString(__pyx_v_file_label_bytes); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 614, __pyx_L38_error) + __pyx_t_18 = __Pyx_PyBytes_AsWritableString(__pyx_v_file_label_bytes); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 613, __pyx_L38_error) __pyx_v_file_labl = ((char *)__pyx_t_18); - /* "pyreadstat/_readstat_writer.pyx":615 + /* "pyreadstat/_readstat_writer.pyx":614 * 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, 615, __pyx_L38_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, 614, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":612 + /* "pyreadstat/_readstat_writer.pyx":611 * check_exit_status(readstat_set_data_writer(writer, write_bytes)) * * if file_label: # <<<<<<<<<<<<<< @@ -9831,30 +9834,30 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":617 + /* "pyreadstat/_readstat_writer.pyx":616 * check_exit_status(readstat_writer_set_file_label(writer, file_labl)) * * if note: # <<<<<<<<<<<<<< * readstat_add_note(writer, note.encode("utf-8")) * */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_note); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 617, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_note); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 616, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":618 + /* "pyreadstat/_readstat_writer.pyx":617 * * if note: * readstat_add_note(writer, note.encode("utf-8")) # <<<<<<<<<<<<<< * * if file_format_version > -1: */ - __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_note, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L38_error) + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_note, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 618, __pyx_L38_error) + __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L38_error) readstat_add_note(__pyx_v_writer, __pyx_t_19); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":617 + /* "pyreadstat/_readstat_writer.pyx":616 * check_exit_status(readstat_writer_set_file_label(writer, file_labl)) * * if note: # <<<<<<<<<<<<<< @@ -9863,7 +9866,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":620 + /* "pyreadstat/_readstat_writer.pyx":619 * readstat_add_note(writer, note.encode("utf-8")) * * if file_format_version > -1: # <<<<<<<<<<<<<< @@ -9873,16 +9876,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_4 = ((__pyx_v_file_format_version > -1L) != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":621 + /* "pyreadstat/_readstat_writer.pyx":620 * * if file_format_version > -1: * check_exit_status(readstat_writer_set_file_format_version(writer, file_format_version)) # <<<<<<<<<<<<<< * * # table name is used only for xpt files */ - __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, 621, __pyx_L38_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, 620, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":620 + /* "pyreadstat/_readstat_writer.pyx":619 * readstat_add_note(writer, note.encode("utf-8")) * * if file_format_version > -1: # <<<<<<<<<<<<<< @@ -9891,48 +9894,48 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":624 + /* "pyreadstat/_readstat_writer.pyx":623 * * # 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_table_name); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 624, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_table_name); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 623, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":625 + /* "pyreadstat/_readstat_writer.pyx":624 * # 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_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_table_name, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L38_error) + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_table_name, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_table_name_bytes = __pyx_t_2; __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":626 + /* "pyreadstat/_readstat_writer.pyx":625 * 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_18 = __Pyx_PyObject_AsWritableString(__pyx_v_table_name_bytes); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 626, __pyx_L38_error) + __pyx_t_18 = __Pyx_PyObject_AsWritableString(__pyx_v_table_name_bytes); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 625, __pyx_L38_error) __pyx_v_tab_name = ((char *)__pyx_t_18); - /* "pyreadstat/_readstat_writer.pyx":627 + /* "pyreadstat/_readstat_writer.pyx":626 * 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, 627, __pyx_L38_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, 626, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":624 + /* "pyreadstat/_readstat_writer.pyx":623 * * # table name is used only for xpt files * if table_name: # <<<<<<<<<<<<<< @@ -9941,7 +9944,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":630 + /* "pyreadstat/_readstat_writer.pyx":629 * * # add variables * if column_labels: # <<<<<<<<<<<<<< @@ -9951,7 +9954,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_4 = (__pyx_v_column_labels != Py_None)&&(PyList_GET_SIZE(__pyx_v_column_labels) != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":631 + /* "pyreadstat/_readstat_writer.pyx":630 * # add variables * if column_labels: * col_label_count = len(column_labels) # <<<<<<<<<<<<<< @@ -9960,12 +9963,12 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_column_labels == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 631, __pyx_L38_error) + __PYX_ERR(0, 630, __pyx_L38_error) } - __pyx_t_6 = PyList_GET_SIZE(__pyx_v_column_labels); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 631, __pyx_L38_error) + __pyx_t_6 = PyList_GET_SIZE(__pyx_v_column_labels); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 630, __pyx_L38_error) __pyx_v_col_label_count = __pyx_t_6; - /* "pyreadstat/_readstat_writer.pyx":632 + /* "pyreadstat/_readstat_writer.pyx":631 * if column_labels: * col_label_count = len(column_labels) * if col_label_count != col_count: # <<<<<<<<<<<<<< @@ -9975,14 +9978,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_4 = ((__pyx_v_col_label_count != __pyx_v_col_count) != 0); if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":633 + /* "pyreadstat/_readstat_writer.pyx":632 * 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_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L38_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 632, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -9996,14 +9999,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_kp_s_length_of_column_labels_must_be) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_length_of_column_labels_must_be); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L38_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 632, __pyx_L38_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, 633, __pyx_L38_error) + __PYX_ERR(0, 632, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":632 + /* "pyreadstat/_readstat_writer.pyx":631 * if column_labels: * col_label_count = len(column_labels) * if col_label_count != col_count: # <<<<<<<<<<<<<< @@ -10012,7 +10015,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":630 + /* "pyreadstat/_readstat_writer.pyx":629 * * # add variables * if column_labels: # <<<<<<<<<<<<<< @@ -10021,7 +10024,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":635 + /* "pyreadstat/_readstat_writer.pyx":634 * raise PyreadstatError("length of column labels must be the same as number of columns") * * for col_indx in range(col_count): # <<<<<<<<<<<<<< @@ -10033,7 +10036,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_col_indx = __pyx_t_22; - /* "pyreadstat/_readstat_writer.pyx":636 + /* "pyreadstat/_readstat_writer.pyx":635 * * for col_indx in range(col_count): * curtype, max_length, _ = col_types[col_indx] # <<<<<<<<<<<<<< @@ -10042,9 +10045,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, 636, __pyx_L38_error) + __PYX_ERR(0, 635, __pyx_L38_error) } - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 636, __pyx_L38_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; @@ -10052,7 +10055,7 @@ 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, 636, __pyx_L38_error) + __PYX_ERR(0, 635, __pyx_L38_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -10068,17 +10071,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_14); #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L38_error) + __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 636, __pyx_L38_error) + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 636, __pyx_L38_error) + __pyx_t_14 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 635, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); #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, 636, __pyx_L38_error) + __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 635, __pyx_L38_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; @@ -10088,7 +10091,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_GOTREF(__pyx_t_5); index = 2; __pyx_t_14 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_14)) goto __pyx_L52_unpacking_failed; __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) __PYX_ERR(0, 636, __pyx_L38_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) __PYX_ERR(0, 635, __pyx_L38_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L53_unpacking_done; @@ -10096,19 +10099,19 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 636, __pyx_L38_error) + __PYX_ERR(0, 635, __pyx_L38_error) __pyx_L53_unpacking_done:; } - __pyx_t_23 = ((__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, 636, __pyx_L38_error) + __pyx_t_23 = ((__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, 635, __pyx_L38_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_24 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 636, __pyx_L38_error) + __pyx_t_24 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 635, __pyx_L38_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_curtype = __pyx_t_23; __pyx_v_max_length = __pyx_t_24; __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":639 + /* "pyreadstat/_readstat_writer.pyx":638 * #if file_format == FILE_FORMAT_XPORT and curtype == PYWRITER_DOUBLE: * # max_length = 8 * variable_name = col_names[col_indx] # <<<<<<<<<<<<<< @@ -10117,21 +10120,21 @@ 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, 639, __pyx_L38_error) + __PYX_ERR(0, 638, __pyx_L38_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, 639, __pyx_L38_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, 638, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_variable_name, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":640 + /* "pyreadstat/_readstat_writer.pyx":639 * # max_length = 8 * variable_name = col_names[col_indx] * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) # <<<<<<<<<<<<<< * if curtype in pyrwriter_datetimelike_types: * curformat = get_datetimelike_format_for_readstat(file_format, curtype) */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_variable_name, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 640, __pyx_L38_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_variable_name, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 639, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { @@ -10145,43 +10148,43 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_s_utf_8); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L38_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_25 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_25) && PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L38_error) + __pyx_t_25 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_25) && PyErr_Occurred())) __PYX_ERR(0, 639, __pyx_L38_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, 640, __pyx_L38_error) + __PYX_ERR(0, 639, __pyx_L38_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, 640, __pyx_L38_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, 639, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_10pyreadstat_16_readstat_writer_pandas_to_readstat_types, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_26 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L38_error) + __pyx_t_26 = ((readstat_type_t)__Pyx_PyInt_As_readstat_type_t(__pyx_t_5)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 639, __pyx_L38_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_variable = readstat_add_variable(__pyx_v_writer, __pyx_t_25, __pyx_t_26, __pyx_v_max_length); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":641 + /* "pyreadstat/_readstat_writer.pyx":640 * variable_name = col_names[col_indx] * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) * if curtype in pyrwriter_datetimelike_types: # <<<<<<<<<<<<<< * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) */ - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L38_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); 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, 641, __pyx_L38_error) + __PYX_ERR(0, 640, __pyx_L38_error) } - __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 641, __pyx_L38_error) + __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 640, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = (__pyx_t_4 != 0); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":642 + /* "pyreadstat/_readstat_writer.pyx":641 * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) * if curtype in pyrwriter_datetimelike_types: * curformat = get_datetimelike_format_for_readstat(file_format, curtype) # <<<<<<<<<<<<<< @@ -10190,7 +10193,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ __pyx_v_curformat = __pyx_f_10pyreadstat_16_readstat_writer_get_datetimelike_format_for_readstat(__pyx_v_file_format, __pyx_v_curtype); - /* "pyreadstat/_readstat_writer.pyx":643 + /* "pyreadstat/_readstat_writer.pyx":642 * if curtype in pyrwriter_datetimelike_types: * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) # <<<<<<<<<<<<<< @@ -10199,7 +10202,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":641 + /* "pyreadstat/_readstat_writer.pyx":640 * variable_name = col_names[col_indx] * variable = readstat_add_variable(writer, variable_name.encode("utf-8"), pandas_to_readstat_types[curtype], max_length) * if curtype in pyrwriter_datetimelike_types: # <<<<<<<<<<<<<< @@ -10208,7 +10211,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":644 + /* "pyreadstat/_readstat_writer.pyx":643 * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) * if col_label_count: # <<<<<<<<<<<<<< @@ -10218,7 +10221,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_3 = (__pyx_v_col_label_count != 0); if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":645 + /* "pyreadstat/_readstat_writer.pyx":644 * readstat_variable_set_format(variable, curformat) * if col_label_count: * if column_labels[col_indx] is not None: # <<<<<<<<<<<<<< @@ -10227,16 +10230,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_column_labels == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 645, __pyx_L38_error) + __PYX_ERR(0, 644, __pyx_L38_error) } - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 645, __pyx_L38_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = (__pyx_t_2 != Py_None); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":646 + /* "pyreadstat/_readstat_writer.pyx":645 * if col_label_count: * if column_labels[col_indx] is not None: * if type(column_labels[col_indx]) != str: # <<<<<<<<<<<<<< @@ -10245,24 +10248,24 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_column_labels == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 646, __pyx_L38_error) + __PYX_ERR(0, 645, __pyx_L38_error) } - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L38_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 645, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_2)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 646, __pyx_L38_error) + __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_2)), ((PyObject *)(&PyString_Type)), Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 646, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 645, __pyx_L38_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_4)) { - /* "pyreadstat/_readstat_writer.pyx":647 + /* "pyreadstat/_readstat_writer.pyx":646 * 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_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L38_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { @@ -10276,14 +10279,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_5 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_14, __pyx_kp_s_Column_labels_must_be_strings) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Column_labels_must_be_strings); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L38_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 646, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 647, __pyx_L38_error) + __PYX_ERR(0, 646, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":646 + /* "pyreadstat/_readstat_writer.pyx":645 * if col_label_count: * if column_labels[col_indx] is not None: * if type(column_labels[col_indx]) != str: # <<<<<<<<<<<<<< @@ -10292,7 +10295,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":648 + /* "pyreadstat/_readstat_writer.pyx":647 * if type(column_labels[col_indx]) != str: * raise PyreadstatError("Column labels must be strings") * cur_col_label = column_labels[col_indx].encode("utf-8") # <<<<<<<<<<<<<< @@ -10301,11 +10304,11 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ if (unlikely(__pyx_v_column_labels == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 648, __pyx_L38_error) + __PYX_ERR(0, 647, __pyx_L38_error) } - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 648, __pyx_L38_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_column_labels, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 648, __pyx_L38_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 647, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; @@ -10320,14 +10323,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_5 = (__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_5)) __PYX_ERR(0, 648, __pyx_L38_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 648, __pyx_L38_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 647, __pyx_L38_error) __Pyx_XDECREF_SET(__pyx_v_cur_col_label, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":649 + /* "pyreadstat/_readstat_writer.pyx":648 * 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) # <<<<<<<<<<<<<< @@ -10336,12 +10339,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, 649, __pyx_L38_error) + __PYX_ERR(0, 648, __pyx_L38_error) } - __pyx_t_27 = __Pyx_PyBytes_AsString(__pyx_v_cur_col_label); if (unlikely((!__pyx_t_27) && PyErr_Occurred())) __PYX_ERR(0, 649, __pyx_L38_error) + __pyx_t_27 = __Pyx_PyBytes_AsString(__pyx_v_cur_col_label); if (unlikely((!__pyx_t_27) && PyErr_Occurred())) __PYX_ERR(0, 648, __pyx_L38_error) readstat_variable_set_label(__pyx_v_variable, __pyx_t_27); - /* "pyreadstat/_readstat_writer.pyx":645 + /* "pyreadstat/_readstat_writer.pyx":644 * readstat_variable_set_format(variable, curformat) * if col_label_count: * if column_labels[col_indx] is not None: # <<<<<<<<<<<<<< @@ -10350,7 +10353,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":644 + /* "pyreadstat/_readstat_writer.pyx":643 * curformat = get_datetimelike_format_for_readstat(file_format, curtype) * readstat_variable_set_format(variable, curformat) * if col_label_count: # <<<<<<<<<<<<<< @@ -10359,17 +10362,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":650 + /* "pyreadstat/_readstat_writer.pyx":649 * 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_value_labels); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 650, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_variable_value_labels); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 649, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":651 + /* "pyreadstat/_readstat_writer.pyx":650 * readstat_variable_set_label(variable, cur_col_label) * if variable_value_labels: * value_labels = variable_value_labels.get(variable_name) # <<<<<<<<<<<<<< @@ -10378,43 +10381,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, 651, __pyx_L38_error) + __PYX_ERR(0, 650, __pyx_L38_error) } - __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 651, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_value_labels, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 650, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 651, __pyx_L38_error) + if (!(likely(PyDict_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 650, __pyx_L38_error) __Pyx_XDECREF_SET(__pyx_v_value_labels, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":652 + /* "pyreadstat/_readstat_writer.pyx":651 * 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_value_labels); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 652, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_value_labels); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 651, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":653 + /* "pyreadstat/_readstat_writer.pyx":652 * 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_5 = __Pyx_PyInt_From_int(__pyx_v_lblset_cnt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_lblset_cnt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 652, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 653, __pyx_L38_error) + __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 652, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_v_variable_name, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L38_error) + __pyx_t_5 = PyNumber_Add(__pyx_v_variable_name, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 652, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF_SET(__pyx_v_labelset_name, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":654 + /* "pyreadstat/_readstat_writer.pyx":653 * if value_labels: * labelset_name = variable_name + str(lblset_cnt) * lblset_cnt += 1 # <<<<<<<<<<<<<< @@ -10423,7 +10426,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":655 + /* "pyreadstat/_readstat_writer.pyx":654 * labelset_name = variable_name + str(lblset_cnt) * lblset_cnt += 1 * curuser_missing = None # <<<<<<<<<<<<<< @@ -10433,17 +10436,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":656 + /* "pyreadstat/_readstat_writer.pyx":655 * 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 656, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 655, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":657 + /* "pyreadstat/_readstat_writer.pyx":656 * curuser_missing = None * if missing_user_values: * curuser_missing = missing_user_values.get(variable_name) # <<<<<<<<<<<<<< @@ -10452,14 +10455,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, 657, __pyx_L38_error) + __PYX_ERR(0, 656, __pyx_L38_error) } - __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 657, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 656, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_curuser_missing, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":656 + /* "pyreadstat/_readstat_writer.pyx":655 * lblset_cnt += 1 * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< @@ -10468,40 +10471,40 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":658 + /* "pyreadstat/_readstat_writer.pyx":657 * 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, 658, __pyx_L38_error) + 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, 657, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":659 + /* "pyreadstat/_readstat_writer.pyx":658 * 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_5 = __Pyx_PyDict_GetItem(__pyx_v_col_names_to_types, __pyx_v_variable_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 659, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_v_col_names_to_types, __pyx_v_variable_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 658, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_23 = ((__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, 659, __pyx_L38_error) + __pyx_t_23 = ((__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, 658, __pyx_L38_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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, 659, __pyx_L38_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, 659, __pyx_L38_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, 658, __pyx_L38_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, 658, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":658 + /* "pyreadstat/_readstat_writer.pyx":657 * 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_28 = __pyx_f_10pyreadstat_16_readstat_writer_set_value_label(__pyx_v_writer, __pyx_v_value_labels, ((PyObject*)__pyx_v_labelset_name), __pyx_t_23, __pyx_v_file_format, ((PyObject*)__pyx_v_variable_name), ((PyObject*)__pyx_v_curuser_missing)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 658, __pyx_L38_error) + __pyx_t_28 = __pyx_f_10pyreadstat_16_readstat_writer_set_value_label(__pyx_v_writer, __pyx_v_value_labels, ((PyObject*)__pyx_v_labelset_name), __pyx_t_23, __pyx_v_file_format, ((PyObject*)__pyx_v_variable_name), ((PyObject*)__pyx_v_curuser_missing)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L38_error) __pyx_v_label_set = __pyx_t_28; - /* "pyreadstat/_readstat_writer.pyx":660 + /* "pyreadstat/_readstat_writer.pyx":659 * 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) # <<<<<<<<<<<<<< @@ -10510,7 +10513,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":652 + /* "pyreadstat/_readstat_writer.pyx":651 * if variable_value_labels: * value_labels = variable_value_labels.get(variable_name) * if value_labels: # <<<<<<<<<<<<<< @@ -10519,7 +10522,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":650 + /* "pyreadstat/_readstat_writer.pyx":649 * cur_col_label = column_labels[col_indx].encode("utf-8") * readstat_variable_set_label(variable, cur_col_label) * if variable_value_labels: # <<<<<<<<<<<<<< @@ -10528,17 +10531,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":661 + /* "pyreadstat/_readstat_writer.pyx":660 * 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_ranges); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 661, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_missing_ranges); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 660, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":662 + /* "pyreadstat/_readstat_writer.pyx":661 * readstat_variable_set_label_set(variable, label_set) * if missing_ranges: * cur_ranges = missing_ranges.get(variable_name) # <<<<<<<<<<<<<< @@ -10547,24 +10550,24 @@ 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, 662, __pyx_L38_error) + __PYX_ERR(0, 661, __pyx_L38_error) } - __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_ranges, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 662, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_ranges, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 661, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_cur_ranges, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":663 + /* "pyreadstat/_readstat_writer.pyx":662 * 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_cur_ranges); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 663, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_cur_ranges); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 662, __pyx_L38_error) if (__pyx_t_4) { - /* "pyreadstat/_readstat_writer.pyx":664 + /* "pyreadstat/_readstat_writer.pyx":663 * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: * if not isinstance(cur_ranges, list): # <<<<<<<<<<<<<< @@ -10575,7 +10578,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0); if (unlikely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":665 + /* "pyreadstat/_readstat_writer.pyx":664 * if cur_ranges: * if not isinstance(cur_ranges, list): * msg = "missing_ranges: values in dictionary must be list" # <<<<<<<<<<<<<< @@ -10585,14 +10588,14 @@ 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":666 + /* "pyreadstat/_readstat_writer.pyx":665 * if not isinstance(cur_ranges, list): * msg = "missing_ranges: values in dictionary must be list" * raise PyreadstatError(msg) # <<<<<<<<<<<<<< * add_missing_ranges(cur_ranges, variable) * if variable_alignment: */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 666, __pyx_L38_error) + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 665, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { @@ -10606,14 +10609,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_2, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_msg); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L38_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 666, __pyx_L38_error) + __PYX_ERR(0, 665, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":664 + /* "pyreadstat/_readstat_writer.pyx":663 * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: * if not isinstance(cur_ranges, list): # <<<<<<<<<<<<<< @@ -10622,17 +10625,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":667 + /* "pyreadstat/_readstat_writer.pyx":666 * msg = "missing_ranges: values in dictionary must be list" * raise PyreadstatError(msg) * add_missing_ranges(cur_ranges, variable) # <<<<<<<<<<<<<< * 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, 667, __pyx_L38_error) - __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(((PyObject*)__pyx_v_cur_ranges), __pyx_v_variable); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L38_error) + 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, 666, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_writer_add_missing_ranges(((PyObject*)__pyx_v_cur_ranges), __pyx_v_variable); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 666, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":663 + /* "pyreadstat/_readstat_writer.pyx":662 * if missing_ranges: * cur_ranges = missing_ranges.get(variable_name) * if cur_ranges: # <<<<<<<<<<<<<< @@ -10641,7 +10644,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":661 + /* "pyreadstat/_readstat_writer.pyx":660 * col_names_to_types[variable_name], file_format, variable_name, curuser_missing) * readstat_variable_set_label_set(variable, label_set) * if missing_ranges: # <<<<<<<<<<<<<< @@ -10650,17 +10653,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":668 + /* "pyreadstat/_readstat_writer.pyx":667 * raise PyreadstatError(msg) * add_missing_ranges(cur_ranges, variable) * 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_alignment); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 668, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_alignment); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 667, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":671 + /* "pyreadstat/_readstat_writer.pyx":670 * # 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) # <<<<<<<<<<<<<< @@ -10669,35 +10672,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, 671, __pyx_L38_error) + __PYX_ERR(0, 670, __pyx_L38_error) } - __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_alignment, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 671, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_alignment, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 670, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_cur_alignment, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":672 + /* "pyreadstat/_readstat_writer.pyx":671 * # 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_alignment); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 672, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_alignment); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 671, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":673 + /* "pyreadstat/_readstat_writer.pyx":672 * 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, 673, __pyx_L38_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, 673, __pyx_L38_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, 673, __pyx_L38_error) + 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, 672, __pyx_L38_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, 672, __pyx_L38_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, 672, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":672 + /* "pyreadstat/_readstat_writer.pyx":671 * # the resulting file all alignments are still unknown) * cur_alignment = variable_alignment.get(variable_name) * if cur_alignment: # <<<<<<<<<<<<<< @@ -10706,7 +10709,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":668 + /* "pyreadstat/_readstat_writer.pyx":667 * raise PyreadstatError(msg) * add_missing_ranges(cur_ranges, variable) * if variable_alignment: # <<<<<<<<<<<<<< @@ -10715,17 +10718,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":674 + /* "pyreadstat/_readstat_writer.pyx":673 * 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_display_width); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 674, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_display_width); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 673, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":675 + /* "pyreadstat/_readstat_writer.pyx":674 * set_variable_alignment(variable, cur_alignment, variable_name) * if variable_display_width: * cur_display_width = variable_display_width.get(variable_name) # <<<<<<<<<<<<<< @@ -10734,35 +10737,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, 675, __pyx_L38_error) + __PYX_ERR(0, 674, __pyx_L38_error) } - __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_display_width, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_display_width, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 674, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_cur_display_width, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":676 + /* "pyreadstat/_readstat_writer.pyx":675 * 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_display_width); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 676, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_display_width); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 675, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":677 + /* "pyreadstat/_readstat_writer.pyx":676 * 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_24 = __Pyx_PyInt_As_int(__pyx_v_cur_display_width); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 677, __pyx_L38_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, 677, __pyx_L38_error) - __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(__pyx_v_variable, __pyx_t_24, ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 677, __pyx_L38_error) + __pyx_t_24 = __Pyx_PyInt_As_int(__pyx_v_cur_display_width); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L38_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, 676, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_writer_set_variable_display_width(__pyx_v_variable, __pyx_t_24, ((PyObject*)__pyx_v_variable_name)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":676 + /* "pyreadstat/_readstat_writer.pyx":675 * if variable_display_width: * cur_display_width = variable_display_width.get(variable_name) * if cur_display_width: # <<<<<<<<<<<<<< @@ -10771,7 +10774,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":674 + /* "pyreadstat/_readstat_writer.pyx":673 * if cur_alignment: * set_variable_alignment(variable, cur_alignment, variable_name) * if variable_display_width: # <<<<<<<<<<<<<< @@ -10780,17 +10783,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":678 + /* "pyreadstat/_readstat_writer.pyx":677 * 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_measure); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 678, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_variable_measure); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 677, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":679 + /* "pyreadstat/_readstat_writer.pyx":678 * set_variable_display_width(variable, cur_display_width, variable_name) * if variable_measure: * cur_measure = variable_measure.get(variable_name) # <<<<<<<<<<<<<< @@ -10799,35 +10802,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, 679, __pyx_L38_error) + __PYX_ERR(0, 678, __pyx_L38_error) } - __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_measure, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 679, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_v_variable_measure, __pyx_v_variable_name, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 678, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_cur_measure, __pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":680 + /* "pyreadstat/_readstat_writer.pyx":679 * if variable_measure: * cur_measure = variable_measure.get(variable_name) * if cur_measure: # <<<<<<<<<<<<<< * set_variable_measure(variable, cur_measure, variable_name) * */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_measure); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 680, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_cur_measure); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 679, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":681 + /* "pyreadstat/_readstat_writer.pyx":680 * 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, 681, __pyx_L38_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, 681, __pyx_L38_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, 681, __pyx_L38_error) + 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, 680, __pyx_L38_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, 680, __pyx_L38_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, 680, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":680 + /* "pyreadstat/_readstat_writer.pyx":679 * if variable_measure: * cur_measure = variable_measure.get(variable_name) * if cur_measure: # <<<<<<<<<<<<<< @@ -10836,7 +10839,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":678 + /* "pyreadstat/_readstat_writer.pyx":677 * if cur_display_width: * set_variable_display_width(variable, cur_display_width, variable_name) * if variable_measure: # <<<<<<<<<<<<<< @@ -10846,7 +10849,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } } - /* "pyreadstat/_readstat_writer.pyx":684 + /* "pyreadstat/_readstat_writer.pyx":683 * * # start writing * if file_format == FILE_FORMAT_SAS7BCAT: # <<<<<<<<<<<<<< @@ -10856,16 +10859,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":685 + /* "pyreadstat/_readstat_writer.pyx":684 * # 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, 685, __pyx_L38_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, 684, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":684 + /* "pyreadstat/_readstat_writer.pyx":683 * * # start writing * if file_format == FILE_FORMAT_SAS7BCAT: # <<<<<<<<<<<<<< @@ -10875,16 +10878,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":687 + /* "pyreadstat/_readstat_writer.pyx":686 * 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, 687, __pyx_L38_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, 686, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":686 + /* "pyreadstat/_readstat_writer.pyx":685 * if file_format == FILE_FORMAT_SAS7BCAT: * check_exit_status(readstat_begin_writing_sas7bcat(writer, &fd)) * elif file_format == FILE_FORMAT_DTA: # <<<<<<<<<<<<<< @@ -10894,16 +10897,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":689 + /* "pyreadstat/_readstat_writer.pyx":688 * 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, 689, __pyx_L38_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, 688, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":688 + /* "pyreadstat/_readstat_writer.pyx":687 * elif file_format == FILE_FORMAT_DTA: * check_exit_status(readstat_begin_writing_dta(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_SAV: # <<<<<<<<<<<<<< @@ -10913,16 +10916,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":691 + /* "pyreadstat/_readstat_writer.pyx":690 * 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, 691, __pyx_L38_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, 690, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":690 + /* "pyreadstat/_readstat_writer.pyx":689 * elif file_format == FILE_FORMAT_SAV: * check_exit_status(readstat_begin_writing_sav(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_POR: # <<<<<<<<<<<<<< @@ -10932,16 +10935,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":693 + /* "pyreadstat/_readstat_writer.pyx":692 * 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, 693, __pyx_L38_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, 692, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":692 + /* "pyreadstat/_readstat_writer.pyx":691 * elif file_format == FILE_FORMAT_POR: * check_exit_status(readstat_begin_writing_por(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_SAS7BDAT: # <<<<<<<<<<<<<< @@ -10951,16 +10954,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":695 + /* "pyreadstat/_readstat_writer.pyx":694 * 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, 695, __pyx_L38_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, 694, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":694 + /* "pyreadstat/_readstat_writer.pyx":693 * elif file_format == FILE_FORMAT_SAS7BDAT: * check_exit_status(readstat_begin_writing_sas7bdat(writer, &fd, row_count)) * elif file_format == FILE_FORMAT_XPORT: # <<<<<<<<<<<<<< @@ -10970,14 +10973,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d break; default: - /* "pyreadstat/_readstat_writer.pyx":697 + /* "pyreadstat/_readstat_writer.pyx":696 * 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, 697, __pyx_L38_error) + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 696, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) { @@ -10991,25 +10994,25 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_2, __pyx_kp_s_unknown_file_format) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_s_unknown_file_format); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L38_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 696, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(0, 697, __pyx_L38_error) + __PYX_ERR(0, 696, __pyx_L38_error) break; } - /* "pyreadstat/_readstat_writer.pyx":700 + /* "pyreadstat/_readstat_writer.pyx":699 * * # 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, 700, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_validate_metadata(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":701 + /* "pyreadstat/_readstat_writer.pyx":700 * # validation * check_exit_status(readstat_validate_metadata(writer)) * for col_indx in range(col_count): # <<<<<<<<<<<<<< @@ -11021,7 +11024,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_col_indx = __pyx_t_22; - /* "pyreadstat/_readstat_writer.pyx":702 + /* "pyreadstat/_readstat_writer.pyx":701 * check_exit_status(readstat_validate_metadata(writer)) * for col_indx in range(col_count): * tempvar = readstat_get_variable(writer, col_indx) # <<<<<<<<<<<<<< @@ -11030,29 +11033,29 @@ 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":703 + /* "pyreadstat/_readstat_writer.pyx":702 * for col_indx in range(col_count): * tempvar = readstat_get_variable(writer, col_indx) * check_exit_status(readstat_validate_variable(writer, tempvar)) # <<<<<<<<<<<<<< * * # inserting */ - __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, 703, __pyx_L38_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, 702, __pyx_L38_error) } - /* "pyreadstat/_readstat_writer.pyx":706 + /* "pyreadstat/_readstat_writer.pyx":705 * * # inserting * values = df.values # <<<<<<<<<<<<<< * * for row in values: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 706, __pyx_L38_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_n_s_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 705, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_values = __pyx_t_5; __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":708 + /* "pyreadstat/_readstat_writer.pyx":707 * values = df.values * * for row in values: # <<<<<<<<<<<<<< @@ -11063,26 +11066,26 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_5 = __pyx_v_values; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L38_error) + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 707, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 708, __pyx_L38_error) + __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 707, __pyx_L38_error) } for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_14 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_14); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 708, __pyx_L38_error) + __pyx_t_14 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_14); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 707, __pyx_L38_error) #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 708, __pyx_L38_error) + __pyx_t_14 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 707, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_14); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 708, __pyx_L38_error) + __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_14); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 707, __pyx_L38_error) #else - __pyx_t_14 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 708, __pyx_L38_error) + __pyx_t_14 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 707, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); #endif } @@ -11092,7 +11095,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 708, __pyx_L38_error) + else __PYX_ERR(0, 707, __pyx_L38_error) } break; } @@ -11101,16 +11104,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":709 + /* "pyreadstat/_readstat_writer.pyx":708 * * for row in 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, 709, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_begin_row(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 708, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":711 + /* "pyreadstat/_readstat_writer.pyx":710 * check_exit_status(readstat_begin_row(writer)) * * for col_indx in range(col_count): # <<<<<<<<<<<<<< @@ -11122,7 +11125,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_col_indx = __pyx_t_22; - /* "pyreadstat/_readstat_writer.pyx":713 + /* "pyreadstat/_readstat_writer.pyx":712 * for col_indx in range(col_count): * * tempvar = readstat_get_variable(writer, col_indx) # <<<<<<<<<<<<<< @@ -11131,19 +11134,19 @@ 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":714 + /* "pyreadstat/_readstat_writer.pyx":713 * * tempvar = readstat_get_variable(writer, col_indx) * curval = row[col_indx] # <<<<<<<<<<<<<< * curtype = col_types[col_indx][0] * is_missing = col_types[col_indx][2] */ - __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_row, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 714, __pyx_L38_error) + __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_row, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 713, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_XDECREF_SET(__pyx_v_curval, __pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":715 + /* "pyreadstat/_readstat_writer.pyx":714 * tempvar = readstat_get_variable(writer, col_indx) * curval = row[col_indx] * curtype = col_types[col_indx][0] # <<<<<<<<<<<<<< @@ -11152,18 +11155,18 @@ 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, 715, __pyx_L38_error) + __PYX_ERR(0, 714, __pyx_L38_error) } - __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 715, __pyx_L38_error) + __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 714, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_14, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L38_error) + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_14, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_23 = ((__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, 715, __pyx_L38_error) + __pyx_t_23 = ((__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, 714, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_curtype = __pyx_t_23; - /* "pyreadstat/_readstat_writer.pyx":716 + /* "pyreadstat/_readstat_writer.pyx":715 * curval = row[col_indx] * curtype = col_types[col_indx][0] * is_missing = col_types[col_indx][2] # <<<<<<<<<<<<<< @@ -11172,17 +11175,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, 716, __pyx_L38_error) + __PYX_ERR(0, 715, __pyx_L38_error) } - __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L38_error) + __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_col_types, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 716, __pyx_L38_error) + __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 715, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_is_missing, __pyx_t_14); __pyx_t_14 = 0; - /* "pyreadstat/_readstat_writer.pyx":717 + /* "pyreadstat/_readstat_writer.pyx":716 * curtype = col_types[col_indx][0] * is_missing = col_types[col_indx][2] * curuser_missing = None # <<<<<<<<<<<<<< @@ -11192,17 +11195,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":718 + /* "pyreadstat/_readstat_writer.pyx":717 * 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 718, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_missing_user_values); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 717, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":719 + /* "pyreadstat/_readstat_writer.pyx":718 * curuser_missing = None * if missing_user_values: * curuser_missing = missing_user_values.get(col_names[col_indx]) # <<<<<<<<<<<<<< @@ -11211,21 +11214,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, 719, __pyx_L38_error) + __PYX_ERR(0, 718, __pyx_L38_error) } if (unlikely(__pyx_v_col_names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 719, __pyx_L38_error) + __PYX_ERR(0, 718, __pyx_L38_error) } - __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 719, __pyx_L38_error) + __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_col_names, __pyx_v_col_indx, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 718, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_t_14, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L38_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_missing_user_values, __pyx_t_14, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF_SET(__pyx_v_curuser_missing, __pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":718 + /* "pyreadstat/_readstat_writer.pyx":717 * is_missing = col_types[col_indx][2] * curuser_missing = None * if missing_user_values: # <<<<<<<<<<<<<< @@ -11234,26 +11237,26 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":721 + /* "pyreadstat/_readstat_writer.pyx":720 * 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_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_missing); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 721, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_missing); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 720, __pyx_L38_error) if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":723 + /* "pyreadstat/_readstat_writer.pyx":722 * 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_14, __pyx_n_s_pd); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 723, __pyx_L38_error) + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_pd); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 722, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_isna); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 723, __pyx_L38_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_isna); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 722, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = NULL; @@ -11268,23 +11271,23 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_v_curval) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_curval); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L38_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 723, __pyx_L38_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 722, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":724 + /* "pyreadstat/_readstat_writer.pyx":723 * #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, 724, __pyx_L38_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, 723, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":725 + /* "pyreadstat/_readstat_writer.pyx":724 * if pd.isna(curval): * check_exit_status(readstat_insert_missing_value(writer, tempvar)) * continue # <<<<<<<<<<<<<< @@ -11293,7 +11296,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ goto __pyx_L74_continue; - /* "pyreadstat/_readstat_writer.pyx":723 + /* "pyreadstat/_readstat_writer.pyx":722 * if is_missing: * #if curval is None or (type(curval) in numeric_types and np.isnan(curval)): * if pd.isna(curval): # <<<<<<<<<<<<<< @@ -11302,7 +11305,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":721 + /* "pyreadstat/_readstat_writer.pyx":720 * curuser_missing = missing_user_values.get(col_names[col_indx]) * * if is_missing: # <<<<<<<<<<<<<< @@ -11311,54 +11314,54 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":727 + /* "pyreadstat/_readstat_writer.pyx":726 * 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_4 = __Pyx_PyObject_IsTrue(__pyx_v_curuser_missing); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 727, __pyx_L38_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_curuser_missing); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 726, __pyx_L38_error) if (__pyx_t_4) { } else { __pyx_t_3 = __pyx_t_4; goto __pyx_L80_bool_binop_done; } - __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L38_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); 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, 727, __pyx_L38_error) + __PYX_ERR(0, 726, __pyx_L38_error) } - __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 727, __pyx_L38_error) + __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_10pyreadstat_16_readstat_writer_pywriter_numeric_types, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 726, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_29 = (__pyx_t_4 != 0); __pyx_t_3 = __pyx_t_29; __pyx_L80_bool_binop_done:; if (__pyx_t_3) { - /* "pyreadstat/_readstat_writer.pyx":728 + /* "pyreadstat/_readstat_writer.pyx":727 * * 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_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_curval, __pyx_v_curuser_missing, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 728, __pyx_L38_error) + __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_curval, __pyx_v_curuser_missing, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 727, __pyx_L38_error) __pyx_t_29 = (__pyx_t_3 != 0); if (__pyx_t_29) { - /* "pyreadstat/_readstat_writer.pyx":729 + /* "pyreadstat/_readstat_writer.pyx":728 * 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, 729, __pyx_L38_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, 729, __pyx_L38_error) + __pyx_t_13 = __Pyx_PyObject_Ord(__pyx_v_curval); if (unlikely(__pyx_t_13 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 728, __pyx_L38_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, 728, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":730 + /* "pyreadstat/_readstat_writer.pyx":729 * if curval in curuser_missing: * check_exit_status(readstat_insert_tagged_missing_value(writer, tempvar, ord(curval))) * continue # <<<<<<<<<<<<<< @@ -11367,7 +11370,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ goto __pyx_L74_continue; - /* "pyreadstat/_readstat_writer.pyx":728 + /* "pyreadstat/_readstat_writer.pyx":727 * * if curuser_missing and curtype in pywriter_numeric_types: * if curval in curuser_missing: # <<<<<<<<<<<<<< @@ -11376,7 +11379,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":727 + /* "pyreadstat/_readstat_writer.pyx":726 * continue * * if curuser_missing and curtype in pywriter_numeric_types: # <<<<<<<<<<<<<< @@ -11385,7 +11388,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ } - /* "pyreadstat/_readstat_writer.pyx":732 + /* "pyreadstat/_readstat_writer.pyx":731 * continue * * if curtype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< @@ -11395,17 +11398,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_29 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE) != 0); if (__pyx_t_29) { - /* "pyreadstat/_readstat_writer.pyx":733 + /* "pyreadstat/_readstat_writer.pyx":732 * * 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_30 = __pyx_PyFloat_AsDouble(__pyx_v_curval); if (unlikely((__pyx_t_30 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 733, __pyx_L38_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, ((double)__pyx_t_30))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 733, __pyx_L38_error) + __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_v_curval); if (unlikely((__pyx_t_30 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_double_value(__pyx_v_writer, __pyx_v_tempvar, ((double)__pyx_t_30))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":732 + /* "pyreadstat/_readstat_writer.pyx":731 * continue * * if curtype == PYWRITER_DOUBLE: # <<<<<<<<<<<<<< @@ -11415,7 +11418,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d goto __pyx_L83; } - /* "pyreadstat/_readstat_writer.pyx":734 + /* "pyreadstat/_readstat_writer.pyx":733 * if curtype == PYWRITER_DOUBLE: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype == PYWRITER_INTEGER: # <<<<<<<<<<<<<< @@ -11425,17 +11428,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_29 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER) != 0); if (__pyx_t_29) { - /* "pyreadstat/_readstat_writer.pyx":735 + /* "pyreadstat/_readstat_writer.pyx":734 * 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_31 = __Pyx_PyInt_As_int32_t(__pyx_v_curval); if (unlikely((__pyx_t_31 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 735, __pyx_L38_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_31)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 735, __pyx_L38_error) + __pyx_t_31 = __Pyx_PyInt_As_int32_t(__pyx_v_curval); if (unlikely((__pyx_t_31 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 734, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_31)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 734, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":734 + /* "pyreadstat/_readstat_writer.pyx":733 * if curtype == PYWRITER_DOUBLE: * check_exit_status(readstat_insert_double_value(writer, tempvar, curval)) * elif curtype == PYWRITER_INTEGER: # <<<<<<<<<<<<<< @@ -11445,7 +11448,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d goto __pyx_L83; } - /* "pyreadstat/_readstat_writer.pyx":736 + /* "pyreadstat/_readstat_writer.pyx":735 * elif curtype == PYWRITER_INTEGER: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_LOGICAL: # <<<<<<<<<<<<<< @@ -11455,17 +11458,17 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_29 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL) != 0); if (__pyx_t_29) { - /* "pyreadstat/_readstat_writer.pyx":737 + /* "pyreadstat/_readstat_writer.pyx":736 * 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_24 = __Pyx_PyInt_As_int(__pyx_v_curval); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 737, __pyx_L38_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, ((int)__pyx_t_24))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 737, __pyx_L38_error) + __pyx_t_24 = __Pyx_PyInt_As_int(__pyx_v_curval); if (unlikely((__pyx_t_24 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_int32_value(__pyx_v_writer, __pyx_v_tempvar, ((int)__pyx_t_24))); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":736 + /* "pyreadstat/_readstat_writer.pyx":735 * elif curtype == PYWRITER_INTEGER: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_LOGICAL: # <<<<<<<<<<<<<< @@ -11475,7 +11478,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d goto __pyx_L83; } - /* "pyreadstat/_readstat_writer.pyx":738 + /* "pyreadstat/_readstat_writer.pyx":737 * elif curtype == PYWRITER_LOGICAL: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_CHARACTER: # <<<<<<<<<<<<<< @@ -11485,14 +11488,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_29 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER) != 0); if (__pyx_t_29) { - /* "pyreadstat/_readstat_writer.pyx":739 + /* "pyreadstat/_readstat_writer.pyx":738 * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L38_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_curval, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { @@ -11506,14 +11509,14 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_utf_8); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L38_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_32 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_32) && PyErr_Occurred())) __PYX_ERR(0, 739, __pyx_L38_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_32)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 739, __pyx_L38_error) + __pyx_t_32 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_32) && PyErr_Occurred())) __PYX_ERR(0, 738, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_32)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 738, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":738 + /* "pyreadstat/_readstat_writer.pyx":737 * elif curtype == PYWRITER_LOGICAL: * check_exit_status(readstat_insert_int32_value(writer, tempvar, curval)) * elif curtype == PYWRITER_CHARACTER: # <<<<<<<<<<<<<< @@ -11523,7 +11526,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d goto __pyx_L83; } - /* "pyreadstat/_readstat_writer.pyx":740 + /* "pyreadstat/_readstat_writer.pyx":739 * elif curtype == PYWRITER_CHARACTER: * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) * elif curtype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -11533,33 +11536,33 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_29 = ((__pyx_v_curtype == __pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT) != 0); if (__pyx_t_29) { - /* "pyreadstat/_readstat_writer.pyx":741 + /* "pyreadstat/_readstat_writer.pyx":740 * 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 in pyrwriter_datetimelike_types: */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_curval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L38_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_curval); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L38_error) __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, 741, __pyx_L38_error) + 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, 740, __pyx_L38_error) __Pyx_XDECREF_SET(__pyx_v_curvalstr, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":742 + /* "pyreadstat/_readstat_writer.pyx":741 * elif curtype == PYWRITER_OBJECT: * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) # <<<<<<<<<<<<<< * elif curtype in pyrwriter_datetimelike_types: * dtimelikeval = convert_datetimelike_to_number(file_format, curtype, curval) */ - __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_curvalstr, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L38_error) + __pyx_t_2 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyString_Type_encode, __pyx_v_curvalstr, __pyx_kp_s_utf_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_32 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_32) && PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L38_error) - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_32)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L38_error) + __pyx_t_32 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_32) && PyErr_Occurred())) __PYX_ERR(0, 741, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_insert_string_value(__pyx_v_writer, __pyx_v_tempvar, __pyx_t_32)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 741, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pyreadstat/_readstat_writer.pyx":740 + /* "pyreadstat/_readstat_writer.pyx":739 * elif curtype == PYWRITER_CHARACTER: * check_exit_status(readstat_insert_string_value(writer, tempvar, curval.encode("utf-8"))) * elif curtype == PYWRITER_OBJECT: # <<<<<<<<<<<<<< @@ -11569,44 +11572,44 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d goto __pyx_L83; } - /* "pyreadstat/_readstat_writer.pyx":743 + /* "pyreadstat/_readstat_writer.pyx":742 * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) * 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_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L38_error) + __pyx_t_2 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_v_curtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_2); 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, 743, __pyx_L38_error) + __PYX_ERR(0, 742, __pyx_L38_error) } - __pyx_t_29 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely(__pyx_t_29 < 0)) __PYX_ERR(0, 743, __pyx_L38_error) + __pyx_t_29 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, Py_EQ)); if (unlikely(__pyx_t_29 < 0)) __PYX_ERR(0, 742, __pyx_L38_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = (__pyx_t_29 != 0); if (likely(__pyx_t_3)) { - /* "pyreadstat/_readstat_writer.pyx":744 + /* "pyreadstat/_readstat_writer.pyx":743 * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) * 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_30 = __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_number(__pyx_v_file_format, __pyx_v_curtype, __pyx_v_curval); if (unlikely(__pyx_t_30 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 744, __pyx_L38_error) + __pyx_t_30 = __pyx_f_10pyreadstat_16_readstat_writer_convert_datetimelike_to_number(__pyx_v_file_format, __pyx_v_curtype, __pyx_v_curval); if (unlikely(__pyx_t_30 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L38_error) __pyx_v_dtimelikeval = __pyx_t_30; - /* "pyreadstat/_readstat_writer.pyx":745 + /* "pyreadstat/_readstat_writer.pyx":744 * 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, 745, __pyx_L38_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, 744, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":743 + /* "pyreadstat/_readstat_writer.pyx":742 * curvalstr = str(curval) * check_exit_status(readstat_insert_string_value(writer, tempvar, curvalstr.encode("utf-8"))) * elif curtype in pyrwriter_datetimelike_types: # <<<<<<<<<<<<<< @@ -11616,7 +11619,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d goto __pyx_L83; } - /* "pyreadstat/_readstat_writer.pyx":747 + /* "pyreadstat/_readstat_writer.pyx":746 * check_exit_status(readstat_insert_double_value(writer, tempvar, dtimelikeval)) * else: * raise PyreadstatError("Unknown data format to insert") # <<<<<<<<<<<<<< @@ -11624,7 +11627,7 @@ 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_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L38_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PyreadstatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L38_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_14 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -11638,27 +11641,27 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_kp_s_Unknown_data_format_to_insert) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Unknown_data_format_to_insert); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L38_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L38_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, 747, __pyx_L38_error) + __PYX_ERR(0, 746, __pyx_L38_error) } __pyx_L83:; __pyx_L74_continue:; } - /* "pyreadstat/_readstat_writer.pyx":749 + /* "pyreadstat/_readstat_writer.pyx":748 * raise PyreadstatError("Unknown data format to insert") * * check_exit_status(readstat_end_row(writer)) # <<<<<<<<<<<<<< * * check_exit_status(readstat_end_writing(writer)) */ - __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_end_row(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 749, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_end_row(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":708 + /* "pyreadstat/_readstat_writer.pyx":707 * values = df.values * * for row in values: # <<<<<<<<<<<<<< @@ -11668,16 +11671,16 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pyreadstat/_readstat_writer.pyx":751 + /* "pyreadstat/_readstat_writer.pyx":750 * check_exit_status(readstat_end_row(writer)) * * 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, 751, __pyx_L38_error) + __pyx_f_10pyreadstat_16_readstat_parser_check_exit_status(readstat_end_writing(__pyx_v_writer)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 750, __pyx_L38_error) - /* "pyreadstat/_readstat_writer.pyx":608 + /* "pyreadstat/_readstat_writer.pyx":607 * writer = readstat_writer_init() * * try: # <<<<<<<<<<<<<< @@ -11697,7 +11700,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "pyreadstat/_readstat_writer.pyx":753 + /* "pyreadstat/_readstat_writer.pyx":752 * check_exit_status(readstat_end_writing(writer)) * * except: # <<<<<<<<<<<<<< @@ -11706,12 +11709,12 @@ 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_5, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 753, __pyx_L40_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_2, &__pyx_t_1) < 0) __PYX_ERR(0, 752, __pyx_L40_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); - /* "pyreadstat/_readstat_writer.pyx":754 + /* "pyreadstat/_readstat_writer.pyx":753 * * except: * raise # <<<<<<<<<<<<<< @@ -11723,11 +11726,11 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __Pyx_XGIVEREF(__pyx_t_1); __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_2, __pyx_t_1); __pyx_t_5 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; - __PYX_ERR(0, 754, __pyx_L40_except_error) + __PYX_ERR(0, 753, __pyx_L40_except_error) } __pyx_L40_except_error:; - /* "pyreadstat/_readstat_writer.pyx":608 + /* "pyreadstat/_readstat_writer.pyx":607 * writer = readstat_writer_init() * * try: # <<<<<<<<<<<<<< @@ -11743,7 +11746,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d } } - /* "pyreadstat/_readstat_writer.pyx":756 + /* "pyreadstat/_readstat_writer.pyx":755 * raise * finally: * readstat_writer_free(writer) # <<<<<<<<<<<<<< @@ -11754,7 +11757,7 @@ 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":757 + /* "pyreadstat/_readstat_writer.pyx":756 * finally: * readstat_writer_free(writer) * close_file(fd) # <<<<<<<<<<<<<< @@ -11786,7 +11789,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_t_20 = __pyx_lineno; __pyx_t_21 = __pyx_clineno; __pyx_t_33 = __pyx_filename; { - /* "pyreadstat/_readstat_writer.pyx":756 + /* "pyreadstat/_readstat_writer.pyx":755 * raise * finally: * readstat_writer_free(writer) # <<<<<<<<<<<<<< @@ -11795,7 +11798,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d */ readstat_writer_free(__pyx_v_writer); - /* "pyreadstat/_readstat_writer.pyx":757 + /* "pyreadstat/_readstat_writer.pyx":756 * finally: * readstat_writer_free(writer) * close_file(fd) # <<<<<<<<<<<<<< @@ -11821,7 +11824,7 @@ static int __pyx_f_10pyreadstat_16_readstat_writer_run_write(PyObject *__pyx_v_d __pyx_L37:; } - /* "pyreadstat/_readstat_writer.pyx":759 + /* "pyreadstat/_readstat_writer.pyx":758 * close_file(fd) * * return 0 # <<<<<<<<<<<<<< @@ -11829,7 +11832,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":522 + /* "pyreadstat/_readstat_writer.pyx":521 * return close(fd) * * cdef int run_write(df, str filename_path, dst_file_format file_format, str file_label, list column_labels, # <<<<<<<<<<<<<< @@ -11946,7 +11949,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_UInt8Dtype, __pyx_k_UInt8Dtype, sizeof(__pyx_k_UInt8Dtype), 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__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 1, 1}, + {&__pyx_n_s__14, __pyx_k__14, sizeof(__pyx_k__14), 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}, @@ -11978,6 +11981,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1}, {&__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_get, __pyx_k_get, sizeof(__pyx_k_get), 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}, @@ -12114,7 +12118,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * 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.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} + * np.dtype('float32'), np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) */ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_int64); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 38, __pyx_L1_error) @@ -12130,6 +12134,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); + /* "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, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} # <<<<<<<<<<<<<< + * 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} + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_float32); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + /* "pyreadstat/_readstat_writer.pyx":54 * cdef double spss_offset_days = 141428 * cdef double sas_offset_days = 3653 @@ -12137,9 +12152,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * cdef valid_user_missing_sas = [chr(x) for x in range(ord("A"), ord("Z")+1)] + ["_"] */ - __pyx_tuple__12 = PyTuple_Pack(3, __pyx_int_1970, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__13 = PyTuple_Pack(3, __pyx_int_1970, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -12412,8 +12427,9 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__readstat_writer(PyObject *__pyx_p PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; - Py_ssize_t __pyx_t_13; - PyObject *(*__pyx_t_14)(PyObject *); + PyObject *__pyx_t_13 = NULL; + Py_ssize_t __pyx_t_14; + PyObject *(*__pyx_t_15)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -12743,7 +12759,7 @@ if (!__Pyx_RefNanny) { * 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.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} + * np.dtype('float32'), np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} */ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pd); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); @@ -12806,7 +12822,7 @@ if (!__Pyx_RefNanny) { * 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.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} + * np.dtype('float32'), np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 38, __pyx_L1_error) @@ -12845,148 +12861,158 @@ if (!__Pyx_RefNanny) { /* "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.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} # <<<<<<<<<<<<<< + * np.dtype('float32'), np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} # <<<<<<<<<<<<<< * 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} */ __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_int64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __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, 39, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_uint64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) + __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_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __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, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_uint32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __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_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __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, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __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_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __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, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __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_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __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, 39, __pyx_L1_error) + __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_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_UInt32Dtype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) + __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, 39, __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, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __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, 39, __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, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_UInt64Dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_UInt32Dtype); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_pd); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - if (PySet_Add(__pyx_t_12, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 38, __pyx_L1_error) - if (PySet_Add(__pyx_t_12, __pyx_t_7) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __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_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PySet_New(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PySet_Add(__pyx_t_13, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_12, __pyx_t_8) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_12, __pyx_t_9) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_12, __pyx_t_10) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_12, __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_12, __pyx_t_5) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_13, __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_12, __pyx_t_4) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_12, __pyx_t_3) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_12, __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_12, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_12, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + if (PySet_Add(__pyx_t_13, __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_13, __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_13, __pyx_t_12) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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_12)); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_float_types, ((PyObject*)__pyx_t_13)); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; /* "pyreadstat/_readstat_writer.pyx":40 * cdef set float_types = {float, np.dtype('int64'), np.dtype('uint64'), np.dtype('uint32'), np.dtype('float'), - * np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} + * np.dtype('float32'), np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} * 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} * cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} */ - __pyx_t_12 = __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_12)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_13 = __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_13)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_union); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_10pyreadstat_16_readstat_writer_int_mixed_types); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(PySet_CheckExact(__pyx_t_12))||((__pyx_t_12) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_12)->tp_name), 0))) __PYX_ERR(0, 40, __pyx_L1_error) + if (!(likely(PySet_CheckExact(__pyx_t_13))||((__pyx_t_13) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_t_13)->tp_name), 0))) __PYX_ERR(0, 40, __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_12)); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_numeric_types, ((PyObject*)__pyx_t_13)); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; /* "pyreadstat/_readstat_writer.pyx":41 - * np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} + * np.dtype('float32'), np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} * 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} # <<<<<<<<<<<<<< * 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} */ - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_datetime); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_datetime); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_datetime); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_datetime64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __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, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_libs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_timestamps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PySet_Add(__pyx_t_6, __pyx_t_12) < 0) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_datetime64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __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, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_libs); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_timestamps); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PySet_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PySet_Add(__pyx_t_11, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + if (PySet_Add(__pyx_t_6, __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_11, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PySet_Add(__pyx_t_11, __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_6, __pyx_t_13) < 0) __PYX_ERR(0, 41, __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_11)); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_datetime_types, ((PyObject*)__pyx_t_6)); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; /* "pyreadstat/_readstat_writer.pyx":42 * cdef set numeric_types = int_types.union(float_types).union(int_mixed_types) @@ -12995,56 +13021,56 @@ if (!__Pyx_RefNanny) { * cdef set pyrwriter_datetimelike_types = {PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} * cdef set pywriter_numeric_types = {PYWRITER_DOUBLE, PYWRITER_INTEGER, PYWRITER_LOGICAL, PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} */ - __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_datetime); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_datetime); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_datetime); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __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_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_datetime64); 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_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_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_libs); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __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_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_datetime64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_timestamps); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_datetime); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __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, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_libs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_tslibs); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_timestamps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __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, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_datetime); 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_12, __pyx_n_s_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_date); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PySet_Add(__pyx_t_1, __pyx_t_12) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PySet_Add(__pyx_t_1, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (PySet_Add(__pyx_t_12, __pyx_t_13) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PySet_Add(__pyx_t_12, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PySet_Add(__pyx_t_12, __pyx_t_6) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PySet_Add(__pyx_t_12, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PySet_Add(__pyx_t_1, __pyx_t_11) < 0) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PySet_Add(__pyx_t_1, __pyx_t_3) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + if (PySet_Add(__pyx_t_12, __pyx_t_3) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PySet_Add(__pyx_t_1, __pyx_t_4) < 0) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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_1)); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_nat_types, ((PyObject*)__pyx_t_12)); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; /* "pyreadstat/_readstat_writer.pyx":43 * cdef set datetime_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp} @@ -13053,24 +13079,24 @@ if (!__Pyx_RefNanny) { * 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_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __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, 43, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __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, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = PySet_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PySet_Add(__pyx_t_11, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PySet_Add(__pyx_t_11, __pyx_t_4) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PySet_Add(__pyx_t_11, __pyx_t_3) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __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, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PySet_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PySet_Add(__pyx_t_6, __pyx_t_12) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PySet_Add(__pyx_t_6, __pyx_t_3) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PySet_Add(__pyx_t_6, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_11)); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_pyrwriter_datetimelike_types, ((PyObject*)__pyx_t_6)); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; /* "pyreadstat/_readstat_writer.pyx":44 * cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} @@ -13079,36 +13105,36 @@ if (!__Pyx_RefNanny) { * 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_11 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __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, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_LOGICAL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __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, 44, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DOUBLE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __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_INTEGER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_TIME); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 44, __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, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PySet_Add(__pyx_t_5, __pyx_t_11) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PySet_Add(__pyx_t_5, __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_5, __pyx_t_4) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PySet_Add(__pyx_t_5, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PySet_Add(__pyx_t_5, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __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, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PySet_Add(__pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PySet_Add(__pyx_t_4, __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_5, __pyx_t_12) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + if (PySet_Add(__pyx_t_4, __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_4, __pyx_t_12) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PySet_Add(__pyx_t_4, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PySet_Add(__pyx_t_4, __pyx_t_13) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 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_5)); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 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":45 * cdef set pyrwriter_datetimelike_types = {PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} @@ -13117,22 +13143,22 @@ if (!__Pyx_RefNanny) { * PYWRITER_CHARACTER: READSTAT_TYPE_STRING, PYWRITER_LOGICAL: READSTAT_TYPE_INT32, * PYWRITER_OBJECT: READSTAT_TYPE_STRING, PYWRITER_DATE: READSTAT_TYPE_DOUBLE, */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __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, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_12, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_2, __pyx_t_12) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_4 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __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_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_13, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_INTEGER); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_13) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "pyreadstat/_readstat_writer.pyx":46 * cdef set pywriter_numeric_types = {PYWRITER_DOUBLE, PYWRITER_INTEGER, PYWRITER_LOGICAL, PYWRITER_DATE, PYWRITER_DATETIME, PYWRITER_TIME} @@ -13141,20 +13167,20 @@ if (!__Pyx_RefNanny) { * PYWRITER_OBJECT: READSTAT_TYPE_STRING, PYWRITER_DATE: READSTAT_TYPE_DOUBLE, * PYWRITER_DATETIME: READSTAT_TYPE_DOUBLE, PYWRITER_TIME: READSTAT_TYPE_DOUBLE} */ - __pyx_t_12 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_CHARACTER); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_12, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_2, __pyx_t_12) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __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, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_13, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_INT32); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_13) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "pyreadstat/_readstat_writer.pyx":47 * cdef dict pandas_to_readstat_types = {PYWRITER_DOUBLE: READSTAT_TYPE_DOUBLE, PYWRITER_INTEGER: READSTAT_TYPE_INT32, @@ -13163,20 +13189,20 @@ if (!__Pyx_RefNanny) { * PYWRITER_DATETIME: READSTAT_TYPE_DOUBLE, PYWRITER_TIME: READSTAT_TYPE_DOUBLE} * */ - __pyx_t_12 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_OBJECT); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_12, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_2, __pyx_t_12) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __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, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_STRING); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_13, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_13) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "pyreadstat/_readstat_writer.pyx":48 * PYWRITER_CHARACTER: READSTAT_TYPE_STRING, PYWRITER_LOGICAL: READSTAT_TYPE_INT32, @@ -13185,24 +13211,24 @@ if (!__Pyx_RefNanny) { * * cdef double spss_offset_secs = 12219379200 */ - __pyx_t_12 = __Pyx_PyInt_From___pyx_t_10pyreadstat_16_readstat_writer_pywriter_variable_type(__pyx_e_10pyreadstat_16_readstat_writer_PYWRITER_DATETIME); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_12, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 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, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_5, __pyx_t_2, __pyx_t_12) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __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, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_13, __pyx_t_1) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyInt_From_readstat_type_t(READSTAT_TYPE_DOUBLE); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_4, __pyx_t_1, __pyx_t_13) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 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_5)); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 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":50 * PYWRITER_DATETIME: READSTAT_TYPE_DOUBLE, PYWRITER_TIME: READSTAT_TYPE_DOUBLE} @@ -13247,24 +13273,24 @@ if (!__Pyx_RefNanny) { * * cdef valid_user_missing_sas = [chr(x) for x in range(ord("A"), ord("Z")+1)] + ["_"] */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_datetime); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_datetime); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_date); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_date); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XGOTREF(__pyx_v_10pyreadstat_16_readstat_writer_date_0); - __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_date_0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 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":56 * cdef object date_0 = datetime.datetime(1970,1,1).date() @@ -13273,52 +13299,52 @@ if (!__Pyx_RefNanny) { * cdef valid_user_missing_stata = [chr(x) for x in range(ord("a"), ord("z")+1)] * */ - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_12 = __Pyx_PyInt_From_long((90 + 1)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_13 = __Pyx_PyInt_From_long((90 + 1)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_65); __Pyx_GIVEREF(__pyx_int_65); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_65); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_12)) || PyTuple_CheckExact(__pyx_t_12)) { - __pyx_t_2 = __pyx_t_12; __Pyx_INCREF(__pyx_t_2); __pyx_t_13 = 0; - __pyx_t_14 = NULL; + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_65); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_13)) || PyTuple_CheckExact(__pyx_t_13)) { + __pyx_t_1 = __pyx_t_13; __Pyx_INCREF(__pyx_t_1); __pyx_t_14 = 0; + __pyx_t_15 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_14 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_14 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_15 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 56, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_12 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_12); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_13 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_13); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 56, __pyx_L1_error) #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = PySequence_ITEM(__pyx_t_1, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); #endif } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_13); __Pyx_INCREF(__pyx_t_12); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_14); __Pyx_INCREF(__pyx_t_13); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 56, __pyx_L1_error) #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_2, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = PySequence_ITEM(__pyx_t_1, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); #endif } } else { - __pyx_t_12 = __pyx_t_14(__pyx_t_2); - if (unlikely(!__pyx_t_12)) { + __pyx_t_13 = __pyx_t_15(__pyx_t_1); + if (unlikely(!__pyx_t_13)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); @@ -13326,32 +13352,32 @@ if (!__Pyx_RefNanny) { } break; } - __Pyx_GOTREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_t_13); } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_12) < 0) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_x); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_13) < 0) __PYX_ERR(0, 56, __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, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s__13); - __Pyx_GIVEREF(__pyx_n_s__13); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s__13); - __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __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_INCREF(__pyx_n_s__14); + __Pyx_GIVEREF(__pyx_n_s__14); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__14); + __pyx_t_12 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_sas, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; /* "pyreadstat/_readstat_writer.pyx":57 * @@ -13360,52 +13386,52 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_12 = PyList_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = __Pyx_PyInt_From_long((0x7A + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_From_long((0x7A + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_97); __Pyx_GIVEREF(__pyx_int_97); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_97); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5); __pyx_t_13 = 0; - __pyx_t_14 = NULL; + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_97); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_14 = 0; + __pyx_t_15 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_14 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_14 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 57, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_14)) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_5)) break; + if (likely(!__pyx_t_15)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_13); __Pyx_INCREF(__pyx_t_2); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 57, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_13); __Pyx_INCREF(__pyx_t_2); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 57, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_5, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_2 = __pyx_t_14(__pyx_t_5); - if (unlikely(!__pyx_t_2)) { + __pyx_t_1 = __pyx_t_15(__pyx_t_4); + if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); @@ -13413,33 +13439,33 @@ if (!__Pyx_RefNanny) { } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_2) < 0) __PYX_ERR(0, 57, __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, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_x, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_12, (PyObject*)__pyx_t_13))) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_10pyreadstat_16_readstat_writer_valid_user_missing_stata, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; /* "pyreadstat/_readstat_writer.pyx":1 * # cython: c_string_type=unicode, c_string_encoding=utf8, language_level=2 # <<<<<<<<<<<<<< * # ###cython: profile=True * # ############################################################################# */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_12) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; /*--- Wrapped vars code ---*/ @@ -13457,6 +13483,7 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init pyreadstat._readstat_writer", __pyx_clineno, __pyx_lineno, __pyx_filename); diff --git a/pyreadstat/_readstat_writer.pyx b/pyreadstat/_readstat_writer.pyx index 56b3261..451fb39 100644 --- a/pyreadstat/_readstat_writer.pyx +++ b/pyreadstat/_readstat_writer.pyx @@ -36,7 +36,7 @@ cdef set int_types = {int, np.dtype('int32'), np.dtype('int16'), np.dtype('int8' 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.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} + np.dtype('float32'), np.int64, np.uint64, np.uint32, np.float, pd.Int64Dtype(), pd.UInt32Dtype(), pd.UInt64Dtype()} 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} cdef set nat_types = {datetime.datetime, np.datetime64, pd._libs.tslibs.timestamps.Timestamp, datetime.time, datetime.date} @@ -197,7 +197,6 @@ cdef list get_pandas_column_types(object df, dict missing_user_values): # 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)) elif col_type in float_types: diff --git a/setup.py b/setup.py index 91b85a4..cf31231 100644 --- a/setup.py +++ b/setup.py @@ -136,7 +136,7 @@ setup( name='pyreadstat', - version='1.0.5', + version='1.0.6', description=short_description, author="Otto Fajardo", author_email="pleasecontactviagithub@notvalid.com", diff --git a/src/CKHashTable.c b/src/CKHashTable.c index 96ad773..bf826dc 100644 --- a/src/CKHashTable.c +++ b/src/CKHashTable.c @@ -1,84 +1,150 @@ // CKHashTable - A simple hash table -// Copyright 2010 Evan Miller (see LICENSE) +// Copyright 2010-2020 Evan Miller (see LICENSE) #include "CKHashTable.h" + +/* + SipHash reference C implementation + + Copyright (c) 2012 Jean-Philippe Aumasson + Copyright (c) 2012 Daniel J. Bernstein + + To the extent possible under law, the author(s) have dedicated all copyright + and related and neighboring rights to this software to the public domain + worldwide. This software is distributed without any warranty. + + You should have received a copy of the CC0 Public Domain Dedication along with + this software. If not, see . + */ +#include #include #include +typedef uint64_t u64; +typedef uint32_t u32; +typedef uint8_t u8; -int ck_str_n_hash_insert(const char *key, size_t keylen, const void *value, ck_hash_table_t *table); -const void *ck_str_n_hash_lookup(const char *key, size_t keylen, ck_hash_table_t *table); -static inline void ck_float2str(float key, char keystr[6]); -static inline void ck_double2str(double key, char keystr[11]); -inline uint64_t ck_hash_str(const char *str) -{ - uint64_t hash = 5381; - int c; - - while ((c = *str++)) - hash = ((hash << 5) + hash) + c; - - return hash; -} +#define ROTL(x,b) (u64)( ((x) << (b)) | ( (x) >> (64 - (b))) ) -static inline void ck_float2str(float key, char keystr[6]) { - memcpy(keystr, &key, 4); - keystr[4] = (0xF0 | (keystr[0] & 0x01) | (keystr[1] & 0x02) | (keystr[2] & 0x04) | (keystr[3] & 0x08)); - keystr[0] |= 0x01; - keystr[1] |= 0x02; - keystr[2] |= 0x04; - keystr[3] |= 0x08; +#define U32TO8_LE(p, v) \ +(p)[0] = (u8)((v) ); (p)[1] = (u8)((v) >> 8); \ +(p)[2] = (u8)((v) >> 16); (p)[3] = (u8)((v) >> 24); + +#define U64TO8_LE(p, v) \ +U32TO8_LE((p), (u32)((v) )); \ +U32TO8_LE((p) + 4, (u32)((v) >> 32)); + +#define U8TO64_LE(p) \ +(((u64)((p)[0]) ) | \ +((u64)((p)[1]) << 8) | \ +((u64)((p)[2]) << 16) | \ +((u64)((p)[3]) << 24) | \ +((u64)((p)[4]) << 32) | \ +((u64)((p)[5]) << 40) | \ +((u64)((p)[6]) << 48) | \ +((u64)((p)[7]) << 56)) + +#define SIPROUND \ +do { \ +v0 += v1; v1=ROTL(v1,13); v1 ^= v0; v0=ROTL(v0,32); \ +v2 += v3; v3=ROTL(v3,16); v3 ^= v2; \ +v0 += v3; v3=ROTL(v3,21); v3 ^= v0; \ +v2 += v1; v1=ROTL(v1,17); v1 ^= v2; v2=ROTL(v2,32); \ +} while(0) + +/* SipHash-1-2 */ +static int siphash( unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k ) +{ + /* "somepseudorandomlygeneratedbytes" */ + u64 v0 = 0x736f6d6570736575ULL; + u64 v1 = 0x646f72616e646f6dULL; + u64 v2 = 0x6c7967656e657261ULL; + u64 v3 = 0x7465646279746573ULL; + u64 b; + u64 k0 = U8TO64_LE( k ); + u64 k1 = U8TO64_LE( k + 8 ); + u64 m; + const u8 *end = in + inlen - ( inlen % sizeof( u64 ) ); + const int left = inlen & 7; + b = ( ( u64 )inlen ) << 56; + v3 ^= k1; + v2 ^= k0; + v1 ^= k1; + v0 ^= k0; - keystr[5] = 0x00; -} + for ( ; in != end; in += 8 ) + { + m = U8TO64_LE( in ); + + v3 ^= m; + + SIPROUND; + + v0 ^= m; + } + + switch( left ) + { + case 7: b |= ( ( u64 )in[ 6] ) << 48; + + case 6: b |= ( ( u64 )in[ 5] ) << 40; + + case 5: b |= ( ( u64 )in[ 4] ) << 32; + + case 4: b |= ( ( u64 )in[ 3] ) << 24; + + case 3: b |= ( ( u64 )in[ 2] ) << 16; + + case 2: b |= ( ( u64 )in[ 1] ) << 8; + + case 1: b |= ( ( u64 )in[ 0] ); break; + + case 0: break; + } -static inline void ck_double2str(double key, char keystr[11]) { - memcpy(keystr, &key, 8); - keystr[8] = (0xF0 | (keystr[0] & 0x01) | (keystr[1] & 0x02) | (keystr[2] & 0x04) | (keystr[3] & 0x08)); - keystr[0] |= 0x01; - keystr[1] |= 0x02; - keystr[2] |= 0x04; - keystr[3] |= 0x08; + v3 ^= b; + + SIPROUND; - keystr[9] = (0xF0 | (keystr[4] & 0x01) | (keystr[5] & 0x02) | (keystr[6] & 0x04) | (keystr[7] & 0x08)); - keystr[4] |= 0x01; - keystr[5] |= 0x02; - keystr[6] |= 0x04; - keystr[7] |= 0x08; + v0 ^= b; + v2 ^= 0xff; - keystr[10] = 0x00; + SIPROUND; + SIPROUND; + + b = v0 ^ v1 ^ v2 ^ v3; + U64TO8_LE( out, b ); + return 0; +} + +static uint64_t ck_hash_str(const char *str, size_t keylen) +{ + uint64_t hash; + unsigned char k[16] = { 0 }; + siphash((unsigned char *)&hash, (const unsigned char *)str, keylen, k); + return hash; } const void *ck_float_hash_lookup(float key, ck_hash_table_t *table) { - char keystr[6]; - ck_float2str(key, keystr); - return ck_str_n_hash_lookup(keystr, 5, table); + return ck_str_n_hash_lookup((const char *)&key, sizeof(float), table); } int ck_float_hash_insert(float key, const void *value, ck_hash_table_t *table) { - char keystr[6]; - ck_float2str(key, keystr); - return ck_str_n_hash_insert(keystr, 5, value, table); + return ck_str_n_hash_insert((const char *)&key, sizeof(float), value, table); } const void *ck_double_hash_lookup(double key, ck_hash_table_t *table) { - char keystr[11]; - ck_double2str(key, keystr); - return ck_str_n_hash_lookup(keystr, 10, table); + return ck_str_n_hash_lookup((const char *)&key, sizeof(double), table); } int ck_double_hash_insert(double key, const void *value, ck_hash_table_t *table) { - char keystr[11]; - ck_double2str(key, keystr); - return ck_str_n_hash_insert(keystr, 10, value, table); + return ck_str_n_hash_insert((const char *)&key, sizeof(double), value, table); } const void *ck_str_hash_lookup(const char *key, ck_hash_table_t *table) { size_t keylen = strlen(key); - if (keylen >= CK_HASH_KEY_SIZE) - keylen = CK_HASH_KEY_SIZE-1; return ck_str_n_hash_lookup(key, keylen, table); } @@ -87,36 +153,65 @@ const void *ck_str_n_hash_lookup(const char *key, size_t keylen, ck_hash_table_t if (table->count == 0) return NULL; - if (keylen == 0 || keylen >= CK_HASH_KEY_SIZE) + if (keylen == 0) return NULL; - uint64_t hash_key = ck_hash_str(key); + uint64_t hash_key = ck_hash_str(key, keylen); hash_key %= table->capacity; - uint64_t end = (hash_key - 1) % table->capacity; - while (hash_key != end && table->entries[hash_key].key[0] != '\0') { - if (strncmp(table->entries[hash_key].key, key, keylen + 1) == 0) { + uint64_t end = hash_key; + do { + char *this_key = &table->keys[table->entries[hash_key].key_offset]; + size_t this_keylen = table->entries[hash_key].key_length; + if (this_keylen == 0) + return NULL; + if (this_keylen == keylen && memcmp(this_key, key, keylen) == 0) { return table->entries[hash_key].value; } hash_key++; hash_key %= table->capacity; - } + } while (hash_key != end); return NULL; } int ck_str_hash_insert(const char *key, const void *value, ck_hash_table_t *table) { size_t keylen = strlen(key); - if (keylen >= CK_HASH_KEY_SIZE) - keylen = CK_HASH_KEY_SIZE-1; return ck_str_n_hash_insert(key, keylen, value, table); } +static int ck_hash_insert_nocopy(off_t key_offset, size_t keylen, uint64_t hash_key, + const void *value, ck_hash_table_t *table) +{ + if (table->capacity == 0) + return 0; + + hash_key %= table->capacity; + uint64_t end = (hash_key + table->capacity - 1) % table->capacity; + while (hash_key != end) { + ck_hash_entry_t *entry = &table->entries[hash_key]; + if (table->entries[hash_key].key_length == 0) { + table->count++; + entry->key_offset = key_offset; + entry->key_length = keylen; + entry->value = value; + return 1; + } else if (entry->key_length == keylen && + entry->key_offset == key_offset) { + entry->value = value; + return 1; + } + hash_key++; + hash_key %= table->capacity; + } + return 0; +} + int ck_str_n_hash_insert(const char *key, size_t keylen, const void *value, ck_hash_table_t *table) { if (table->capacity == 0) return 0; - if (keylen == 0 || keylen >= CK_HASH_KEY_SIZE) + if (keylen == 0) return 0; if (table->count >= 0.75 * table->capacity) { @@ -125,48 +220,69 @@ int ck_str_n_hash_insert(const char *key, size_t keylen, const void *value, ck_h } } - uint64_t hash_key = ck_hash_str(key); + uint64_t hash_key = ck_hash_str(key, keylen); hash_key %= table->capacity; - uint64_t end = hash_key ? ((hash_key - 1) % table->capacity) : (table->capacity -1); - while (hash_key != end) { - if (table->entries[hash_key].key[0] == '\0') { + uint64_t end = hash_key; + do { + ck_hash_entry_t *entry = &table->entries[hash_key]; + char *this_key = &table->keys[entry->key_offset]; + if (entry->key_length == 0) { table->count++; - } - if (table->entries[hash_key].key[0] == '\0' || - strncmp(table->entries[hash_key].key, key, keylen + 1) == 0) { - memcpy(table->entries[hash_key].key, key, keylen); - memset(table->entries[hash_key].key + keylen, 0, 1); + while (table->keys_used + keylen > table->keys_capacity) { + table->keys_capacity *= 2; + table->keys = realloc(table->keys, table->keys_capacity); + } + memcpy(table->keys + table->keys_used, key, keylen); + entry->key_offset = table->keys_used; + entry->key_length = keylen; + table->keys_used += keylen; + entry->value = value; + return 1; + } else if (entry->key_length == keylen && + memcmp(this_key, key, keylen) == 0) { table->entries[hash_key].value = value; return 1; } hash_key++; hash_key %= table->capacity; - } + } while (hash_key != end); return 0; } -ck_hash_table_t *ck_hash_table_init(size_t size) +ck_hash_table_t *ck_hash_table_init(size_t num_entries, size_t mean_key_length) { ck_hash_table_t *table; if ((table = malloc(sizeof(ck_hash_table_t))) == NULL) return NULL; - size *= 2; - if ((table->entries = malloc(size * sizeof(ck_hash_entry_t))) == NULL) { + + if ((table->keys = malloc(num_entries * mean_key_length)) == NULL) { free(table); return NULL; } - table->capacity = size; - table->count = 0; + table->keys_capacity = num_entries * mean_key_length; + + num_entries *= 2; + + if ((table->entries = malloc(num_entries * sizeof(ck_hash_entry_t))) == NULL) { + free(table->keys); + free(table); + return NULL; + } + table->capacity = num_entries; ck_hash_table_wipe(table); return table; } void ck_hash_table_free(ck_hash_table_t *table) { free(table->entries); + if (table->keys) + free(table->keys); free(table); } void ck_hash_table_wipe(ck_hash_table_t *table) { + table->keys_used = 0; + table->count = 0; memset(table->entries, 0, table->capacity * sizeof(ck_hash_entry_t)); } @@ -174,15 +290,17 @@ int ck_hash_table_grow(ck_hash_table_t *table) { ck_hash_entry_t *old_entries = table->entries; uint64_t old_capacity = table->capacity; uint64_t new_capacity = 2 * table->capacity; - int i; if ((table->entries = calloc(new_capacity, sizeof(ck_hash_entry_t))) == NULL) { return -1; } table->capacity = new_capacity; table->count = 0; - for (i=0; ikeys[old_entries[i].key_offset]; + uint64_t hash_key = ck_hash_str(this_key, old_entries[i].key_length); + if (!ck_hash_insert_nocopy(old_entries[i].key_offset, old_entries[i].key_length, + hash_key, old_entries[i].value, table)) return -1; } } diff --git a/src/CKHashTable.h b/src/CKHashTable.h index 81ea714..337f678 100644 --- a/src/CKHashTable.h +++ b/src/CKHashTable.h @@ -1,33 +1,37 @@ // CKHashTable - A simple hash table -// Copyright 2010 Evan Miller (see LICENSE) +// Copyright 2010-2020 Evan Miller (see LICENSE) -#include #include - -#define CK_HASH_KEY_SIZE 128 +#include typedef struct ck_hash_entry_s { - char key[CK_HASH_KEY_SIZE]; + off_t key_offset; + size_t key_length; const void *value; } ck_hash_entry_t; typedef struct ck_hash_table_s { - uint64_t capacity; - uint64_t count; + size_t capacity; + size_t count; ck_hash_entry_t *entries; + char *keys; + size_t keys_used; + size_t keys_capacity; } ck_hash_table_t; int ck_str_hash_insert(const char *key, const void *value, ck_hash_table_t *table); const void *ck_str_hash_lookup(const char *key, ck_hash_table_t *table); +int ck_str_n_hash_insert(const char *key, size_t keylen, const void *value, ck_hash_table_t *table); +const void *ck_str_n_hash_lookup(const char *key, size_t keylen, ck_hash_table_t *table); + int ck_float_hash_insert(float key, const void *value, ck_hash_table_t *table); const void *ck_float_hash_lookup(float key, ck_hash_table_t *table); int ck_double_hash_insert(double key, const void *value, ck_hash_table_t *table); const void *ck_double_hash_lookup(double key, ck_hash_table_t *table); -ck_hash_table_t *ck_hash_table_init(size_t size); +ck_hash_table_t *ck_hash_table_init(size_t num_entries, size_t mean_key_length); void ck_hash_table_wipe(ck_hash_table_t *table); int ck_hash_table_grow(ck_hash_table_t *table); void ck_hash_table_free(ck_hash_table_t *table); -uint64_t ck_hash_str(const char *str); diff --git a/src/readstat.h b/src/readstat.h index 46066f6..ece0d37 100644 --- a/src/readstat.h +++ b/src/readstat.h @@ -295,7 +295,11 @@ typedef int (*readstat_value_label_handler)(const char *val_labels, typedef void (*readstat_error_handler)(const char *error_message, void *ctx); typedef int (*readstat_progress_handler)(double progress, void *ctx); -#if defined _WIN32 || defined __CYGWIN__ +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +typedef _off_t readstat_off_t; +#elif defined _WIN32 || defined __CYGWIN__ typedef _off64_t readstat_off_t; #elif defined _AIX typedef off64_t readstat_off_t; @@ -479,7 +483,7 @@ typedef struct readstat_writer_s { int row_count; int current_row; - char file_label[100]; + char file_label[257]; char table_name[33]; const readstat_variable_t *fweight_variable; diff --git a/src/readstat_io_unistd.c b/src/readstat_io_unistd.c index 915f205..3560291 100644 --- a/src/readstat_io_unistd.c +++ b/src/readstat_io_unistd.c @@ -1,7 +1,13 @@ #include #include -#include +#include +#if !defined(_MSC_VER) +# include +#endif +#if defined _WIN32 +# include +#endif #include "readstat.h" #include "readstat_io_unistd.h" @@ -14,13 +20,43 @@ #define UNISTD_OPEN_OPTIONS O_RDONLY #endif -#if defined _WIN32 || defined _AIX +#if defined _MSC_VER && defined WIN64 +#define lseek _lseeki64 +#elif defined _MSC_VER +#elif defined _WIN32 || defined _AIX #define lseek lseek64 #endif +int open_with_unicode(const char *path, int options) +{ +#if defined _WIN32 + const int buffer_size = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0); + + if(buffer_size <= 0) + return -1; + + wchar_t* wpath = malloc((buffer_size + 1) * sizeof(wchar_t)); + const int res = MultiByteToWideChar(CP_UTF8, 0, path, -1, wpath, buffer_size); + wpath[buffer_size] = 0; + + if(res <= 0) + { + free(wpath); + return -1; + } + + int fd = _wopen(wpath, options); + + free(wpath); + return fd; +#else + return open(path, options); +#endif +} + int unistd_open_handler(const char *path, void *io_ctx) { - int fd = open(path, UNISTD_OPEN_OPTIONS); + int fd = open_with_unicode(path, UNISTD_OPEN_OPTIONS); ((unistd_io_ctx_t*) io_ctx)->fd = fd; return fd; } diff --git a/src/readstat_strings.h b/src/readstat_strings.h new file mode 100644 index 0000000..3a5eb47 --- /dev/null +++ b/src/readstat_strings.h @@ -0,0 +1,6 @@ +#if defined(_MSC_VER) +# define strncasecmp _strnicmp +# define strcasecmp _stricmp +#else +# include +#endif diff --git a/src/readstat_writer.c b/src/readstat_writer.c index 962a36d..6ab17a2 100644 --- a/src/readstat_writer.c +++ b/src/readstat_writer.c @@ -258,9 +258,13 @@ static readstat_error_t readstat_write_repeated_byte(readstat_writer_t *writer, if (len == 0) return READSTAT_OK; - char zeros[len]; + char *zeros = malloc(len); + memset(zeros, byte, len); - return readstat_write_bytes(writer, zeros, len); + readstat_error_t error = readstat_write_bytes(writer, zeros, len); + + free(zeros); + return error; } readstat_error_t readstat_write_zeros(readstat_writer_t *writer, size_t len) { diff --git a/src/sas/readstat_sas.c b/src/sas/readstat_sas.c index 7e3ffc7..e894a8e 100644 --- a/src/sas/readstat_sas.c +++ b/src/sas/readstat_sas.c @@ -35,6 +35,7 @@ unsigned char sas7bcat_magic_number[32] = { /* This table is cobbled together from extant files and: * https://support.sas.com/documentation/cdl/en/nlsref/61893/HTML/default/viewer.htm#a002607278.htm + * https://support.sas.com/documentation/onlinedoc/dfdmstudio/2.6/dmpdmsug/Content/dfU_Encodings_SAS.html * * Discrepancies form the official documentation are noted with a comment. It * appears that in some instances that SAS software uses a newer encoding than @@ -56,13 +57,25 @@ static readstat_charset_entry_t _charset_table[] = { { .code = 37, .name = "ISO-8859-9" }, { .code = 39, .name = "ISO-8859-11" }, { .code = 40, .name = "ISO-8859-15" }, - { .code = 43, .name = "CP437" }, - { .code = 44, .name = "CP850" }, - { .code = 45, .name = "CP852" }, - { .code = 46, .name = "CP858" }, - { .code = 47, .name = "CP862" }, - { .code = 51, .name = "CP866" }, - { .code = 58, .name = "CP857" }, + { .code = 41, .name = "CP437" }, + { .code = 42, .name = "CP850" }, + { .code = 43, .name = "CP852" }, + { .code = 44, .name = "CP857" }, + { .code = 45, .name = "CP858" }, + { .code = 46, .name = "CP862" }, + { .code = 47, .name = "CP864" }, + { .code = 48, .name = "CP865" }, + { .code = 49, .name = "CP866" }, + { .code = 50, .name = "CP869" }, + { .code = 51, .name = "CP874" }, + { .code = 52, .name = "CP921" }, + { .code = 53, .name = "CP922" }, + { .code = 54, .name = "CP1129" }, + { .code = 55, .name = "CP720" }, + { .code = 56, .name = "CP737" }, + { .code = 57, .name = "CP775" }, + { .code = 58, .name = "CP860" }, + { .code = 59, .name = "CP863" }, { .code = 60, .name = "WINDOWS-1250" }, { .code = 61, .name = "WINDOWS-1251" }, { .code = 62, .name = "WINDOWS-1252" }, @@ -99,6 +112,7 @@ static readstat_charset_entry_t _charset_table[] = { { .code = 172, .name = "ISO-2022-CN-EXT" }, { .code = 204, .name = SAS_DEFAULT_STRING_ENCODING }, // "any" in SAS { .code = 205, .name = "GB18030" }, + { .code = 227, .name = "ISO-8859-14" }, { .code = 242, .name = "ISO-8859-13" }, { .code = 245, .name = "MACCROATIAN" }, { .code = 246, .name = "MACCYRILLIC" }, @@ -189,7 +203,7 @@ readstat_error_t sas_read_header(readstat_io_t *io, sas_header_info_t *hinfo, retval = READSTAT_ERROR_UNSUPPORTED_CHARSET; goto cleanup; } - memcpy(hinfo->file_label, header_start.file_label, sizeof(header_start.file_label)); + memcpy(hinfo->table_name, header_start.table_name, sizeof(header_start.table_name)); if (io->seek(hinfo->pad1, READSTAT_SEEK_CUR, io->io_ctx) == -1) { retval = READSTAT_ERROR_SEEK; goto cleanup; @@ -317,16 +331,16 @@ readstat_error_t sas_write_header(readstat_writer_t *writer, sas_header_info_t * struct tm epoch_tm = { .tm_year = 60, .tm_mday = 1 }; time_t epoch = mktime(&epoch_tm); - memset(header_start.file_label, ' ', sizeof(header_start.file_label)); + memset(header_start.table_name, ' ', sizeof(header_start.table_name)); - size_t file_label_len = strlen(writer->file_label); - if (file_label_len > sizeof(header_start.file_label)) - file_label_len = sizeof(header_start.file_label); + size_t table_name_len = strlen(writer->table_name); + if (table_name_len > sizeof(header_start.table_name)) + table_name_len = sizeof(header_start.table_name); - if (file_label_len) { - memcpy(header_start.file_label, writer->file_label, file_label_len); + if (table_name_len) { + memcpy(header_start.table_name, writer->table_name, table_name_len); } else { - memcpy(header_start.file_label, "DATASET", sizeof("DATASET")-1); + memcpy(header_start.table_name, "DATASET", sizeof("DATASET")-1); } retval = readstat_write_bytes(writer, &header_start, sizeof(sas_header_start_t)); @@ -379,7 +393,7 @@ readstat_error_t sas_write_header(readstat_writer_t *writer, sas_header_info_t * goto cleanup; sas_header_end_t header_end = { - .host = "W32_VSPRO" + .host = "9.0401M6Linux" }; char release[sizeof(header_end.release)+1] = { 0 }; diff --git a/src/sas/readstat_sas.h b/src/sas/readstat_sas.h index 4d70768..6b80c2f 100644 --- a/src/sas/readstat_sas.h +++ b/src/sas/readstat_sas.h @@ -17,7 +17,8 @@ typedef struct sas_header_start_s { unsigned char encoding; unsigned char mystery5[13]; char file_type[8]; - char file_label[64]; + char table_name[32]; + unsigned char mystery6[32]; char file_info[8]; } sas_header_start_t; @@ -47,7 +48,8 @@ typedef struct sas_header_info_s { int64_t header_size; time_t creation_time; time_t modification_time; - char file_label[64]; + char table_name[32]; + char file_label[256]; char *encoding; } sas_header_info_t; @@ -106,6 +108,9 @@ typedef struct sas_text_ref_s { #define SAS_COMPRESSION_TRUNC 0x01 #define SAS_COMPRESSION_ROW 0x04 +#define SAS_COMPRESSION_SIGNATURE_RLE "SASYZCRL" +#define SAS_COMPRESSION_SIGNATURE_RDC "SASYZCR2" + #define SAS_DEFAULT_FILE_VERSION 9 extern unsigned char sas7bdat_magic_number[32]; diff --git a/src/sas/readstat_sas7bcat_read.c b/src/sas/readstat_sas7bcat_read.c index 77f16bd..968d968 100644 --- a/src/sas/readstat_sas7bcat_read.c +++ b/src/sas/readstat_sas7bcat_read.c @@ -51,6 +51,7 @@ static readstat_error_t sas7bcat_parse_value_labels(const char *value_start, siz /* Doubles appear to be stored as big-endian, always */ int bswap_doubles = machine_is_little_endian(); int is_string = (name[0] == '$'); + char *label = NULL; if (value_offset == NULL) { retval = READSTAT_ERROR_MALLOC; @@ -117,8 +118,8 @@ static readstat_error_t sas7bcat_parse_value_labels(const char *value_start, siz goto cleanup; } if (ctx->value_label_handler) { - char label[4*label_len+1]; - retval = readstat_convert(label, sizeof(label), + label = realloc(label, 4 * label_len + 1); + retval = readstat_convert(label, 4 * label_len + 1, &lbp2[10], label_len, ctx->converter); if (retval != READSTAT_OK) goto cleanup; @@ -133,9 +134,8 @@ static readstat_error_t sas7bcat_parse_value_labels(const char *value_start, siz } cleanup: - if (value_offset) - free(value_offset); - + free(label); + free(value_offset); return retval; } @@ -415,7 +415,7 @@ readstat_error_t readstat_parse_sas7bcat(readstat_parser_t *parser, const char * } if (ctx->metadata_handler) { - char file_label[4*64+1]; + char table_name[4*32+1]; readstat_metadata_t metadata = { .file_encoding = ctx->input_encoding, /* orig encoding? */ .modified_time = hinfo->modification_time, @@ -424,12 +424,12 @@ readstat_error_t readstat_parse_sas7bcat(readstat_parser_t *parser, const char * .endianness = hinfo->little_endian ? READSTAT_ENDIAN_LITTLE : READSTAT_ENDIAN_BIG, .is64bit = ctx->u64 }; - retval = readstat_convert(file_label, sizeof(file_label), - hinfo->file_label, sizeof(hinfo->file_label), ctx->converter); + retval = readstat_convert(table_name, sizeof(table_name), + hinfo->table_name, sizeof(hinfo->table_name), ctx->converter); if (retval != READSTAT_OK) goto cleanup; - metadata.file_label = file_label; + metadata.table_name = table_name; if (ctx->metadata_handler(&metadata, ctx->user_ctx) != READSTAT_HANDLER_OK) { retval = READSTAT_ERROR_USER_ABORT; diff --git a/src/sas/readstat_sas7bdat_read.c b/src/sas/readstat_sas7bdat_read.c index bf88bfa..b7ff18c 100644 --- a/src/sas/readstat_sas7bdat_read.c +++ b/src/sas/readstat_sas7bdat_read.c @@ -11,9 +11,6 @@ #include "../readstat_convert.h" #include "../readstat_malloc.h" -#define SAS_COMPRESSION_SIGNATURE_RLE "SASYZCRL" -#define SAS_COMPRESSION_SIGNATURE_RDC "SASYZCR2" - typedef struct col_info_s { sas_text_ref_t name_ref; sas_text_ref_t format_ref; @@ -85,7 +82,8 @@ typedef struct sas7bdat_ctx_s { time_t ctime; time_t mtime; int version; - char file_label[4*64+1]; + char table_name[4*32+1]; + char file_label[4*256+1]; char error_buf[2048]; unsigned int rdc_compression:1; @@ -130,6 +128,34 @@ static readstat_error_t sas7bdat_update_progress(sas7bdat_ctx_t *ctx) { return io->update(ctx->file_size, ctx->handle.progress, ctx->user_ctx, io->io_ctx); } +static sas_text_ref_t sas7bdat_parse_text_ref(const char *data, sas7bdat_ctx_t *ctx) { + sas_text_ref_t ref; + + ref.index = sas_read2(&data[0], ctx->bswap); + ref.offset = sas_read2(&data[2], ctx->bswap); + ref.length = sas_read2(&data[4], ctx->bswap); + + return ref; +} + +static readstat_error_t sas7bdat_copy_text_ref(char *out_buffer, size_t out_buffer_len, sas_text_ref_t text_ref, sas7bdat_ctx_t *ctx) { + if (text_ref.index >= ctx->text_blob_count) + return READSTAT_ERROR_PARSE; + + if (text_ref.length == 0) { + out_buffer[0] = '\0'; + return READSTAT_OK; + } + + char *blob = ctx->text_blobs[text_ref.index]; + + if (text_ref.offset + text_ref.length > ctx->text_blob_lengths[text_ref.index]) + return READSTAT_ERROR_PARSE; + + return readstat_convert(out_buffer, out_buffer_len, &blob[text_ref.offset], text_ref.length, + ctx->converter); +} + static readstat_error_t sas7bdat_parse_column_text_subheader(const char *subheader, size_t len, sas7bdat_ctx_t *ctx) { readstat_error_t retval = READSTAT_OK; size_t signature_len = ctx->subheader_signature_size; @@ -156,12 +182,6 @@ static readstat_error_t sas7bdat_parse_column_text_subheader(const char *subhead ctx->text_blob_lengths[ctx->text_blob_count-1] = len-signature_len; ctx->text_blobs[ctx->text_blob_count-1] = blob; - /* another bit of a hack */ - if (len-signature_len > 12 + sizeof(SAS_COMPRESSION_SIGNATURE_RDC)-1 && - strncmp(blob + 12, SAS_COMPRESSION_SIGNATURE_RDC, sizeof(SAS_COMPRESSION_SIGNATURE_RDC)-1) == 0) { - ctx->rdc_compression = 1; - } - cleanup: return retval; } @@ -179,7 +199,6 @@ static readstat_error_t sas7bdat_realloc_col_info(sas7bdat_ctx_t *ctx, size_t co return READSTAT_OK; } - static readstat_error_t sas7bdat_parse_column_size_subheader(const char *subheader, size_t len, sas7bdat_ctx_t *ctx) { uint64_t col_count; readstat_error_t retval = READSTAT_OK; @@ -213,7 +232,7 @@ static readstat_error_t sas7bdat_parse_row_size_subheader(const char *subheader, uint64_t total_row_count; uint64_t row_length, page_row_count; - if (len < (ctx->u64 ? 128 : 64)) { + if (len < (ctx->u64 ? 250: 190)) { retval = READSTAT_ERROR_PARSE; goto cleanup; } @@ -228,6 +247,24 @@ static readstat_error_t sas7bdat_parse_row_size_subheader(const char *subheader, page_row_count = sas_read4(&subheader[60], ctx->bswap); } + sas_text_ref_t file_label_ref = sas7bdat_parse_text_ref(&subheader[len-130], ctx); + if (file_label_ref.length) { + if ((retval = sas7bdat_copy_text_ref(ctx->file_label, sizeof(ctx->file_label), + file_label_ref, ctx)) != READSTAT_OK) { + goto cleanup; + } + } + + sas_text_ref_t compression_ref = sas7bdat_parse_text_ref(&subheader[len-118], ctx); + if (compression_ref.length) { + char compression[9]; + if ((retval = sas7bdat_copy_text_ref(compression, sizeof(compression), + compression_ref, ctx)) != READSTAT_OK) { + goto cleanup; + } + ctx->rdc_compression = (memcmp(compression, SAS_COMPRESSION_SIGNATURE_RDC, 8) == 0); + } + ctx->row_length = row_length; ctx->row = readstat_realloc(ctx->row, ctx->row_length); if (ctx->row == NULL) { @@ -250,34 +287,6 @@ static readstat_error_t sas7bdat_parse_row_size_subheader(const char *subheader, return retval; } -static sas_text_ref_t sas7bdat_parse_text_ref(const char *data, sas7bdat_ctx_t *ctx) { - sas_text_ref_t ref; - - ref.index = sas_read2(&data[0], ctx->bswap); - ref.offset = sas_read2(&data[2], ctx->bswap); - ref.length = sas_read2(&data[4], ctx->bswap); - - return ref; -} - -static readstat_error_t sas7bdat_copy_text_ref(char *out_buffer, size_t out_buffer_len, sas_text_ref_t text_ref, sas7bdat_ctx_t *ctx) { - if (text_ref.index >= ctx->text_blob_count) - return READSTAT_ERROR_PARSE; - - if (text_ref.length == 0) { - out_buffer[0] = '\0'; - return READSTAT_OK; - } - - char *blob = ctx->text_blobs[text_ref.index]; - - if (text_ref.offset + text_ref.length > ctx->text_blob_lengths[text_ref.index]) - return READSTAT_ERROR_PARSE; - - return readstat_convert(out_buffer, out_buffer_len, &blob[text_ref.offset], text_ref.length, - ctx->converter); -} - static readstat_error_t sas7bdat_parse_column_name_subheader(const char *subheader, size_t len, sas7bdat_ctx_t *ctx) { readstat_error_t retval = READSTAT_OK; size_t signature_len = ctx->subheader_signature_size; @@ -712,6 +721,7 @@ static readstat_error_t sas7bdat_submit_columns(sas7bdat_ctx_t *ctx, int compres readstat_metadata_t metadata = { .row_count = ctx->row_limit, .var_count = ctx->column_count, + .table_name = ctx->table_name, .file_label = ctx->file_label, .file_encoding = ctx->input_encoding, /* orig encoding? */ .creation_time = ctx->ctime, @@ -963,7 +973,7 @@ static readstat_error_t sas7bdat_parse_page_pass2(const char *page, size_t page_ * some files created by Stat/Transfer don't. So verify that the * padding is { 0, 0, 0, 0 } or { ' ', ' ', ' ', ' ' } (or that * the file is not from Stat/Transfer) before skipping it */ - if ((shp-page)%8 == 4 && + if ((shp-page)%8 == 4 && shp + 4 <= page + page_size && (*(uint32_t *)shp == 0x00000000 || *(uint32_t *)shp == 0x20202020 || ctx->vendor != READSTAT_VENDOR_STAT_TRANSFER)) { @@ -1219,8 +1229,8 @@ readstat_error_t readstat_parse_sas7bdat(readstat_parser_t *parser, const char * ctx->converter = converter; } - if ((retval = readstat_convert(ctx->file_label, sizeof(ctx->file_label), - hinfo->file_label, sizeof(hinfo->file_label), ctx->converter)) != READSTAT_OK) { + if ((retval = readstat_convert(ctx->table_name, sizeof(ctx->table_name), + hinfo->table_name, sizeof(hinfo->table_name), ctx->converter)) != READSTAT_OK) { goto cleanup; } diff --git a/src/sas/readstat_sas7bdat_write.c b/src/sas/readstat_sas7bdat_write.c index 19467ab..a277b9c 100644 --- a/src/sas/readstat_sas7bdat_write.c +++ b/src/sas/readstat_sas7bdat_write.c @@ -140,7 +140,7 @@ static readstat_error_t sas7bdat_emit_header(readstat_writer_t *writer, sas_head .file_format = SAS_FILE_FORMAT_UNIX, .encoding = 20, /* UTF-8 */ .file_type = "SAS FILE", - .file_info = "DATA ~ ~" + .file_info = "DATA " }; memcpy(&header_start.magic, sas7bdat_magic_number, sizeof(header_start.magic)); @@ -158,7 +158,7 @@ static sas7bdat_subheader_t *sas7bdat_subheader_init(uint32_t signature, size_t } static sas7bdat_subheader_t *sas7bdat_row_size_subheader_init(readstat_writer_t *writer, - sas_header_info_t *hinfo) { + sas_header_info_t *hinfo, sas7bdat_column_text_array_t *column_text_array) { sas7bdat_subheader_t *subheader = sas7bdat_subheader_init( SAS_SUBHEADER_SIGNATURE_ROW_SIZE, hinfo->u64 ? 808 : 480); @@ -187,6 +187,18 @@ static sas7bdat_subheader_t *sas7bdat_row_size_subheader_init(readstat_writer_t memset(&subheader->data[64], 0xFF, 8); } + sas_text_ref_t text_ref = { 0 }; + + if (writer->file_label[0]) { + text_ref = sas7bdat_make_text_ref(column_text_array, writer->file_label); + memcpy(&subheader->data[subheader->len-130], &text_ref, sizeof(sas_text_ref_t)); + } + + if (writer->compression == READSTAT_COMPRESS_ROWS) { + text_ref = sas7bdat_make_text_ref(column_text_array, SAS_COMPRESSION_SIGNATURE_RLE); + memcpy(&subheader->data[subheader->len-118], &text_ref, sizeof(sas_text_ref_t)); + } + return subheader; } @@ -218,17 +230,14 @@ static sas7bdat_subheader_t *sas7bdat_col_name_subheader_init(readstat_writer_t sas7bdat_subheader_t *subheader = sas7bdat_subheader_init( SAS_SUBHEADER_SIGNATURE_COLUMN_NAME, len); memcpy(&subheader->data[signature_len], &remainder, sizeof(uint16_t)); - + int i; char *ptrs = &subheader->data[signature_len+8]; for (i=0; ivariables_count; i++) { readstat_variable_t *variable = readstat_get_variable(writer, i); const char *name = readstat_variable_get_name(variable); sas_text_ref_t text_ref = sas7bdat_make_text_ref(column_text_array, name); - memcpy(&ptrs[0], &text_ref.index, sizeof(uint16_t)); - memcpy(&ptrs[2], &text_ref.offset, sizeof(uint16_t)); - memcpy(&ptrs[4], &text_ref.length, sizeof(uint16_t)); - + memcpy(ptrs, &text_ref, sizeof(sas_text_ref_t)); ptrs += 8; } return subheader; @@ -347,7 +356,7 @@ static sas7bdat_subheader_array_t *sas7bdat_subheader_array_init(readstat_writer col_name_subheader = sas7bdat_col_name_subheader_init(writer, hinfo, column_text_array); col_attrs_subheader = sas7bdat_col_attrs_subheader_init(writer, hinfo); - sarray->subheaders[idx++] = sas7bdat_row_size_subheader_init(writer, hinfo); + sarray->subheaders[idx++] = sas7bdat_row_size_subheader_init(writer, hinfo, column_text_array); sarray->subheaders[idx++] = sas7bdat_col_size_subheader_init(writer, hinfo); col_format_subheaders = calloc(writer->variables_count, sizeof(sas7bdat_subheader_t *)); @@ -699,11 +708,11 @@ static readstat_error_t sas7bdat_write_row_uncompressed(readstat_writer_t *write int16_t page_row_count = (writer->row_count - writer->current_row < rows_per_page ? writer->row_count - writer->current_row : rows_per_page); - char header[hinfo->page_header_size]; - memset(header, 0, sizeof(header)); + char *header = calloc(hinfo->page_header_size, 1); memcpy(&header[hinfo->page_header_size-6], &page_row_count, sizeof(int16_t)); memcpy(&header[hinfo->page_header_size-8], &page_type, sizeof(int16_t)); retval = readstat_write_bytes(writer, header, hinfo->page_header_size); + free(header); if (retval != READSTAT_OK) goto cleanup; } diff --git a/src/sas/readstat_sas_rle.c b/src/sas/readstat_sas_rle.c index 354da34..adb0289 100644 --- a/src/sas/readstat_sas_rle.c +++ b/src/sas/readstat_sas_rle.c @@ -3,6 +3,11 @@ #include #include +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif + #include "readstat_sas_rle.h" #define SAS_RLE_COMMAND_COPY64 0 diff --git a/src/sas/readstat_xport_read.c b/src/sas/readstat_xport_read.c index eebcd0d..f9349f2 100644 --- a/src/sas/readstat_xport_read.c +++ b/src/sas/readstat_xport_read.c @@ -32,7 +32,7 @@ typedef struct xport_ctx_s { int row_offset; size_t row_length; int parsed_row_count; - char file_label[40*4+1]; + char file_label[256*4+1]; char table_name[32*4+1]; readstat_variable_t **variables; @@ -280,10 +280,13 @@ static readstat_error_t xport_read_obs_header_record(xport_ctx_t *ctx) { static readstat_error_t xport_construct_format(char *dst, size_t dst_len, const char *src, size_t src_len, int width, int decimals) { - char format[4*src_len+1]; - readstat_error_t retval = readstat_convert(format, sizeof(format), src, src_len, NULL); - if (retval != READSTAT_OK) + char *format = malloc(4 * src_len + 1); + readstat_error_t retval = readstat_convert(format, 4 * src_len + 1, src, src_len, NULL); + + if (retval != READSTAT_OK) { + free(format); return retval; + } if (!format[0]) { *dst = '\0'; @@ -297,12 +300,15 @@ static readstat_error_t xport_construct_format(char *dst, size_t dst_len, snprintf(dst, dst_len, "%s", format); } + free(format); return retval; } static readstat_error_t xport_read_labels_v8(xport_ctx_t *ctx, int label_count) { readstat_error_t retval = READSTAT_OK; uint16_t labeldef[3]; + char *name = NULL; + char *label = NULL; int i; for (i=0; ivariables[index-1]; if (read_bytes(ctx, name, name_len) != name_len || @@ -356,6 +362,8 @@ static readstat_error_t xport_read_labels_v8(xport_ctx_t *ctx, int label_count) goto cleanup; cleanup: + free(name); + free(label); return retval; } @@ -363,6 +371,11 @@ static readstat_error_t xport_read_labels_v9(xport_ctx_t *ctx, int label_count) readstat_error_t retval = READSTAT_OK; uint16_t labeldef[5]; int i; + char *name = NULL; + char *format = NULL; + char *informat = NULL; + char *label = NULL; + for (i=0; ivariables[index-1]; @@ -429,6 +442,10 @@ static readstat_error_t xport_read_labels_v9(xport_ctx_t *ctx, int label_count) goto cleanup; cleanup: + free(name); + free(format); + free(informat); + free(label); return retval; } diff --git a/src/sas/readstat_xport_write.c b/src/sas/readstat_xport_write.c index 2ba6b86..0d6360a 100644 --- a/src/sas/readstat_xport_write.c +++ b/src/sas/readstat_xport_write.c @@ -12,6 +12,10 @@ #define XPORT_DEFAULT_VERISON 8 #define RECORD_LEN 80 +#if defined _MSC_VER +#define restrict __restrict +#endif + static void copypad(char * restrict dst, size_t dst_len, const char * restrict src) { char *dst_end = dst + dst_len; while (dst < dst_end && *src) diff --git a/src/spss/readstat_por.c b/src/spss/readstat_por.c index e922358..9c04702 100644 --- a/src/spss/readstat_por.c +++ b/src/spss/readstat_por.c @@ -69,7 +69,7 @@ por_ctx_t *por_ctx_init() { ctx->space = ' '; ctx->base30_precision = 20; - ctx->var_dict = ck_hash_table_init(1024); + ctx->var_dict = ck_hash_table_init(1024, 8); return ctx; } diff --git a/src/spss/readstat_por_read.c b/src/spss/readstat_por_read.c index 72a7e6a..44dc0f4 100644 --- a/src/spss/readstat_por_read.c +++ b/src/spss/readstat_por_read.c @@ -24,7 +24,8 @@ #define POR_LINE_LENGTH 80 #define POR_LABEL_NAME_PREFIX "labels" -#define MAX_FORMAT_TYPE 120 +#define POR_FORMAT_SHIFT 82 +#define MAX_FORMAT_TYPE (POR_FORMAT_SHIFT+SPSS_FORMAT_TYPE_YMDHMS) #define MAX_FORMAT_WIDTH 20000 #define MAX_FORMAT_DECIMALS 100 #define MAX_STRING_LENGTH 20000 @@ -337,7 +338,14 @@ static readstat_error_t read_variable_record(por_ctx_t *ctx) { if ((retval = read_integer_in_range(ctx, 0, MAX_FORMAT_TYPE, &value)) != READSTAT_OK) { goto cleanup; } - format->type = value; + if (value > POR_FORMAT_SHIFT) { + // Some files in the wild have their format types shifted by 82 for date/time values + // I have no idea why, but see test files linked from: + // /~https://github.com/WizardMac/ReadStat/issues/158 + format->type = value - POR_FORMAT_SHIFT; + } else { + format->type = value; + } if ((retval = read_integer_in_range(ctx, 0, MAX_FORMAT_WIDTH, &value)) != READSTAT_OK) { goto cleanup; diff --git a/src/spss/readstat_sav_parse.c b/src/spss/readstat_sav_parse.c index 565af8e..be17eb0 100644 --- a/src/spss/readstat_sav_parse.c +++ b/src/spss/readstat_sav_parse.c @@ -4,10 +4,15 @@ #include #include "../readstat.h" #include "../readstat_malloc.h" +#include "../readstat_strings.h" #include "readstat_sav.h" #include "readstat_sav_parse.h" + +#line 21 "src/spss/readstat_sav_parse.rl" + + typedef struct varlookup { char name[8*4+1]; int index; @@ -16,13 +21,13 @@ typedef struct varlookup { static int compare_key_varlookup(const void *elem1, const void *elem2) { const char *key = (const char *)elem1; const varlookup_t *v = (const varlookup_t *)elem2; - return strcmp(key, v->name); + return strcasecmp(key, v->name); } static int compare_varlookups(const void *elem1, const void *elem2) { const varlookup_t *v1 = (const varlookup_t *)elem1; const varlookup_t *v2 = (const varlookup_t *)elem2; - return strcmp(v1->name, v2->name); + return strcasecmp(v1->name, v2->name); } static int count_vars(sav_ctx_t *ctx) { @@ -60,180 +65,173 @@ static varlookup_t *build_lookup_table(int var_count, sav_ctx_t *ctx) { } -#line 64 "src/spss/readstat_sav_parse.c" +#line 69 "src/spss/readstat_sav_parse.c" static const char _sav_long_variable_parse_actions[] = { - 0, 1, 3, 1, 5, 2, 4, 1, - 3, 6, 2, 0 + 0, 1, 1, 1, 5, 2, 2, 0, + 3, 6, 4, 3 }; static const short _sav_long_variable_parse_key_offsets[] = { - 0, 0, 6, 20, 34, 48, 62, 76, - 90, 104, 105, 110, 116, 122, 128, 134, - 140, 146, 152, 158, 164, 170, 176, 182, - 188, 194, 200, 206, 212, 218, 224, 230, - 236, 242, 248, 254, 260, 266, 272, 278, - 284, 290, 296, 302, 308, 314, 320, 326, - 332, 338, 344, 350, 356, 362, 368, 374, - 380, 386, 392, 398, 404, 410, 416, 422, - 428, 434, 440, 446, 452, 458, 464, 470, - 476, 482, 488, 494 + 0, 0, 5, 19, 33, 47, 61, 75, + 89, 103, 104, 108, 113, 118, 123, 128, + 133, 138, 143, 148, 153, 158, 163, 168, + 173, 178, 183, 188, 193, 198, 203, 208, + 213, 218, 223, 228, 233, 238, 243, 248, + 253, 258, 263, 268, 273, 278, 283, 288, + 293, 298, 303, 308, 313, 318, 323, 328, + 333, 338, 343, 348, 353, 358, 363, 368, + 373, 378, 383, 388, 393, 398, 403, 408, + 413, 418, 423, 428 }; static const unsigned char _sav_long_variable_parse_trans_keys[] = { - 0u, 63u, 91u, 127u, 248u, 255u, 47u, 61u, - 0u, 34u, 37u, 45u, 58u, 63u, 91u, 94u, - 96u, 127u, 248u, 255u, 47u, 61u, 0u, 34u, - 37u, 45u, 58u, 63u, 91u, 94u, 96u, 127u, - 248u, 255u, 47u, 61u, 0u, 34u, 37u, 45u, - 58u, 63u, 91u, 94u, 96u, 127u, 248u, 255u, - 47u, 61u, 0u, 34u, 37u, 45u, 58u, 63u, - 91u, 94u, 96u, 127u, 248u, 255u, 47u, 61u, - 0u, 34u, 37u, 45u, 58u, 63u, 91u, 94u, - 96u, 127u, 248u, 255u, 47u, 61u, 0u, 34u, - 37u, 45u, 58u, 63u, 91u, 94u, 96u, 127u, - 248u, 255u, 47u, 61u, 0u, 34u, 37u, 45u, - 58u, 63u, 91u, 94u, 96u, 127u, 248u, 255u, - 61u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 0u, 63u, 91u, 127u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 127u, - 0u, 31u, 248u, 255u, 9u, 127u, 0u, 31u, - 248u, 255u, 9u, 127u, 0u, 31u, 248u, 255u, - 9u, 127u, 0u, 31u, 248u, 255u, 9u, 0 + 255u, 0u, 63u, 91u, 127u, 47u, 61u, 96u, + 255u, 0u, 34u, 37u, 45u, 58u, 63u, 91u, + 94u, 123u, 127u, 47u, 61u, 96u, 255u, 0u, + 34u, 37u, 45u, 58u, 63u, 91u, 94u, 123u, + 127u, 47u, 61u, 96u, 255u, 0u, 34u, 37u, + 45u, 58u, 63u, 91u, 94u, 123u, 127u, 47u, + 61u, 96u, 255u, 0u, 34u, 37u, 45u, 58u, + 63u, 91u, 94u, 123u, 127u, 47u, 61u, 96u, + 255u, 0u, 34u, 37u, 45u, 58u, 63u, 91u, + 94u, 123u, 127u, 47u, 61u, 96u, 255u, 0u, + 34u, 37u, 45u, 58u, 63u, 91u, 94u, 123u, + 127u, 47u, 61u, 96u, 255u, 0u, 34u, 37u, + 45u, 58u, 63u, 91u, 94u, 123u, 127u, 61u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 255u, 0u, 63u, 91u, 127u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 9u, 127u, 255u, 0u, 31u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 9u, 127u, 255u, 0u, 31u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 9u, 127u, 255u, 0u, 31u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 9u, 127u, 255u, 0u, 31u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 9u, 127u, 255u, 0u, 31u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 9u, 127u, 255u, 0u, 31u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 127u, 255u, 0u, + 31u, 9u, 127u, 255u, 0u, 31u, 9u, 127u, + 255u, 0u, 31u, 9u, 127u, 255u, 0u, 31u, + 9u, 127u, 255u, 0u, 31u, 9u, 127u, 255u, + 0u, 31u, 9u, 127u, 255u, 0u, 31u, 9u, + 127u, 255u, 0u, 31u, 9u, 0 }; static const char _sav_long_variable_parse_single_lengths[] = { - 0, 0, 2, 2, 2, 2, 2, 2, - 2, 1, 1, 2, 0, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1 + 0, 1, 4, 4, 4, 4, 4, 4, + 4, 1, 2, 3, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 1 }; static const char _sav_long_variable_parse_range_lengths[] = { - 0, 3, 6, 6, 6, 6, 6, 6, - 6, 0, 2, 2, 3, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 0 + 0, 2, 5, 5, 5, 5, 5, 5, + 5, 0, 1, 1, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0 }; static const short _sav_long_variable_parse_index_offsets[] = { - 0, 0, 4, 13, 22, 31, 40, 49, - 58, 67, 69, 73, 78, 82, 87, 92, - 97, 102, 107, 112, 117, 122, 127, 132, - 137, 142, 147, 152, 157, 162, 167, 172, - 177, 182, 187, 192, 197, 202, 207, 212, - 217, 222, 227, 232, 237, 242, 247, 252, - 257, 262, 267, 272, 277, 282, 287, 292, - 297, 302, 307, 312, 317, 322, 327, 332, - 337, 342, 347, 352, 357, 362, 367, 372, - 377, 382, 387, 392 + 0, 0, 4, 14, 24, 34, 44, 54, + 64, 74, 76, 80, 85, 89, 94, 99, + 104, 109, 114, 119, 124, 129, 134, 139, + 144, 149, 154, 159, 164, 169, 174, 179, + 184, 189, 194, 199, 204, 209, 214, 219, + 224, 229, 234, 239, 244, 249, 254, 259, + 264, 269, 274, 279, 284, 289, 294, 299, + 304, 309, 314, 319, 324, 329, 334, 339, + 344, 349, 354, 359, 364, 369, 374, 379, + 384, 389, 394, 399 }; static const char _sav_long_variable_parse_indicies[] = { 1, 1, 1, 0, 1, 3, 1, 1, - 1, 1, 1, 1, 2, 1, 3, 1, - 1, 1, 1, 1, 1, 4, 1, 3, - 1, 1, 1, 1, 1, 1, 5, 1, - 3, 1, 1, 1, 1, 1, 1, 6, + 1, 1, 1, 1, 1, 2, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 4, + 1, 3, 1, 1, 1, 1, 1, 1, + 1, 5, 1, 3, 1, 1, 1, 1, + 1, 1, 1, 6, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 7, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 8, 1, 3, 1, 1, 1, 1, 1, 1, - 7, 1, 3, 1, 1, 1, 1, 1, - 1, 8, 1, 3, 1, 1, 1, 1, - 1, 1, 9, 3, 1, 1, 1, 1, - 10, 11, 1, 1, 1, 12, 1, 1, - 1, 0, 11, 1, 1, 1, 13, 11, - 1, 1, 1, 14, 11, 1, 1, 1, - 15, 11, 1, 1, 1, 16, 11, 1, - 1, 1, 17, 11, 1, 1, 1, 18, - 11, 1, 1, 1, 19, 11, 1, 1, - 1, 20, 11, 1, 1, 1, 21, 11, - 1, 1, 1, 22, 11, 1, 1, 1, - 23, 11, 1, 1, 1, 24, 11, 1, - 1, 1, 25, 11, 1, 1, 1, 26, - 11, 1, 1, 1, 27, 11, 1, 1, - 1, 28, 11, 1, 1, 1, 29, 11, - 1, 1, 1, 30, 11, 1, 1, 1, - 31, 11, 1, 1, 1, 32, 11, 1, - 1, 1, 33, 11, 1, 1, 1, 34, - 11, 1, 1, 1, 35, 11, 1, 1, - 1, 36, 11, 1, 1, 1, 37, 11, - 1, 1, 1, 38, 11, 1, 1, 1, - 39, 11, 1, 1, 1, 40, 11, 1, - 1, 1, 41, 11, 1, 1, 1, 42, - 11, 1, 1, 1, 43, 11, 1, 1, - 1, 44, 11, 1, 1, 1, 45, 11, - 1, 1, 1, 46, 11, 1, 1, 1, - 47, 11, 1, 1, 1, 48, 11, 1, - 1, 1, 49, 11, 1, 1, 1, 50, - 11, 1, 1, 1, 51, 11, 1, 1, - 1, 52, 11, 1, 1, 1, 53, 11, - 1, 1, 1, 54, 11, 1, 1, 1, - 55, 11, 1, 1, 1, 56, 11, 1, - 1, 1, 57, 11, 1, 1, 1, 58, - 11, 1, 1, 1, 59, 11, 1, 1, - 1, 60, 11, 1, 1, 1, 61, 11, - 1, 1, 1, 62, 11, 1, 1, 1, - 63, 11, 1, 1, 1, 64, 11, 1, - 1, 1, 65, 11, 1, 1, 1, 66, - 11, 1, 1, 1, 67, 11, 1, 1, - 1, 68, 11, 1, 1, 1, 69, 11, - 1, 1, 1, 70, 11, 1, 1, 1, - 71, 11, 1, 1, 1, 72, 11, 1, - 1, 1, 73, 11, 1, 1, 1, 74, - 11, 1, 0 + 1, 9, 3, 1, 1, 1, 1, 10, + 11, 1, 1, 1, 12, 1, 1, 1, + 0, 11, 1, 1, 1, 13, 11, 1, + 1, 1, 14, 11, 1, 1, 1, 15, + 11, 1, 1, 1, 16, 11, 1, 1, + 1, 17, 11, 1, 1, 1, 18, 11, + 1, 1, 1, 19, 11, 1, 1, 1, + 20, 11, 1, 1, 1, 21, 11, 1, + 1, 1, 22, 11, 1, 1, 1, 23, + 11, 1, 1, 1, 24, 11, 1, 1, + 1, 25, 11, 1, 1, 1, 26, 11, + 1, 1, 1, 27, 11, 1, 1, 1, + 28, 11, 1, 1, 1, 29, 11, 1, + 1, 1, 30, 11, 1, 1, 1, 31, + 11, 1, 1, 1, 32, 11, 1, 1, + 1, 33, 11, 1, 1, 1, 34, 11, + 1, 1, 1, 35, 11, 1, 1, 1, + 36, 11, 1, 1, 1, 37, 11, 1, + 1, 1, 38, 11, 1, 1, 1, 39, + 11, 1, 1, 1, 40, 11, 1, 1, + 1, 41, 11, 1, 1, 1, 42, 11, + 1, 1, 1, 43, 11, 1, 1, 1, + 44, 11, 1, 1, 1, 45, 11, 1, + 1, 1, 46, 11, 1, 1, 1, 47, + 11, 1, 1, 1, 48, 11, 1, 1, + 1, 49, 11, 1, 1, 1, 50, 11, + 1, 1, 1, 51, 11, 1, 1, 1, + 52, 11, 1, 1, 1, 53, 11, 1, + 1, 1, 54, 11, 1, 1, 1, 55, + 11, 1, 1, 1, 56, 11, 1, 1, + 1, 57, 11, 1, 1, 1, 58, 11, + 1, 1, 1, 59, 11, 1, 1, 1, + 60, 11, 1, 1, 1, 61, 11, 1, + 1, 1, 62, 11, 1, 1, 1, 63, + 11, 1, 1, 1, 64, 11, 1, 1, + 1, 65, 11, 1, 1, 1, 66, 11, + 1, 1, 1, 67, 11, 1, 1, 1, + 68, 11, 1, 1, 1, 69, 11, 1, + 1, 1, 70, 11, 1, 1, 1, 71, + 11, 1, 1, 1, 72, 11, 1, 1, + 1, 73, 11, 1, 1, 1, 74, 11, + 1, 0 }; static const char _sav_long_variable_parse_trans_targs[] = { @@ -280,7 +278,7 @@ static const int sav_long_variable_parse_start = 1; static const int sav_long_variable_parse_en_main = 1; -#line 64 "src/spss/readstat_sav_parse.rl" +#line 79 "src/spss/readstat_sav_parse.rl" readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav_ctx_t *ctx) { @@ -304,12 +302,12 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav int cs; -#line 308 "src/spss/readstat_sav_parse.c" +#line 306 "src/spss/readstat_sav_parse.c" { cs = sav_long_variable_parse_start; } -#line 313 "src/spss/readstat_sav_parse.c" +#line 311 "src/spss/readstat_sav_parse.c" { int _klen; unsigned int _trans; @@ -384,7 +382,22 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav switch ( *_acts++ ) { case 0: -#line 87 "src/spss/readstat_sav_parse.rl" +#line 13 "src/spss/readstat_sav_parse.rl" + { + memcpy(temp_key, str_start, str_len); + temp_key[str_len] = '\0'; + } + break; + case 1: +#line 20 "src/spss/readstat_sav_parse.rl" + { str_start = p; } + break; + case 2: +#line 20 "src/spss/readstat_sav_parse.rl" + { str_len = p - str_start; } + break; + case 3: +#line 102 "src/spss/readstat_sav_parse.rl" { varlookup_t *found = bsearch(temp_key, table, var_count, sizeof(varlookup_t), &compare_key_varlookup); if (found) { @@ -397,37 +410,22 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav } } break; - case 1: -#line 99 "src/spss/readstat_sav_parse.rl" - { - memcpy(temp_key, str_start, str_len); - temp_key[str_len] = '\0'; - } - break; - case 2: -#line 104 "src/spss/readstat_sav_parse.rl" + case 4: +#line 114 "src/spss/readstat_sav_parse.rl" { memcpy(temp_val, str_start, str_len); temp_val[str_len] = '\0'; } break; - case 3: -#line 111 "src/spss/readstat_sav_parse.rl" - { str_start = p; } - break; - case 4: -#line 111 "src/spss/readstat_sav_parse.rl" - { str_len = p - str_start; } - break; case 5: -#line 113 "src/spss/readstat_sav_parse.rl" +#line 119 "src/spss/readstat_sav_parse.rl" { str_start = p; } break; case 6: -#line 113 "src/spss/readstat_sav_parse.rl" +#line 119 "src/spss/readstat_sav_parse.rl" { str_len = p - str_start; } break; -#line 431 "src/spss/readstat_sav_parse.c" +#line 429 "src/spss/readstat_sav_parse.c" } } @@ -443,8 +441,8 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav unsigned int __nacts = (unsigned int) *__acts++; while ( __nacts-- > 0 ) { switch ( *__acts++ ) { - case 0: -#line 87 "src/spss/readstat_sav_parse.rl" + case 3: +#line 102 "src/spss/readstat_sav_parse.rl" { varlookup_t *found = bsearch(temp_key, table, var_count, sizeof(varlookup_t), &compare_key_varlookup); if (found) { @@ -457,18 +455,18 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav } } break; - case 2: -#line 104 "src/spss/readstat_sav_parse.rl" + case 4: +#line 114 "src/spss/readstat_sav_parse.rl" { memcpy(temp_val, str_start, str_len); temp_val[str_len] = '\0'; } break; case 6: -#line 113 "src/spss/readstat_sav_parse.rl" +#line 119 "src/spss/readstat_sav_parse.rl" { str_len = p - str_start; } break; -#line 472 "src/spss/readstat_sav_parse.c" +#line 470 "src/spss/readstat_sav_parse.c" } } } @@ -476,7 +474,7 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav _out: {} } -#line 121 "src/spss/readstat_sav_parse.rl" +#line 127 "src/spss/readstat_sav_parse.rl" if (cs < 11|| p != pe) { @@ -499,62 +497,63 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav } -#line 503 "src/spss/readstat_sav_parse.c" +#line 501 "src/spss/readstat_sav_parse.c" static const char _sav_very_long_string_parse_actions[] = { - 0, 1, 0, 1, 2, 1, 3, 2, - 4, 1, 2, 5, 2 + 0, 1, 1, 1, 3, 1, 4, 2, + 2, 0, 2, 5, 4 }; static const char _sav_very_long_string_parse_key_offsets[] = { - 0, 0, 6, 20, 34, 48, 62, 76, - 90, 104, 105, 107, 110, 112 + 0, 0, 5, 19, 33, 47, 61, 75, + 89, 103, 104, 106, 109, 111 }; static const unsigned char _sav_very_long_string_parse_trans_keys[] = { - 0u, 63u, 91u, 127u, 248u, 255u, 47u, 61u, - 0u, 34u, 37u, 45u, 58u, 63u, 91u, 94u, - 96u, 127u, 248u, 255u, 47u, 61u, 0u, 34u, - 37u, 45u, 58u, 63u, 91u, 94u, 96u, 127u, - 248u, 255u, 47u, 61u, 0u, 34u, 37u, 45u, - 58u, 63u, 91u, 94u, 96u, 127u, 248u, 255u, - 47u, 61u, 0u, 34u, 37u, 45u, 58u, 63u, - 91u, 94u, 96u, 127u, 248u, 255u, 47u, 61u, - 0u, 34u, 37u, 45u, 58u, 63u, 91u, 94u, - 96u, 127u, 248u, 255u, 47u, 61u, 0u, 34u, - 37u, 45u, 58u, 63u, 91u, 94u, 96u, 127u, - 248u, 255u, 47u, 61u, 0u, 34u, 37u, 45u, - 58u, 63u, 91u, 94u, 96u, 127u, 248u, 255u, - 61u, 48u, 57u, 0u, 48u, 57u, 0u, 9u, - 0u, 63u, 91u, 127u, 248u, 255u, 0 + 255u, 0u, 63u, 91u, 127u, 47u, 61u, 96u, + 255u, 0u, 34u, 37u, 45u, 58u, 63u, 91u, + 94u, 123u, 127u, 47u, 61u, 96u, 255u, 0u, + 34u, 37u, 45u, 58u, 63u, 91u, 94u, 123u, + 127u, 47u, 61u, 96u, 255u, 0u, 34u, 37u, + 45u, 58u, 63u, 91u, 94u, 123u, 127u, 47u, + 61u, 96u, 255u, 0u, 34u, 37u, 45u, 58u, + 63u, 91u, 94u, 123u, 127u, 47u, 61u, 96u, + 255u, 0u, 34u, 37u, 45u, 58u, 63u, 91u, + 94u, 123u, 127u, 47u, 61u, 96u, 255u, 0u, + 34u, 37u, 45u, 58u, 63u, 91u, 94u, 123u, + 127u, 47u, 61u, 96u, 255u, 0u, 34u, 37u, + 45u, 58u, 63u, 91u, 94u, 123u, 127u, 61u, + 48u, 57u, 0u, 48u, 57u, 0u, 9u, 255u, + 0u, 63u, 91u, 127u, 0 }; static const char _sav_very_long_string_parse_single_lengths[] = { - 0, 0, 2, 2, 2, 2, 2, 2, - 2, 1, 0, 1, 2, 0 + 0, 1, 4, 4, 4, 4, 4, 4, + 4, 1, 0, 1, 2, 1 }; static const char _sav_very_long_string_parse_range_lengths[] = { - 0, 3, 6, 6, 6, 6, 6, 6, - 6, 0, 1, 1, 0, 3 + 0, 2, 5, 5, 5, 5, 5, 5, + 5, 0, 1, 1, 0, 2 }; static const char _sav_very_long_string_parse_index_offsets[] = { - 0, 0, 4, 13, 22, 31, 40, 49, - 58, 67, 69, 71, 74, 77 + 0, 0, 4, 14, 24, 34, 44, 54, + 64, 74, 76, 78, 81, 84 }; static const char _sav_very_long_string_parse_indicies[] = { 1, 1, 1, 0, 1, 3, 1, 1, - 1, 1, 1, 1, 2, 1, 3, 1, - 1, 1, 1, 1, 1, 4, 1, 3, - 1, 1, 1, 1, 1, 1, 5, 1, - 3, 1, 1, 1, 1, 1, 1, 6, + 1, 1, 1, 1, 1, 2, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 4, 1, 3, 1, 1, 1, 1, 1, 1, - 7, 1, 3, 1, 1, 1, 1, 1, - 1, 8, 1, 3, 1, 1, 1, 1, - 1, 1, 9, 3, 1, 10, 1, 11, - 12, 1, 13, 14, 1, 1, 1, 1, - 0, 0 + 1, 5, 1, 3, 1, 1, 1, 1, + 1, 1, 1, 6, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 7, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 8, + 1, 3, 1, 1, 1, 1, 1, 1, + 1, 9, 3, 1, 10, 1, 11, 12, + 1, 13, 14, 1, 1, 1, 1, 0, + 0 }; static const char _sav_very_long_string_parse_trans_targs[] = { @@ -563,8 +562,8 @@ static const char _sav_very_long_string_parse_trans_targs[] = { }; static const char _sav_very_long_string_parse_trans_actions[] = { - 5, 0, 0, 7, 0, 0, 0, 0, - 0, 0, 10, 1, 3, 0, 0 + 1, 0, 0, 7, 0, 0, 0, 0, + 0, 0, 10, 3, 5, 0, 0 }; static const int sav_very_long_string_parse_start = 1; @@ -572,7 +571,7 @@ static const int sav_very_long_string_parse_start = 1; static const int sav_very_long_string_parse_en_main = 1; -#line 146 "src/spss/readstat_sav_parse.rl" +#line 153 "src/spss/readstat_sav_parse.rl" readstat_error_t sav_parse_very_long_string_record(void *data, int count, sav_ctx_t *ctx) { @@ -597,12 +596,12 @@ readstat_error_t sav_parse_very_long_string_record(void *data, int count, sav_ct table = build_lookup_table(var_count, ctx); -#line 601 "src/spss/readstat_sav_parse.c" +#line 600 "src/spss/readstat_sav_parse.c" { cs = sav_very_long_string_parse_start; } -#line 606 "src/spss/readstat_sav_parse.c" +#line 605 "src/spss/readstat_sav_parse.c" { int _klen; unsigned int _trans; @@ -677,23 +676,33 @@ readstat_error_t sav_parse_very_long_string_record(void *data, int count, sav_ct switch ( *_acts++ ) { case 0: -#line 170 "src/spss/readstat_sav_parse.rl" +#line 13 "src/spss/readstat_sav_parse.rl" { - varlookup_t *found = bsearch(temp_key, table, var_count, sizeof(varlookup_t), &compare_key_varlookup); - if (found) { - ctx->varinfo[found->index]->string_length = temp_val; - } - } + memcpy(temp_key, str_start, str_len); + temp_key[str_len] = '\0'; + } break; case 1: +#line 20 "src/spss/readstat_sav_parse.rl" + { str_start = p; } + break; + case 2: +#line 20 "src/spss/readstat_sav_parse.rl" + { str_len = p - str_start; } + break; + case 3: #line 177 "src/spss/readstat_sav_parse.rl" { - memcpy(temp_key, str_start, str_len); - temp_key[str_len] = '\0'; + varlookup_t *found = bsearch(temp_key, table, var_count, sizeof(varlookup_t), &compare_key_varlookup); + if (found) { + ctx->varinfo[found->index]->string_length = temp_val; + ctx->varinfo[found->index]->write_format.width = temp_val; + ctx->varinfo[found->index]->print_format.width = temp_val; + } } break; - case 2: -#line 182 "src/spss/readstat_sav_parse.rl" + case 4: +#line 186 "src/spss/readstat_sav_parse.rl" { if ((*p) != '\0') { unsigned char digit = (*p) - '0'; @@ -705,19 +714,11 @@ readstat_error_t sav_parse_very_long_string_record(void *data, int count, sav_ct } } break; - case 3: -#line 195 "src/spss/readstat_sav_parse.rl" - { str_start = p; } - break; - case 4: -#line 195 "src/spss/readstat_sav_parse.rl" - { str_len = p - str_start; } - break; case 5: #line 197 "src/spss/readstat_sav_parse.rl" { temp_val = 0; } break; -#line 721 "src/spss/readstat_sav_parse.c" +#line 722 "src/spss/readstat_sav_parse.c" } } diff --git a/src/spss/readstat_sav_parse.rl b/src/spss/readstat_sav_parse.rl index c77e8fe..5926ce4 100644 --- a/src/spss/readstat_sav_parse.rl +++ b/src/spss/readstat_sav_parse.rl @@ -2,10 +2,24 @@ #include #include "../readstat.h" #include "../readstat_malloc.h" +#include "../readstat_strings.h" #include "readstat_sav.h" #include "readstat_sav_parse.h" +%%{ + machine key_defs; + + action copy_key { + memcpy(temp_key, str_start, str_len); + temp_key[str_len] = '\0'; + } + + non_ascii_byte = (0x80 .. 0xFE); # multi-byte sequence might be incomplete + + key = ( ( non_ascii_byte | [A-Z@] ) ( non_ascii_byte | [A-Za-z0-9@#$_\.] ){0,7} ) >{ str_start = fpc; } %{ str_len = fpc - str_start; }; +}%% + typedef struct varlookup { char name[8*4+1]; int index; @@ -14,13 +28,13 @@ typedef struct varlookup { static int compare_key_varlookup(const void *elem1, const void *elem2) { const char *key = (const char *)elem1; const varlookup_t *v = (const varlookup_t *)elem2; - return strcmp(key, v->name); + return strcasecmp(key, v->name); } static int compare_varlookups(const void *elem1, const void *elem2) { const varlookup_t *v1 = (const varlookup_t *)elem1; const varlookup_t *v2 = (const varlookup_t *)elem2; - return strcmp(v1->name, v2->name); + return strcasecmp(v1->name, v2->name); } static int count_vars(sav_ctx_t *ctx) { @@ -59,6 +73,7 @@ static varlookup_t *build_lookup_table(int var_count, sav_ctx_t *ctx) { %%{ machine sav_long_variable_parse; + include key_defs; write data nofinal noerror; alphtype unsigned char; }%% @@ -96,20 +111,11 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav } } - action copy_key { - memcpy(temp_key, str_start, str_len); - temp_key[str_len] = '\0'; - } - action copy_value { memcpy(temp_val, str_start, str_len); temp_val[str_len] = '\0'; } - non_ascii_byte = (0xC0..0xDF | 0x80..0xBF | 0xE0..0xEF | 0xF0..0xF7); # UTF-8 byte sequences (might be incomplete) - - key = ( ( non_ascii_byte | [A-Z@] ) ( non_ascii_byte | [A-Z0-9@#$_\.] ){0,7} ) >{ str_start = fpc; } %{ str_len = fpc - str_start; }; - value = ( non_ascii_byte | print ){1,64} >{ str_start = fpc; } %{ str_len = fpc - str_start; }; keyval = ( key %copy_key "=" value %copy_value ) %set_long_name; @@ -141,6 +147,7 @@ readstat_error_t sav_parse_long_variable_names_record(void *data, int count, sav %%{ machine sav_very_long_string_parse; + include key_defs; write data nofinal noerror; alphtype unsigned char; }%% @@ -171,14 +178,11 @@ readstat_error_t sav_parse_very_long_string_record(void *data, int count, sav_ct varlookup_t *found = bsearch(temp_key, table, var_count, sizeof(varlookup_t), &compare_key_varlookup); if (found) { ctx->varinfo[found->index]->string_length = temp_val; + ctx->varinfo[found->index]->write_format.width = temp_val; + ctx->varinfo[found->index]->print_format.width = temp_val; } } - action copy_key { - memcpy(temp_key, str_start, str_len); - temp_key[str_len] = '\0'; - } - action incr_val { if (fc != '\0') { unsigned char digit = fc - '0'; @@ -190,10 +194,6 @@ readstat_error_t sav_parse_very_long_string_record(void *data, int count, sav_ct } } - non_ascii_byte = (0xC0..0xDF | 0x80..0xBF | 0xE0..0xEF | 0xF0..0xF7); # UTF-8 byte sequences (might be incomplete) - - key = ( ( non_ascii_byte | [A-Z@] ) ( non_ascii_byte | [A-Z0-9@#$_\.] ){0,7} ) >{ str_start = fpc; } %{ str_len = fpc - str_start; }; - value = [0-9]+ >{ temp_val = 0; } $incr_val; keyval = ( key %copy_key "=" value ) %set_width; diff --git a/src/spss/readstat_sav_read.c b/src/spss/readstat_sav_read.c index a9e1545..9504156 100644 --- a/src/spss/readstat_sav_read.c +++ b/src/spss/readstat_sav_read.c @@ -790,7 +790,7 @@ static readstat_error_t sav_read_data(sav_ctx_t *ctx) { if (retval != READSTAT_OK) goto done; - if (ctx->record_count != -1 && ctx->current_row != ctx->row_limit) { + if (ctx->record_count >= 0 && ctx->current_row != ctx->row_limit) { retval = READSTAT_ERROR_ROW_COUNT_MISMATCH; } @@ -1593,7 +1593,7 @@ readstat_error_t readstat_parse_sav(readstat_parser_t *parser, const char *path, ctx->file_size = file_size; if (parser->row_offset > 0) ctx->row_offset = parser->row_offset; - if (ctx->record_count != -1) { + if (ctx->record_count >= 0) { int record_count_after_skipping = ctx->record_count - ctx->row_offset; if (record_count_after_skipping < 0) { record_count_after_skipping = 0; @@ -1632,7 +1632,7 @@ readstat_error_t readstat_parse_sav(readstat_parser_t *parser, const char *path, if (ctx->handle.metadata) { readstat_metadata_t metadata = { - .row_count = ctx->record_count == -1 ? -1 : ctx->row_limit, + .row_count = ctx->record_count < 0 ? -1 : ctx->row_limit, .var_count = ctx->var_count, .file_encoding = ctx->input_encoding, .file_format_version = ctx->format_version, diff --git a/src/spss/readstat_sav_write.c b/src/spss/readstat_sav_write.c index ec909b9..af088b5 100644 --- a/src/spss/readstat_sav_write.c +++ b/src/spss/readstat_sav_write.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -1293,7 +1292,7 @@ static readstat_error_t sav_variable_ok(const readstat_variable_t *variable) { static sav_varnames_t *sav_varnames_init(readstat_writer_t *writer) { sav_varnames_t *varnames = calloc(writer->variables_count, sizeof(sav_varnames_t)); - ck_hash_table_t *table = ck_hash_table_init(writer->variables_count); + ck_hash_table_t *table = ck_hash_table_init(writer->variables_count, 8); int i, k; for (i=0; ivariables_count; i++) { readstat_variable_t *r_variable = readstat_get_variable(writer, i); diff --git a/src/stata/readstat_dta_read.c b/src/stata/readstat_dta_read.c index 041e17f..6ba975d 100644 --- a/src/stata/readstat_dta_read.c +++ b/src/stata/readstat_dta_read.c @@ -904,12 +904,10 @@ static readstat_error_t dta_read_label_and_timestamp(dta_ctx_t *ctx) { memmove(timestamp_buffer+1, timestamp_buffer, timestamp_len-1); timestamp_buffer[0] = last_data_label_char; } - if ((retval = dta_parse_timestamp(timestamp_buffer, timestamp_len, - ×tamp, ctx->handle.error, ctx->user_ctx)) != READSTAT_OK) { - goto cleanup; + if (dta_parse_timestamp(timestamp_buffer, timestamp_len, + ×tamp, ctx->handle.error, ctx->user_ctx) == READSTAT_OK) { + ctx->timestamp = mktime(×tamp); } - - ctx->timestamp = mktime(×tamp); } } @@ -1055,7 +1053,7 @@ static readstat_error_t dta_handle_value_labels(dta_ctx_t *ctx) { goto cleanup; } } - } else if (len > 8) { + } else if (len >= 8) { if ((retval = dta_read_tag(ctx, "")) != READSTAT_OK) { goto cleanup; } diff --git a/src/stata/readstat_dta_write.c b/src/stata/readstat_dta_write.c index 77cc20a..08a8364 100644 --- a/src/stata/readstat_dta_write.c +++ b/src/stata/readstat_dta_write.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include "../readstat.h" @@ -523,13 +522,15 @@ static readstat_error_t dta_emit_variable_labels(readstat_writer_t *writer, dta_ static readstat_error_t dta_emit_characteristics(readstat_writer_t *writer, dta_ctx_t *ctx) { readstat_error_t error = READSTAT_OK; int i; - char buffer[ctx->ch_metadata_len]; + char *buffer = NULL; if (ctx->expansion_len_len == 0) return READSTAT_OK; if ((error = dta_write_tag(writer, ctx, "")) != READSTAT_OK) - goto cleanup; + return error; + + buffer = malloc(ctx->ch_metadata_len); for (i=0; inotes_count; i++) { if (ctx->file_is_xmlish) { @@ -581,6 +582,7 @@ static readstat_error_t dta_emit_characteristics(readstat_writer_t *writer, dta_ goto cleanup; cleanup: + free(buffer); return error; } diff --git a/test_data/basic/test_file_label_linux.sas7bdat b/test_data/basic/test_file_label_linux.sas7bdat new file mode 100644 index 0000000..5d88454 Binary files /dev/null and b/test_data/basic/test_file_label_linux.sas7bdat differ diff --git a/test_data/basic/test_file_label_win.sas7bdat b/test_data/basic/test_file_label_win.sas7bdat new file mode 100644 index 0000000..4ec1926 Binary files /dev/null and b/test_data/basic/test_file_label_win.sas7bdat differ diff --git a/test_data/basic/test_width.sav b/test_data/basic/test_width.sav new file mode 100644 index 0000000..2bd0ecb Binary files /dev/null and b/test_data/basic/test_width.sav differ diff --git a/tests/test_basic.py b/tests/test_basic.py index 022b539..3bb91ba 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -440,10 +440,8 @@ def test_zsav_chunks(self): def test_por(self): df, meta = pyreadstat.read_por(os.path.join(self.basic_data_folder, "sample.por")) - # dates, datetimes and timestamps are not translated but stay as integers, let's just drop them - df_pandas_por = self.df_pandas.drop(labels=["dtime", "mydate", "mytime"], axis=1) + df_pandas_por = self.df_pandas.copy() df.columns = [x.lower() for x in df.columns] - df = df.drop(labels=["dtime", "mydate", "mytime"], axis=1) self.assertTrue(df.equals(df_pandas_por)) self.assertTrue(meta.number_columns == len(self.df_pandas.columns)) self.assertTrue(meta.number_rows == len(df_pandas_por)) @@ -451,10 +449,8 @@ def test_por(self): def test_por_formatted(self): df, meta = pyreadstat.read_por(os.path.join(self.basic_data_folder, "sample.por"), apply_value_formats=True, formats_as_category=True) - # dates, datetimes and timestamps are not translated but stay as integers, let's just drop them - df_pandas_por = self.df_pandas_formatted.drop(labels=["dtime", "mydate", "mytime"], axis=1) + df_pandas_por = self.df_pandas_formatted.copy() df.columns = [x.lower() for x in df.columns] - df = df.drop(labels=["dtime", "mydate", "mytime"], axis=1) self.assertTrue(df.equals(df_pandas_por)) self.assertTrue(meta.number_columns == len(self.df_pandas_formatted.columns)) self.assertTrue(meta.number_rows == len(df_pandas_por)) @@ -485,11 +481,9 @@ def test_por_nodates(self): def test_por_chunks(self): df, meta = pyreadstat.read_por(os.path.join(self.basic_data_folder, "sample.por"), row_limit = 2, row_offset =1) - df_pandas = self.df_pandas.iloc[1:3,:].reset_index(drop=True) - # dates, datetimes and timestamps are not translated but stay as integers, let's just drop them - df_pandas_por = df_pandas.drop(labels=["dtime", "mydate", "mytime"], axis=1) + df_pandas_por = self.df_pandas.iloc[1:3,:].reset_index(drop=True) + df_pandas_por.loc[:, 'dtime'] = pd.to_datetime(df_pandas_por.dtime) df.columns = [x.lower() for x in df.columns] - df = df.drop(labels=["dtime", "mydate", "mytime"], axis=1) self.assertTrue(df.equals(df_pandas_por)) self.assertTrue(meta.number_columns == len(self.df_pandas.columns)) self.assertTrue(meta.number_rows == len(df_pandas_por)) @@ -778,7 +772,6 @@ def test_por_write_basic(self): pyreadstat.write_por(self.df_pandas, path, file_label=file_label, column_labels=col_labels) #, note=file_note) df, meta = pyreadstat.read_por(path) df.columns = [x.lower() for x in df.columns] - self.assertTrue(df.equals(self.df_pandas)) self.assertEqual(meta.file_label, file_label) self.assertListEqual(meta.column_labels, col_labels) @@ -918,6 +911,14 @@ def test_sav_international_varname(self): df, meta = pyreadstat.read_sav(os.path.join(self.basic_data_folder, "hebrews.sav")) self.assertTrue(df.columns[0] == "ותק_ב") + def test_sav_original_var_types(self): + # a file with a varname with international characters + df, meta = pyreadstat.read_sav(os.path.join(self.basic_data_folder, "test_width.sav")) + self.assertEqual(meta.original_variable_types['StartDate'],'A1024') + self.assertEqual(meta.original_variable_types['ResponseId'],'A18') + self.assertEqual(meta.original_variable_types['Duration__in_seconds_'],'F40.2') + self.assertEqual(meta.original_variable_types['Finished'],'F1.0') + def test_sav_write_longstr(self): path = os.path.join(self.write_folder, "longstr.sav") pyreadstat.write_sav(self.df_longstr, path, variable_display_width={"v1": 1000}) @@ -925,7 +926,20 @@ def test_sav_write_longstr(self): self.assertTrue(meta.variable_display_width['v1']==1000) self.assertTrue(len(df.iloc[0,0])==781) - + def test_sas7bdat_file_label_linux(self): + "testing file label for file produced on linux" + path = os.path.join(self.basic_data_folder, "test_file_label_linux.sas7bdat") + df, meta = pyreadstat.read_sas7bdat(path) + self.assertEqual(meta.file_label, "mytest label") + self.assertEqual(meta.table_name, "TEST_DATA") + + def test_sas7bdat_file_label_windows(self): + "testing file label for file produced on windows" + path = os.path.join(self.basic_data_folder, "test_file_label_win.sas7bdat") + df, meta = pyreadstat.read_sas7bdat(path) + self.assertEqual(meta.file_label, "mytest label") + self.assertEqual(meta.table_name, "TEST_DATA") + if __name__ == '__main__':