Fix inspect.getmodule to use a copy of sys.modules for iteration (#13487).

This fixes a regression compared to 2.x, where sys.modules.items()
returns a copy, as indicated by a comment in the source.  Diagnosis and
patch by Erik Tollerud.
3 files changed