category_redirect.py: convert dict_keys to list when iterating
category_redirect.py: convert dict_keys to list when iterating

In Python 3, dict.keys() is a dynamic iterator that checks the dict
to ensure it is not modified during the iterations, so Python is able
to use less memory as it does not have to always construct the whole
list like in Python 2. Converting it to a list will make it behave
like Python 2, where the list of keys is static, with a larger
memory use.

Since the entire dict is in memory and nobody complained while they
are running this script in Python 2, it's probably safe to assume
the additional memory overhead is not too bad and we don't have to
make famcy code to avoid list().

Bug: T188850
Change-Id: I44f934396398799a1478e4cd3ccf8ecee9b86397

PersianWikipedia/pywikibot-core,wikimedia/pywikibot-core,wikimedia/pywikibot-core