cpython: 5a6cdc0d7de1 (original) (raw)

Mercurial > cpython

changeset 84710:5a6cdc0d7de1

Issue #18501, #18408: Fix expat handlers in pyexpat, don't call Python functions if a Python exception was raised [#18501]

Victor Stinner victor.stinner@gmail.com
date Thu, 18 Jul 2013 23:17:01 +0200
parents 6ec0e9347dd4
children 627d29169ba2
files Modules/pyexpat.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-)[+] [-] Modules/pyexpat.c 15

line wrap: on

line diff

--- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -402,6 +402,10 @@ static void my_CharacterDataHandler(void *userData, const XML_Char *data, int len) { xmlparseobject *self = (xmlparseobject *) userData; +

+ if (self->buffer == NULL) call_character_handler(self, data, len); else { @@ -436,6 +440,9 @@ my_StartElementHandler(void *userData, PyObject *container, *rv, *args; int i, max;

+ if (flush_character_buffer(self) < 0) return; /* Set max to the number of slots filled in atts[]; max/2 is @@ -519,6 +526,8 @@ my_##NAME##Handler PARAMS {[](#l1.24) INIT [](#l1.25) [](#l1.26) if (have_handler(self, NAME)) { [](#l1.27)

@@ -633,6 +642,9 @@ my_ElementDeclHandler(void *userData, PyObject *rv = NULL; PyObject *modelobj, *nameobj;

+ if (flush_character_buffer(self) < 0) goto finally; modelobj = conv_content_model(model, (conv_string_to_unicode)); @@ -1125,6 +1137,9 @@ PyUnknownEncodingHandler(void *encodingH void *data; unsigned int kind;

+ if (template_buffer[1] == 0) { for (i = 0; i < 256; i++) template_buffer[i] = i;