Fixed #23968 -- Replace list comprehension with generator comprehension when possible

You may want to send this change to upstream.