Author pakal
Recipients pakal, pitrou
Date 2010-01-15.21:21:27
SpamBayes Score 5.26319e-08
Marked as misclassified No
Message-id <>
Allright, I shall fix all this asap.

But it seems the C code for truncate is actually buggy in the current 2.6 _fileio.c, around line 680.
CF code below :

posobj = portable_lseek(fd, posobj, 0); -> don't we lose the reference to the old "posobj" there, doing a memory leak ?

if (PyErr_Occurred()) return NULL; -> same thing, we return Null without caring about the posobj reference which should be non-Null there ??

If I've understood a little reference counting, "portable_lseek" returns a reference that we own and must Py_DECREF, isn't that so ?

	if (posobj == Py_None || posobj == NULL) {
		/* Get the current position. */
                posobj = portable_lseek(fd, NULL, 1);
                if (posobj == NULL)
			return NULL;
        else {
		/* Move to the position to be truncated. */
                posobj = portable_lseek(fd, posobj, 0);

	pos = PyLong_AsLongLong(posobj);
	pos = PyLong_AsLong(posobj);
	if (PyErr_Occurred())
		return NULL;

Date User Action Args
2010-01-15 21:21:29pakalsetrecipients: + pakal, pitrou
2010-01-15 21:21:29pakalsetmessageid: <>
2010-01-15 21:21:28pakallinkissue6939 messages
2010-01-15 21:21:27pakalcreate