MCPcopy Create free account
hub / github.com/simplejson/simplejson / JSON_ParseEncoding

Function JSON_ParseEncoding

simplejson/_speedups.c:2352–2375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2350}
2351
2352static PyObject *
2353JSON_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
2377static PyObject *
2378scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds)

Callers 2

scanner_newFunction · 0.85
encoder_newFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…