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 '_proxied' while running pylint==2.3.0 #2776

Comments

@plocharz-9livesdata
Copy link

plocharz-9livesdata commented Feb 28, 2019

fail_pylint.py:

import logging

logger = logging.getLogger(__name__)

try:
    pass
except Exception as e:
    logger.debug("error: {e.__class__}".format(e=e))

Steps to reproduce

  1. run pylint on file fail_pylint.py

Current behavior

Following traceback is printed:

Traceback (most recent call last):
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/astroid/bases.py", line 183, in getattr
    values = self._proxied.instance_attr(name, context)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/astroid/scoped_nodes.py", line 2311, in instance_attr
    target=self, attribute=name, context=context
astroid.exceptions.AttributeInferenceError: '__class__' not found on <ClassDef.Exception l.0 at 0x7fc0bfd85208>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/local/starfish/venv-starfish-3.6.7/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/lint.py", line 1629, in __init__
    linter.check(args)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/lint.py", line 943, in check
    self._do_check(files_or_modules)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/lint.py", line 1076, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/lint.py", line 1159, in check_astroid_module
    walker.walk(ast_node)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/utils.py", line 1303, in walk
    self.walk(child)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/utils.py", line 1303, in walk
    self.walk(child)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/utils.py", line 1303, in walk
    self.walk(child)
  [Previous line repeated 2 more times]
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/utils.py", line 1300, in walk
    cb(astroid)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/checkers/strings.py", line 357, in visit_call
    self._check_new_format(node, func)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/checkers/strings.py", line 451, in _check_new_format
    self._check_new_format_specifiers(node, fields, named_arguments)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/pylint/checkers/strings.py", line 497, in _check_new_format_specifiers
    previous = previous.getattr(specifier)[0]
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/astroid/bases.py", line 186, in getattr
    return [self.special_attributes.lookup(name)]
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/astroid/interpreter/objectmodel.py", line 115, in lookup
    return getattr(self, IMPL_PREFIX + name)
  File "/local/starfish/venv-starfish-3.6.7/lib/python3.6/site-packages/astroid/interpreter/objectmodel.py", line 586, in attr___class__
    return self._instance._proxied
AttributeError: 'NoneType' object has no attribute '_proxied'

Expected behavior

------------------------------------
Your code has been rated at 10.00/10

pylint --version output

pylint 2.3.0
astroid 2.2.0
Python 3.6.7 (v3.6.7:6ec5cf2, Oct 22 2018, 11:29:07) 
[GCC 4.8.4]
@plocharz-9livesdata plocharz-9livesdata changed the title AttributeError while running pylint==2.3.0 and astroid==2.2.0 Python 3.6 AttributeError: 'NoneType' object has no attribute '_proxied' while running pylint==2.3.0 Feb 28, 2019
PCManticore added a commit to pylint-dev/astroid that referenced this issue Feb 28, 2019
@PCManticore
Copy link
Contributor

Thanks for reporting this @plocharz-9livesdata This is fixed in astroid's master and it's going to be part of astroid 2.2.1 in a bit. Doing a pass through the regressions and planning to release a bug fix release soon.

This was referenced Mar 2, 2019
clrpackages pushed a commit to clearlinux-pkgs/astroid that referenced this issue Mar 6, 2019
….2.1

Claudiu Popa (4):
      Make sure to infer the arguments to the `slice()` builtin
      Open up 2.2.1 and add changelog entry for the slice() fix
      Correctly instantiate exception instances when inferring their attributes with objectmodel
      Prepare 2.2.1

What's New in astroid 2.2.1?
============================
Release Date: 2019-03-02

* Make sure to infer the arguments to the `slice()` builtin

 Close pylint-dev/pylint#2770

* Correctly instantiate exception instances when inferring their attributes with objectmodel

 Close pylint-dev/pylint#2776
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment