[Csv] Passing along a comment from Tim Peters
Skip Montanaro
skip at pobox.com
Fri Feb 7 05:11:05 CET 2003
Andrew, et al,
Here's a comment from Tim Peters regarding the negative ref count problem I
reported.
Comment By: Tim Peters (tim_one)
Date: 2003-02-06 20:23
Message:
Logged In: YES
user_id=31435
I think csv_parser is too clevar. If the PyArg_ParseTuple
call fails, it may have already stored a borrowed reference
into self->lineterminator, and then it's madness to decref
that.in Parser_dealloc().
"The usual way" to allocate a new object is not to
materialize self until *after* PyArg_ParseTuple succeeds.
Then nothing delicate needs to be done to clean up, since
nothing was done at all yet <wink>.
Good evidence: adding the pure hack
Py_XINCREF(self->lineterminator);
before
Py_DECREF(self);
stops the negative refcount errors in Neal's example.
While the current module doesn't seem to exhibit the bug, Tim's advice might
still be useful. The full bug report is at
http://python.org/sf/681902
Skip
More information about the Csv
mailing list