-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix certain matchers breaking under multiprocessing by initializing them late #1204
Conversation
85f1e0f
to
6a29b07
Compare
libcst/matchers/_visitors.py
Outdated
@@ -366,6 +372,8 @@ def _visit_matchers( | |||
node: cst.CSTNode, | |||
metadata_resolver: cst.MetadataDependent, | |||
) -> Dict[BaseMatcherNode, Optional[cst.CSTNode]]: | |||
# Populate matchers dict if it's empty | |||
matchers = matchers or _gather_matchers(metadata_resolver) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we'll pay extra on every on_visit()
now if there are no matchers declared in the visitor/transformer. Would be worth eliminating that
6a29b07
to
4d3a3fd
Compare
Skip properties to prevent exceptions
7cf829b
to
14f4de2
Compare
To support multiprocessing on Windows/macOS Issue Instagram#1181
14f4de2
to
abf8181
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Support matcher decorators with multiprocessing on Windows/macOS.
See issue #1181 for more context.
Summary
_gather_matchers
later in the code (first time when it's needed) to ensure we initialize them in a process AFTER the "fork".Test Plan
Before
After