@@ -521,9 +521,6 @@ static PyTypeObject pytrap_UnirecTime = {
521521 0 , /* tp_setattro */
522522 0 , /* tp_as_buffer */
523523 Py_TPFLAGS_DEFAULT |
524- #if PY_MAJOR_VERSION < 3
525- Py_TPFLAGS_CHECKTYPES |
526- #endif
527524 Py_TPFLAGS_BASETYPE , /* tp_flags */
528525 "UnirecTime(int(seconds), [int(miliseconds)])\n"
529526 "UnirecTime(double(secs_and_msecs))\n"
@@ -810,11 +807,7 @@ UnirecTemplate_getByName(pytrap_unirectemplate *self, PyObject *args, PyObject *
810807 return NULL ;
811808 }
812809
813- #if PY_MAJOR_VERSION >= 3
814810 if (!PyUnicode_Check (field_name ))
815- #else
816- if (!PyUnicode_Check (field_name ) && !PyString_Check (field_name ))
817- #endif
818811 {
819812 PyErr_SetString (PyExc_TypeError , "Argument field_name must be string." );
820813 return NULL ;
@@ -1424,12 +1417,7 @@ UnirecTemplate_set(pytrap_unirectemplate *self, PyObject *args, PyObject *keywds
14241417 return NULL ;
14251418 }
14261419
1427- #if PY_MAJOR_VERSION >= 3
1428- if (!PyUnicode_Check (field_name ))
1429- #else
1430- if (!PyUnicode_Check (field_name ) && !PyString_Check (field_name ))
1431- #endif
1432- {
1420+ if (!PyUnicode_Check (field_name )) {
14331421 PyErr_SetString (PyExc_TypeError , "Argument field_name must be string." );
14341422 return NULL ;
14351423 }
@@ -1451,11 +1439,7 @@ UnirecTemplate_getFieldsDict_local(pytrap_unirectemplate *self, char byId)
14511439 PyObject * d = PyDict_New ();
14521440 if (d != NULL ) {
14531441 for (i = 0 ; i < self -> urtmplt -> count ; i ++ ) {
1454- #if PY_MAJOR_VERSION >= 3
14551442 key = PyUnicode_FromString (ur_get_name (self -> urtmplt -> ids [i ]));
1456- #else
1457- key = PyString_FromString (ur_get_name (self -> urtmplt -> ids [i ]));
1458- #endif
14591443 num = PyLong_FromLong (self -> urtmplt -> ids [i ]);
14601444 if (byId ) {
14611445 result = PyDict_SetItem (d , num , key );
@@ -2116,11 +2100,7 @@ UnirecTemplate_str(pytrap_unirectemplate *self)
21162100{
21172101 char * s = ur_template_string_delimiter (self -> urtmplt , ',' );
21182102 PyObject * result ;
2119- #if PY_MAJOR_VERSION >= 3
21202103 result = PyUnicode_FromFormat ("(%s)" , s );
2121- #else
2122- result = PyString_FromFormat ("(%s)" , s );
2123- #endif
21242104 free (s );
21252105 return result ;
21262106}
@@ -2167,11 +2147,7 @@ UnirecTemplate_next(pytrap_unirectemplate *self)
21672147 PyObject * result ;
21682148
21692149 if (self -> iter_index < self -> field_count ) {
2170- #if PY_MAJOR_VERSION >= 3
21712150 name = PyUnicode_FromString (ur_get_name (self -> urtmplt -> ids [self -> iter_index ]));
2172- #else
2173- name = PyString_FromString (ur_get_name (self -> urtmplt -> ids [self -> iter_index ]));
2174- #endif
21752151 value = UnirecTemplate_get_local (self , self -> data , self -> urtmplt -> ids [self -> iter_index ]);
21762152 self -> iter_index ++ ;
21772153 result = Py_BuildValue ("(OO)" , name , value );
0 commit comments