Lines Matching refs:state
58 void *state = PyModule_GetState(module);
59 assert(state != NULL);
60 return (pyexpat_state *)state;
119 set_error(pyexpat_state *state, xmlparseobject *self, enum XML_Error code)
131 err = PyObject_CallOneArg(state->error, buffer);
137 PyErr_SetObject(state->error, err);
692 get_parse_result(pyexpat_state *state, xmlparseobject *self, int rv)
698 return set_error(state, self, XML_GetErrorCode(self->itself));
730 pyexpat_state *state = PyType_GetModuleState(cls);
764 return get_parse_result(state, self, rc);
828 pyexpat_state *state = PyType_GetModuleState(cls);
830 if (_PyObject_LookupAttr(file, state->str_read, &readmethod) < 0) {
843 return get_parse_result(state, self, 0);
861 return get_parse_result(state, self, rv);
945 pyexpat_state *state = PyType_GetModuleState(cls);
947 new_parser = PyObject_GC_New(xmlparseobject, state->xml_parse_type);
1048 pyexpat_state *state = PyType_GetModuleState(cls);
1053 return set_error(state, self, rc);
1133 newxmlparseobject(pyexpat_state *state, const char *encoding,
1139 self = PyObject_GC_New(xmlparseobject, state->xml_parse_type);
1269 elaborate system of handlers and state could remove the
1555 pyexpat_state *state = pyexpat_get_state(module);
1556 result = newxmlparseobject(state, encoding, namespace_separator, intern);
1598 static int init_handler_descrs(pyexpat_state *state)
1601 assert(!PyType_HasFeature(state->xml_parse_type, Py_TPFLAGS_VALID_VERSION_TAG));
1609 PyObject *descr = PyDescr_NewGetSet(state->xml_parse_type, &hi->getset);
1613 if (PyDict_SetDefault(state->xml_parse_type->tp_dict, PyDescr_NAME(descr), descr) == NULL) {
1685 {"XML_ERROR_UNEXPECTED_STATE", "unexpected parser state - please send a bug report"},
1892 pyexpat_state *state = pyexpat_get_state(mod);
1893 state->str_read = PyUnicode_InternFromString("read");
1894 if (state->str_read == NULL) {
1897 state->xml_parse_type = (PyTypeObject *)PyType_FromModuleAndSpec(
1900 if (state->xml_parse_type == NULL) {
1904 if (init_handler_descrs(state) < 0) {
1907 state->error = PyErr_NewException("xml.parsers.expat.ExpatError",
1909 if (state->error == NULL) {
1915 if (PyModule_AddObjectRef(mod, "error", state->error) < 0) {
1919 if (PyModule_AddObjectRef(mod, "ExpatError", state->error) < 0) {
1924 (PyObject *) state->xml_parse_type) < 0) {
2024 pyexpat_state *state = pyexpat_get_state(module);
2025 Py_VISIT(state->xml_parse_type);
2026 Py_VISIT(state->error);
2027 Py_VISIT(state->str_read);
2034 pyexpat_state *state = pyexpat_get_state(module);
2035 Py_CLEAR(state->xml_parse_type);
2036 Py_CLEAR(state->error);
2037 Py_CLEAR(state->str_read);