[MERGE] Handle references to line data in _patiencediff_c.c properly

John Arbash Meinel john at arbash-meinel.com
Sat Aug 23 17:53:29 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lukáš Lalinský wrote:
> Dňa Ne, 2008-08-17 o 14:46 -0500, John Arbash Meinel napísal:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Lukáš Lalinský wrote:
>>> This code is called in bzrlib only with lists or tuples of strings,
>>> which works fine, because PySequence_Fast always returns the same object
>>> and so the items from PySequence_Fast_GET_ITEM will not be deleted until
>>> the original sequence is deleted. But if it's called with a sequence
>>> than needs to be converted to list (e.g. PyUnicode), the items will be
>>> garbage collected in the contructor and still used later in code (which
>>> leads to segfaults).
>>>
>>> I really don't how to write a failing test for something like this, so
>>> there are no tests in the patch. :(
>>>
>>> Lukas
>> So... just write a test that we can do PatienceDiff on a Unicode sequence.
>>
>> matcher = PatienceSequenceMatcher(u'Ab\xb5\u1234', u'....')
>> matcher.get_matching_blocks()
> 
> Ok, I've added a test that always fails with the old code.
> 
> Lukas
> 
> 

BB:approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIsECJJdeBCYSNAAMRArYfAJ49r25Pnv2WL4nxvYobaLDvY/7O6ACfWvCP
DQwpXqAKIG/b+//zFL3yMys=
=Q/VY
-----END PGP SIGNATURE-----



More information about the bazaar mailing list