Skip to content

[3.7] bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)#18788

Merged
miss-islington merged 1 commit intopython:3.7from
miss-islington:backport-85cf1d5-3.7
Mar 5, 2020
Merged

[3.7] bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)#18788
miss-islington merged 1 commit intopython:3.7from
miss-islington:backport-85cf1d5-3.7

Conversation

@miss-islington
Copy link
Copy Markdown
Contributor

@miss-islington miss-islington commented Mar 5, 2020

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.
(cherry picked from commit 85cf1d5)

Co-authored-by: Gregory P. Smith [email protected]

https://bugs.python.org/issue13487

Automerge-Triggered-By: @gpshead

…afety. (pythonGH-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.
(cherry picked from commit 85cf1d5)

Co-authored-by: Gregory P. Smith <[email protected]>
@gpshead
Copy link
Copy Markdown
Member

gpshead commented Mar 5, 2020

Assigned to Ned so he can approve this when the 3.7 branch is ready for changes post 3.7.7 release.

@ned-deily
Copy link
Copy Markdown
Member

@gpshead, There's no need to wait, apply away. I carefully cherry-pick what goes into a final release :)

@miss-islington
Copy link
Copy Markdown
Contributor Author

@gpshead: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit a123812 into python:3.7 Mar 5, 2020
@miss-islington miss-islington deleted the backport-85cf1d5-3.7 branch March 5, 2020 01:03
@miss-islington
Copy link
Copy Markdown
Contributor Author

@gpshead: Status check is done, and it's a success ✅ .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants