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

'_CData' not found in <ClassDef.Union l.None at 0x7fb308fdb650>. #6027

Closed
WAvdBeek opened this issue Mar 29, 2022 · 3 comments · Fixed by #6043
Closed

'_CData' not found in <ClassDef.Union l.None at 0x7fb308fdb650>. #6027

WAvdBeek opened this issue Mar 29, 2022 · 3 comments · Fixed by #6043
Assignees
Labels
Crash 💥 A bug that makes pylint crash
Milestone

Comments

@WAvdBeek
Copy link

WAvdBeek commented Mar 29, 2022

Bug description

internal crash when doing a pylint run

full details here:

https://github.com/KNX-IOT/KNX-IOT-STACK/runs/5733695443?check_suite_focus=true

Configuration

blank

Command used

see github action

Pylint output

pylint crashed with a ``NameInferenceError`` and with the following stacktrace:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 1111, in _check_files
    self._check_file(get_ast, check_astroid_module, file)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 1146, in _check_file
    check_astroid_module(ast_node)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 1299, in check_astroid_module
    ast_node, walker, rawcheckers, tokencheckers
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/lint/pylinter.py", line 1345, in _check_astroid_module
    walker.walk(node)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/utils/ast_walker.py", line 73, in walk
    callback(astroid)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/checkers/classes/class_checker.py", line 1095, in visit_functiondef
    self._check_init(node, klass)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pylint/checkers/classes/class_checker.py", line 2004, in _check_init
    for inf_base in base.infer():
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/astroid/nodes/node_ng.py", line 168, in infer
    yield from self._infer(context=context, **kwargs)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/astroid/decorators.py", line 136, in raise_if_nothing_inferred
    yield next(generator)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/astroid/decorators.py", line 105, in wrapped
    for res in _func(node, context, **kwargs):
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/astroid/inference.py", line 213, in infer_name
    name=self.name, scope=self.scope(), context=context
astroid.exceptions.NameInferenceError: '_CData' not found in <ClassDef.Union l.None at 0x7fb308fdb650>.

Expected behavior

no crash

Pylint version

python 3.7 (but also on others)

OS / Environment

Linux (on github)

Additional dependencies

see github action.

@WAvdBeek WAvdBeek added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 29, 2022
@DanielNoord DanielNoord added Astroid Related to astroid Needs astroid update Needs an astroid update (probably a release too) before being mergable Crash 💥 A bug that makes pylint crash and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 29, 2022
@jacobtylerwalls
Copy link
Member

Thanks for the report, bisected it to 6977e48. Does not appear to require an astroid update, just catching the InferenceError.

Reproducer (with --disable=missing-docstring --disable=empty-docstring)

from ctypes import Union

class MyUnion(Union):
    def __init__(self):
        pass

@jacobtylerwalls jacobtylerwalls removed Needs astroid update Needs an astroid update (probably a release too) before being mergable Astroid Related to astroid labels Mar 29, 2022
@jacobtylerwalls jacobtylerwalls added this to the 2.13.4 milestone Mar 29, 2022
@jacobtylerwalls
Copy link
Member

@DanielNoord would you have any interest to take a look?

@DanielNoord
Copy link
Collaborator

I'll have a look tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants