[Python-checkins] CVS: python/dist/src/Modules pyexpat.c,2.51,2.52

Martin v. L?wis loewis@users.sourceforge.net
2001年10月21日 01:53:54 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv27813
Modified Files:
	pyexpat.c 
Log Message:
Change clear_handlers argument to indicate whether this is an initialization.
Do not set the Expat handlers if it is. Fixes PyXML bug #473195.
Index: pyexpat.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v
retrieving revision 2.51
retrieving revision 2.52
diff -C2 -d -r2.51 -r2.52
*** pyexpat.c	2001年09月23日 10:20:10	2.51
--- pyexpat.c	2001年10月21日 08:53:52	2.52
***************
*** 291,300 ****
 /* Callback routines */
 
! static void clear_handlers(xmlparseobject *self, int decref);
 
 static void
 flag_error(xmlparseobject *self)
 {
! clear_handlers(self, 1);
 }
 
--- 291,300 ----
 /* Callback routines */
 
! static void clear_handlers(xmlparseobject *self, int initial);
 
 static void
 flag_error(xmlparseobject *self)
 {
! clear_handlers(self, 0);
 }
 
***************
*** 1018,1022 ****
 return PyErr_NoMemory();
 }
! clear_handlers(new_parser, 0);
 
 /* then copy handlers from self */
--- 1018,1022 ----
 return PyErr_NoMemory();
 }
! clear_handlers(new_parser, 1);
 
 /* then copy handlers from self */
***************
*** 1194,1198 ****
 	 return PyErr_NoMemory();
 }
! clear_handlers(self, 0);
 
 return (PyObject*)self;
--- 1194,1198 ----
 	 return PyErr_NoMemory();
 }
! clear_handlers(self, 1);
 
 return (PyObject*)self;
***************
*** 1368,1372 ****
 xmlparse_clear(xmlparseobject *op)
 {
! clear_handlers(op, 1);
 return 0;
 }
--- 1368,1372 ----
 xmlparse_clear(xmlparseobject *op)
 {
! clear_handlers(op, 0);
 return 0;
 }
***************
*** 1677,1681 ****
 
 static void
! clear_handlers(xmlparseobject *self, int decref)
 {
 int i = 0;
--- 1677,1681 ----
 
 static void
! clear_handlers(xmlparseobject *self, int initial)
 {
 int i = 0;
***************
*** 1683,1693 ****
 
 for (; handler_info[i].name!=NULL; i++) {
! if (decref) {
 temp = self->handlers[i];
 self->handlers[i] = NULL;
 Py_XDECREF(temp);
 }
- self->handlers[i]=NULL;
- handler_info[i].setter(self->itself, NULL);
 }
 }
--- 1683,1694 ----
 
 for (; handler_info[i].name!=NULL; i++) {
! if (initial)
! 	 self->handlers[i]=NULL;
! 	else {
 temp = self->handlers[i];
 self->handlers[i] = NULL;
 Py_XDECREF(temp);
+ 	 handler_info[i].setter(self->itself, NULL);
 }
 }
 }

AltStyle によって変換されたページ (->オリジナル) /