| 2350 | } |
| 2351 | |
| 2352 | static PyObject * |
| 2353 | JSON_ParseEncoding(PyObject *encoding) |
| 2354 | { |
| 2355 | if (encoding == Py_None) |
| 2356 | return JSON_InternFromString(DEFAULT_ENCODING); |
| 2357 | #if PY_MAJOR_VERSION >= 3 |
| 2358 | if (PyUnicode_Check(encoding)) { |
| 2359 | if (PyUnicode_AsUTF8(encoding) == NULL) { |
| 2360 | return NULL; |
| 2361 | } |
| 2362 | Py_INCREF(encoding); |
| 2363 | return encoding; |
| 2364 | } |
| 2365 | #else /* PY_MAJOR_VERSION >= 3 */ |
| 2366 | if (PyString_Check(encoding)) { |
| 2367 | Py_INCREF(encoding); |
| 2368 | return encoding; |
| 2369 | } |
| 2370 | if (PyUnicode_Check(encoding)) |
| 2371 | return PyUnicode_AsEncodedString(encoding, NULL, NULL); |
| 2372 | #endif /* PY_MAJOR_VERSION >= 3 */ |
| 2373 | PyErr_SetString(PyExc_TypeError, "encoding must be a string"); |
| 2374 | return NULL; |
| 2375 | } |
| 2376 | |
| 2377 | static PyObject * |
| 2378 | scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
no outgoing calls
no test coverage detected
searching dependent graphs…