Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.10] gh-91577: SharedMemory move imports out of methods (GH-91579) #93905

Merged
merged 1 commit into from
Jun 16, 2022

Conversation

miss-islington
Copy link
Contributor

SharedMemory.unlink() uses the unregister() function from resource_tracker. Previously it was imported in the method, but this can fail if the method is called during interpreter shutdown, for example when unlink is part of a del() method.

Moving the import to the top of the file, means that the unregister() method is available during interpreter shutdown.

The register call in SharedMemory.init() can also use this imported resource_tracker.
(cherry picked from commit 9a458be)

Co-authored-by: samtygier samtygier@yahoo.co.uk

)

SharedMemory.unlink() uses the unregister() function from resource_tracker. Previously it was imported in the method, but this can fail if the method is called during interpreter shutdown, for example when unlink is part of a __del__() method.

Moving the import to the top of the file, means that the unregister() method is available during interpreter shutdown.

The register call in SharedMemory.__init__() can also use this imported resource_tracker.
(cherry picked from commit 9a458be)

Co-authored-by: samtygier <samtygier@yahoo.co.uk>
@miss-islington
Copy link
Contributor Author

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

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good bot.

@miss-islington
Copy link
Contributor Author

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

@miss-islington miss-islington merged commit 5c10c36 into python:3.10 Jun 16, 2022
@miss-islington miss-islington deleted the backport-9a458be-3.10 branch June 16, 2022 14:07
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.

4 participants