[Python-Dev] RE: [Python-checkins] python/dist/src/Objects typeobject.c, 2.244, 2.245

Raymond Hettinger python at rcn.com
Wed Oct 8 22:53:06 EDT 2003


  	if (res == -1 && PyErr_Occurred())
  		return NULL;
! 	return PyInt_FromLong((long)res);
  }
  
--- 3577,3583 ----
  	if (res == -1 && PyErr_Occurred())
  		return NULL;
! 	ret = PyObject_IsTrue(PyInt_FromLong((long)res)) ? Py_True :
Py_False;


The line above leaks and does unnecessary work. I believe it should
read:

  	ret = res ? Py_True : Py_False;


Also, there is another one of these in Objects/descrobject.c line 712.


Raymond Hettinger
                        







More information about the Python-Dev mailing list