[MERGE][1.0] update C PatienceDiff to allow for non-strings
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 4 17:08:53 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Lukáš Lalinský wrote:
> On Ut, 2007-12-04 at 10:31 -0600, John Arbash Meinel wrote:
>> + subitem = PySequence_Fast_GET_ITEM(item, j);
>> + cur_len = PyObject_Length(subitem);
>> + if (cur_len == -1) {
>> + /* Error */
>> + return -1;
>
> Not very important case, since this is probably not going to happen in
> any real code, but you are leaking a copy of the list of lines here.
>
>> + /* Generic length */
>> + cur_len = PyObject_Length(item);
>> + if (cur_len == -1) {
>> + /* Error */
>> + return -1;
>
> Same here.
>
>> + line->data = item;
>> + line->hash = PyObject_Hash(item);
>> + if (line->hash == (-1)) {
>> + /* Propogate the hash exception */
>> return -1;
>
> And here.
>
> Lukas
Ah, I forgot you added a ref to 'seq'. In the attached I use a goto to make
sure everything is cleaned up properly. Thanks for catching this.
(When you first mentioned it, I thought you were saying the PyObject_* function
was adding a reference...)
Anyway, the attached patch should fix all those cases.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHVYmkJdeBCYSNAAMRAqpgAJ4l2OG8t4xVjGtFRgRxo4wX6s9MPACgk2Cn
isOYt/tlqesIFGKGRcwpd08=
=vVM7
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patience_tuples.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20071204/84595245/attachment-0001.diff
More information about the bazaar
mailing list