[Python-checkins] python/dist/src/Modules gcmodule.c,2.33.6.3,2.33.6.4

anthonybaxter@sourceforge.net anthonybaxter@sourceforge.net
Mon, 29 Apr 2002 20:33:17 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv4828/Modules

Modified Files:
      Tag: release22-maint
	gcmodule.c 
Log Message:
backport tim_one's patch:

(some tweaking for different _PyObject_GC_Malloc() call in 2.2. checked,
still returns the same thing on failure...)

_PyObject_GC_New:  Could call PyObject_INIT with a NULL 1st argument.
_PyObject_GC_NewVar:  Could call PyObject_INIT_VAR likewise.

Bugfix candidate.

Original patch(es):
python/dist/src/Modules/gcmodule.c:2.40



Index: gcmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v
retrieving revision 2.33.6.3
retrieving revision 2.33.6.4
diff -C2 -d -r2.33.6.3 -r2.33.6.4
*** gcmodule.c	3 Apr 2002 14:07:32 -0000	2.33.6.3
--- gcmodule.c	30 Apr 2002 03:33:15 -0000	2.33.6.4
***************
*** 862,866 ****
  {
  	PyObject *op = _PyObject_GC_Malloc(tp, 0);
! 	return PyObject_INIT(op, tp);
  }
  
--- 862,868 ----
  {
  	PyObject *op = _PyObject_GC_Malloc(tp, 0);
! 	if (op != NULL)
! 		op = PyObject_INIT(op, tp);
! 	return op;
  }
  
***************
*** 869,873 ****
  {
  	PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(tp, nitems);
! 	return PyObject_INIT_VAR(op, tp, nitems);
  }
  
--- 871,877 ----
  {
  	PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(tp, nitems);
! 	if (op != NULL)
! 		op = PyObject_INIT_VAR(op, tp, nitems);
! 	return op;
  }