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

Wrap leave_module method in thread-safe manner #91

Merged
merged 1 commit into from
Mar 8, 2017

Conversation

jeremycarroll
Copy link
Contributor

Running:
pylint --rcfile=dev-tools/pylint.rc -j 4 myapp
resulted in an overflow with:

    with_method(orig_method, *args, **kwargs)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 44, in ignore_import_warnings_for_related_fields
    return orig_method(self, node)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 316, in wrap_func
    with_method(orig_method, *args, **kwargs)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 44, in ignore_import_warnings_for_related_fields
    return orig_method(self, node)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 316, in wrap_func
    with_method(orig_method, *args, **kwargs)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 44, in ignore_import_warnings_for_related_fields
    return orig_method(self, node)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 316, in wrap_func

...

  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 316, in wrap_func
    with_method(orig_method, *args, **kwargs)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py", line 44, in ignore_import_warnings_for_related_fields
    return orig_method(self, node)
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/pylint/checkers/variables.py", line 395, in leave_module
    if '__all__' in node.locals:
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/astroid/scoped_nodes.py", line 151, in locals
    util.attribute_to_function_warning('locals', 2.0, 'get_locals')
  File "/Users/jeremycarroll/work/syapse_apps/lib/python2.7/site-packages/astroid/util.py", line 27, in <lambda>
    return lambda *args: warnings.warn(message % args, warning, stacklevel=3)
RuntimeError: maximum recursion depth exceeded in __instancecheck__

I tracked this down to a race condition in the wrapping of the leave_module method, and this PR fixes that (there is still a race between different threads updating the method, but they no longer interfere with each other since the computation of the wrapped method is carefully guarded by the input to that computation being the original method)

@coveralls
Copy link

coveralls commented Mar 2, 2017

Coverage Status

Coverage increased (+0.05%) to 87.692% when pulling cdc0b4d on jeremycarroll:master into ed19dff on landscapeio:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 87.692% when pulling cdc0b4d on jeremycarroll:master into ed19dff on landscapeio:master.

@carlio carlio merged commit 1962e1d into pylint-dev:master Mar 8, 2017
@carlio
Copy link
Collaborator

carlio commented Mar 8, 2017

Thank you this looks like it was a pain to track down!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants