in src/typeref.rs [136:203]
fn _init_typerefs_impl() -> bool {
unsafe {
debug_assert!(crate::opt::MAX_OPT < u16::MAX as i32);
assert!(crate::deserialize::KEY_MAP
.set(crate::deserialize::KeyMap::default())
.is_ok());
FRAGMENT_TYPE = orjson_fragmenttype_new();
PyDateTime_IMPORT();
NONE = Py_None();
TRUE = Py_True();
FALSE = Py_False();
EMPTY_UNICODE = PyUnicode_New(0, 255);
STR_TYPE = (*EMPTY_UNICODE).ob_type;
BYTES_TYPE = (*PyBytes_FromStringAndSize("".as_ptr() as *const c_char, 0)).ob_type;
{
let bytearray = PyByteArray_FromStringAndSize("".as_ptr() as *const c_char, 0);
BYTEARRAY_TYPE = (*bytearray).ob_type;
let memoryview = PyMemoryView_FromObject(bytearray);
MEMORYVIEW_TYPE = (*memoryview).ob_type;
Py_DECREF(memoryview);
Py_DECREF(bytearray);
}
DICT_TYPE = (*PyDict_New()).ob_type;
LIST_TYPE = (*PyList_New(0)).ob_type;
TUPLE_TYPE = (*PyTuple_New(0)).ob_type;
NONE_TYPE = (*NONE).ob_type;
BOOL_TYPE = (*TRUE).ob_type;
INT_TYPE = (*PyLong_FromLongLong(0)).ob_type;
FLOAT_TYPE = (*PyFloat_FromDouble(0.0)).ob_type;
DATETIME_TYPE = look_up_datetime_type();
DATE_TYPE = look_up_date_type();
TIME_TYPE = look_up_time_type();
UUID_TYPE = look_up_uuid_type();
ENUM_TYPE = look_up_enum_type();
FIELD_TYPE = look_up_field_type();
#[cfg(Py_3_9)]
{
ZONEINFO_TYPE = look_up_zoneinfo_type();
}
INT_ATTR_STR = PyUnicode_InternFromString("int\0".as_ptr() as *const c_char);
UTCOFFSET_METHOD_STR = PyUnicode_InternFromString("utcoffset\0".as_ptr() as *const c_char);
NORMALIZE_METHOD_STR = PyUnicode_InternFromString("normalize\0".as_ptr() as *const c_char);
CONVERT_METHOD_STR = PyUnicode_InternFromString("convert\0".as_ptr() as *const c_char);
DST_STR = PyUnicode_InternFromString("dst\0".as_ptr() as *const c_char);
DICT_STR = PyUnicode_InternFromString("__dict__\0".as_ptr() as *const c_char);
DATACLASS_FIELDS_STR =
PyUnicode_InternFromString("__dataclass_fields__\0".as_ptr() as *const c_char);
SLOTS_STR = PyUnicode_InternFromString("__slots__\0".as_ptr() as *const c_char);
FIELD_TYPE_STR = PyUnicode_InternFromString("_field_type\0".as_ptr() as *const c_char);
ARRAY_STRUCT_STR =
PyUnicode_InternFromString("__array_struct__\0".as_ptr() as *const c_char);
DTYPE_STR = PyUnicode_InternFromString("dtype\0".as_ptr() as *const c_char);
DESCR_STR = PyUnicode_InternFromString("descr\0".as_ptr() as *const c_char);
VALUE_STR = PyUnicode_InternFromString("value\0".as_ptr() as *const c_char);
DEFAULT = PyUnicode_InternFromString("default\0".as_ptr() as *const c_char);
OPTION = PyUnicode_InternFromString("option\0".as_ptr() as *const c_char);
JsonEncodeError = pyo3_ffi::PyExc_TypeError;
Py_INCREF(JsonEncodeError);
JsonDecodeError = look_up_json_exc();
};
true
}