[Python-checkins] CVS: python/dist/src/Python structmember.c,2.22,2.23

Guido van Rossum gvanrossum@users.sourceforge.net
2001年12月04日 08:23:45 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv16698/Python
Modified Files:
	structmember.c 
Log Message:
Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
There's now a new structmember code, T_OBJECT_EX, which is used for
all __slot__ variables (except __weakref__, which has special behavior
anyway). This new code raises AttributeError when the variable is
NULL rather than converting NULL to None.
Index: structmember.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/structmember.c,v
retrieving revision 2.22
retrieving revision 2.23
diff -C2 -d -r2.22 -r2.23
*** structmember.c	2001年10月16日 16:51:56	2.22
--- structmember.c	2001年12月04日 16:23:42	2.23
***************
*** 130,133 ****
--- 130,139 ----
 		Py_INCREF(v);
 		break;
+ 	case T_OBJECT_EX:
+ 		v = *(PyObject **)addr;
+ 		if (v == NULL)
+ 			PyErr_SetString(PyExc_AttributeError, l->name);
+ 		Py_XINCREF(v);
+ 		break;
 	default:
 		PyErr_SetString(PyExc_SystemError, "bad memberdescr type");
***************
*** 176,180 ****
 		return -1;
 	}
! 	if (v == NULL && l->type != T_OBJECT) {
 		PyErr_SetString(PyExc_TypeError,
 				"can't delete numeric/char attribute");
--- 182,186 ----
 		return -1;
 	}
! 	if (v == NULL && l->type != T_OBJECT_EX && l->type != T_OBJECT) {
 		PyErr_SetString(PyExc_TypeError,
 				"can't delete numeric/char attribute");
***************
*** 247,250 ****
--- 253,257 ----
 		break;
 	case T_OBJECT:
+ 	case T_OBJECT_EX:
 		Py_XINCREF(v);
 		oldv = *(PyObject **)addr;

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