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

Missing node ancestors #2631

Closed
epenet opened this issue Oct 30, 2024 · 4 comments
Closed

Missing node ancestors #2631

epenet opened this issue Oct 30, 2024 · 4 comments

Comments

@epenet
Copy link

epenet commented Oct 30, 2024

Hi 👋

I've bumped into an issue in a pylint plugin at Home Assistant, where requesting ancestors from a node fails to retrieve the full list of ancestors.

I have a class defined as

class DevoloScannerEntity(
    CoordinatorEntity[DevoloDataUpdateCoordinator[list[ConnectedStationInfo]]],
    ScannerEntity,
):

I am analysing the node ancestors using ancestors = list(node.ancestors()) and some are missing!
I would expect all ancestors to be: ['CoordinatorEntity', 'BaseCoordinatorEntity', 'Entity', 'object', 'ScannerEntity', 'BaseTrackerEntity']
But the display shows: ['CoordinatorEntity', 'BaseCoordinatorEntity', 'Entity', 'object']
It is missing ScannerEntity and BaseTrackerEntity

See sample run on https://github.com/home-assistant/core/actions/runs/11589842191/job/32266212034?pr=129483

I am unsure if it is linked to pylint-dev/pylint#9138 or not.
I may be linked to the version of Python (I am unable to reproduce locally with python 3.12.3 - the CI is running python 3.12.7)
There are three instances of ValueError: generator already executing

Python 3.12.7
Exception ignored in: <generator object raise_if_nothing_inferred.<locals>.inner at 0x7f2f6ba5ae40>
Traceback (most recent call last):
  File "/home/runner/work/core/core/venv/lib/python3.12/site-packages/astroid/decorators.py", line 99, in inner
    yield from generator
ValueError: generator already executing
Exception ignored in: <generator object raise_if_nothing_inferred.<locals>.inner at 0x7f2f683ec340>
Traceback (most recent call last):
  File "/home/runner/work/core/core/venv/lib/python3.12/site-packages/astroid/decorators.py", line 99, in inner
    yield from generator
ValueError: generator already executing
Exception ignored in: <generator object raise_if_nothing_inferred.<locals>.inner at 0x7f2f06355840>
Traceback (most recent call last):
  File "/home/runner/work/core/core/venv/lib/python3.12/site-packages/astroid/decorators.py", line 99, in inner
    yield from generator
ValueError: generator already executing
...
All ancestors for homeassistant.components.devolo_home_network.device_tracker.DevoloScannerEntity: ['CoordinatorEntity', 'BaseCoordinatorEntity', 'Entity', 'object']
...
************* Module homeassistant.components.devolo_home_network.device_tracker
Warning: homeassistant/components/devolo_home_network/device_tracker.py:84:0: C7461: Derived CoordinatorEntity is recommended to be placed in the 'entity' module (hass-enforce-class-module)
...
Error: Process completed with exit code 16.
@epenet
Copy link
Author

epenet commented Oct 30, 2024

Note: it seems to be at least partly related to parallelism - as running pylint with jobs=1 makes the issue go away.
https://github.com/home-assistant/core/actions/runs/11590052863/job/32266876576
That gets rid of two ValueError: generator already executing, and causes the ancestors to be correctly retrieved

@DanielNoord
Copy link
Collaborator

Isn't this a duplicate of pylint-dev/pylint#9138?

@epenet
Copy link
Author

epenet commented Oct 30, 2024

Isn't this a duplicate of pylint-dev/pylint#9138?

As I said in the description... I am not sure!
It might be the same root cause but it also kinda feels different.

@DanielNoord
Copy link
Collaborator

Oh I'm sorry, completely overlooked that.

But yeah, I think it is very likely the same. Especially since the version and repository match. Closing this as duplicate (for now)

@DanielNoord DanielNoord closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
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