Skip to content

Fix poediff and other places that use word_diff

Lasse Liehu requested to merge fix-map-in-word_diff into master

The following is from commit message:

When trying to run poediff, it failed with the following error message: Trying to insert message with empty key into catalog.

When investigating, it turned out that the problem was that function word_diff always returned empty lists even if there were differences between the old and new message. This was caused by difference in behavior of the map function between Python 2 and Python 3.

In Python 2, the function add_segment that is given as the first argument of map was always executed for all items and map returned the resulting list.

In Python 3, map returns an interator and add_segment is only called for items when they are iterated through. Wrapping the map call into a list thus forces that the function add_segment is called for all items and the resulting lists are correctly populated.

Merge request reports