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

AttributeError: 'NoneType' object has no attribute 'frame' #819

Closed
MarKett opened this issue Jul 17, 2020 · 1 comment · Fixed by #874 or PennyDreadfulMTG/Penny-Dreadful-Tools#8447
Assignees
Labels

Comments

@MarKett
Copy link

MarKett commented Jul 17, 2020

Steps to reproduce

  1. Create reproduce.py with:
class MyClass():
    def fu(self, objects):
        delitem = dict.__delitem__.__get__(self, dict)
        for k in objects:
            delitem(k)
  1. Run pylint 2.5.3 on the file.

Current behavior

Exception:

  File "D:\Program Files\Python38\lib\site-packages\pylint\lint\run.py", line 344, in __init__
    linter.check(args)
  File "D:\Program Files\Python38\lib\site-packages\pylint\lint\pylinter.py", line 870, in check
    self._check_files(
  File "D:\Program Files\Python38\lib\site-packages\pylint\lint\pylinter.py", line 904, in _check_files
    self._check_file(get_ast, check_astroid_module, name, filepath, modname)
  File "D:\Program Files\Python38\lib\site-packages\pylint\lint\pylinter.py", line 930, in _check_file
    check_astroid_module(ast_node)
  File "D:\Program Files\Python38\lib\site-packages\pylint\lint\pylinter.py", line 1062, in check_astroid_module
    retval = self._check_astroid_module(
  File "D:\Program Files\Python38\lib\site-packages\pylint\lint\pylinter.py", line 1107, in _check_astroid_module
    walker.walk(ast_node)
  File "D:\Program Files\Python38\lib\site-packages\pylint\utils\ast_walker.py", line 75, in walk
    self.walk(child)
  File "D:\Program Files\Python38\lib\site-packages\pylint\utils\ast_walker.py", line 75, in walk
    self.walk(child)
  File "D:\Program Files\Python38\lib\site-packages\pylint\utils\ast_walker.py", line 75, in walk
    self.walk(child)
  [Previous line repeated 2 more times]
  File "D:\Program Files\Python38\lib\site-packages\pylint\utils\ast_walker.py", line 72, in walk
    callback(astroid)
  File "D:\Program Files\Python38\lib\site-packages\pylint\checkers\refactoring.py", line 720, in visit_call
    self._check_raising_stopiteration_in_generator_next_call(node)
  File "D:\Program Files\Python38\lib\site-packages\pylint\checkers\refactoring.py", line 761, in _check_raising_stopiteration_in_generator_next_call
    inferred = utils.safe_infer(node.func)
  File "D:\Program Files\Python38\lib\site-packages\pylint\checkers\utils.py", line 1124, in safe_infer
    inferred_types.add(_get_python_type_of_node(value))
  File "D:\Program Files\Python38\lib\site-packages\pylint\checkers\utils.py", line 1103, in _get_python_type_of_node
    return pytype()
  File "D:\Program Files\Python38\lib\site-packages\astroid\scoped_nodes.py", line 1185, in pytype
    if "method" in self.type:
  File "D:\Program Files\Python38\lib\site-packages\astroid\decorators.py", line 72, in __get__
    val = self.wrapped(inst)
  File "D:\Program Files\Python38\lib\site-packages\astroid\scoped_nodes.py", line 1461, in type
    for decorator in self.extra_decorators:
  File "D:\Program Files\Python38\lib\site-packages\astroid\decorators.py", line 72, in __get__
    val = self.wrapped(inst)
  File "D:\Program Files\Python38\lib\site-packages\astroid\scoped_nodes.py", line 1419, in extra_decorators
    frame = self.parent.frame()
AttributeError: 'NoneType' object has no attribute 'frame'

Expected behavior

Normal pylint run without exception.

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

Python 3.8.3
Pylint 2.5.3
astroid 2.4.1

@PCManticore
Copy link
Contributor

Thanks for the report, I can reproduce the issue.

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