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

KeyError in _set_proxied with getset_descriptor class #2517

Closed
correctmost opened this issue Aug 26, 2024 · 1 comment
Closed

KeyError in _set_proxied with getset_descriptor class #2517

correctmost opened this issue Aug 26, 2024 · 1 comment

Comments

@correctmost
Copy link
Contributor

Steps to reproduce

The following code triggers a KeyError in astroid:

dict.fromkeys.__doc__.c=p

This bug was discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62324 (report not public yet)

Current behavior

Traceback (most recent call last):
  File "pylint/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "pylint/pylint/checkers/classes/class_checker.py", line 1739, in visit_assignattr
    self._check_in_slots(node)
  File "pylint/pylint/checkers/classes/class_checker.py", line 1774, in _check_in_slots
    inferred = safe_infer(node.expr)
               ^^^^^^^^^^^^^^^^^^^^^
  File "pylint/pylint/checkers/utils.py", line 1372, in safe_infer
    inferred_types.add(_get_python_type_of_node(value))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pylint/pylint/checkers/utils.py", line 1339, in _get_python_type_of_node
    return pytype()
           ^^^^^^^^
  File "astroid/astroid/nodes/node_classes.py", line 2159, in pytype
    return self._proxied.qname()
           ^^^^^^^^^^^^^
  File "astroid/astroid/raw_building.py", line 596, in _set_proxied
    return _CONST_PROXY[const.value.__class__]
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: <class 'getset_descriptor'>

Expected behavior

No crash

Version

d8dbc46

@correctmost
Copy link
Contributor Author

The crash was fixed by 523eeb4.

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

No branches or pull requests

2 participants