[master] fixed portability error: avoid using clear() for Python list