Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Missing NonLocalVariableRead from dictionary access #301

Open
lukarade opened this issue Aug 30, 2024 · 0 comments
Open

Missing NonLocalVariableRead from dictionary access #301

lukarade opened this issue Aug 30, 2024 · 0 comments
Labels
bug 🪲 Something isn't working purity Inferring the purity of functions

Comments

@lukarade
Copy link
Contributor

Describe the bug

The NonLocalVariableRead caused by accessing the instance variable self._dict in the following function was not detected.

# matplotlib.spines.__getattr__.551.4
def __getattr__(self, name):
    try:
        return self._dict[name] # Impure NonLocalVariableRead
    except KeyError:
        raise AttributeError(f"'Spines' object does not contain a '{name}' spine")

To Reproduce

  1. Run purity analysis on the matplotlib library
  2. Check the result file for the function: matplotlib.spines.getattr.551.4

Expected behavior

This should be detected even though it is access of the dictionary.

Screenshots (optional)

No response

Additional Context (optional)

No response

@lukarade lukarade added bug 🪲 Something isn't working purity Inferring the purity of functions labels Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🪲 Something isn't working purity Inferring the purity of functions
Projects
Status: Backlog
Development

No branches or pull requests

1 participant