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.
diff --git a/Misc/ACKS b/Misc/ACKS
index 5d75404..4effde3 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -905,6 +905,7 @@
 Frank J. Tobin
 R Lindsay Todd
 Bennett Todd
+Erik Tollerud
 Matias Torchinsky
 Sandro Tosi
 Richard Townsend
diff --git a/Misc/NEWS b/Misc/NEWS
index f79e57a..2172853 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -87,6 +87,9 @@
 Library
 -------
 
+- Issue #13487: Make inspect.getmodule robust against changes done to
+  sys.modules while it is iterating over it.
+
 - Issue #12618: Fix a bug that prevented py_compile from creating byte
   compiled files in the current directory.  Initial patch by Sjoerd de Vries.