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

[analyzer] Fix uniqueing compilation commands #3635

Merged

Conversation

csordasmarton
Copy link
Contributor

We are storing unique compilation actions in a map which uses the overriden
__hash__ and __eq__ methods on the BuildAction class.

For this we used the following logic:

if action.__hash__ not in uniqued_build_actions:
    uniqued_build_actions[action.__hash__] = action

In this case we didn't called the function but we checked whether the
function is in the map. Before Python 3.9 this solution somehow worked
but in later Python versions it will not unique compilation actions properly.

To solve this problem we will use the following logic:

if action not in uniqued_build_actions:
    uniqued_build_actions[action] = action

Under the hood the Python interpreter will call the overriden dunder functions.

@csordasmarton csordasmarton added bugfix 🔨 test ☑️ Adding or refactoring tests analyzer 📈 Related to the analyze commands (analysis driver) labels Mar 23, 2022
@csordasmarton csordasmarton added this to the release 6.20.0 milestone Mar 23, 2022
We are storing unique compilation actions in a map which uses the overriden
`__hash__` and `__eq__` methods on the `BuildAction` class.

For this we used the following logic:

```py
if action.__hash__ not in uniqued_build_actions:
    uniqued_build_actions[action.__hash__] = action
```

In this case we didn't called the function but we checked whether the
function is in the map. Before `Python 3.9` this solution somehow worked
but in later Python versions it will not unique compilation actions properly.

To solve this problem we will use the following logic:

```py
if action not in uniqued_build_actions:
    uniqued_build_actions[action] = action
```

Under the hood the Python interpreter will call the overriden dunder functions.
@csordasmarton csordasmarton merged commit aa8cbbb into Ericsson:master Apr 7, 2022
@csordasmarton csordasmarton deleted the fix_compile_command_uniqueing branch April 7, 2022 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) bugfix 🔨 test ☑️ Adding or refactoring tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants