InitStrings */
| 14938 | |
| 14939 | /* InitStrings */ |
| 14940 | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { |
| 14941 | while (t->p) { |
| 14942 | #if PY_MAJOR_VERSION < 3 |
| 14943 | if (t->is_unicode) { |
| 14944 | *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); |
| 14945 | } else if (t->intern) { |
| 14946 | *t->p = PyString_InternFromString(t->s); |
| 14947 | } else { |
| 14948 | *t->p = PyString_FromStringAndSize(t->s, t->n - 1); |
| 14949 | } |
| 14950 | #else |
| 14951 | if (t->is_unicode | t->is_str) { |
| 14952 | if (t->intern) { |
| 14953 | *t->p = PyUnicode_InternFromString(t->s); |
| 14954 | } else if (t->encoding) { |
| 14955 | *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); |
| 14956 | } else { |
| 14957 | *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); |
| 14958 | } |
| 14959 | } else { |
| 14960 | *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); |
| 14961 | } |
| 14962 | #endif |
| 14963 | if (!*t->p) |
| 14964 | return -1; |
| 14965 | if (PyObject_Hash(*t->p) == -1) |
| 14966 | return -1; |
| 14967 | ++t; |
| 14968 | } |
| 14969 | return 0; |
| 14970 | } |
| 14971 | |
| 14972 | static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { |
| 14973 | return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); |