summaryrefslogtreecommitdiffstats
path: root/Misc/NEWS.d
diff options
context:
space:
mode:
authorGregory P. Smith <gps@google.com>2020-03-05 00:45:22 (GMT)
committerGitHub <noreply@github.com>2020-03-05 00:45:22 (GMT)
commit85cf1d514b84dc9a4bcb40e20a12e1d82ff19f20 (patch)
tree4d97683755d61456848d3cd1e94c218c46110f74 /Misc/NEWS.d
parentd4a09c13ddd91a9bc1b4ba76ff4e8a153334a1e2 (diff)
downloadcpython-85cf1d514b84dc9a4bcb40e20a12e1d82ff19f20.zip
cpython-85cf1d514b84dc9a4bcb40e20a12e1d82ff19f20.tar.gz
cpython-85cf1d514b84dc9a4bcb40e20a12e1d82ff19f20.tar.bz2
bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)
`list(sys.modules.items())` was apparently not immune to "dictionary changed size during iteration" errors. Tested internally using an integration test that has run into this a couple of times in the past two years. With this patch applied, the test is no longer flaky.
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r--Misc/NEWS.d/next/Library/2020-03-04-16-10-59.bpo-13487.gqe4Fb.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2020-03-04-16-10-59.bpo-13487.gqe4Fb.rst b/Misc/NEWS.d/next/Library/2020-03-04-16-10-59.bpo-13487.gqe4Fb.rst
new file mode 100644
index 0000000..5a1f02a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-03-04-16-10-59.bpo-13487.gqe4Fb.rst
@@ -0,0 +1,3 @@
+Avoid a possible *"RuntimeError: dictionary changed size during iteration"*
+from :func:`inspect.getmodule` when it tried to loop through
+:attr:`sys.modules`.