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

Missing NonLocalVariableRead and NonLocalVariableWrite in @property functions #300

Open
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

In (some) @property functions, the access to other properties of the class are not detected as reasons for impurity.

Examples:

# seaborn_v0.12.2.external.version.is_devrelease.334.4
@property
def is_devrelease(self) -> bool:
    return self.dev is not None # Impure Read from property dev is not detected
# pandas_v2.0.3.core.arrays.sparse.array.nbytes.667.4
@property
def nbytes(self) -> int:
    return self.sp_values.nbytes + self.sp_index.nbytes # Impure Read from property sp_values and sp_index is not detected

To Reproduce

  1. Run purity analysis on the libraries
  2. Check the result file

Expected behavior

Access of propertys are impure and therefore must be detected as impure.
Therefore a special case needs to be implemented to deal with that.

Screenshots (optional)

No response

Additional Context (optional)

Since the tests were only done for a sample of functions, there could be more functions with the same problem.

@lukarade lukarade added bug 🪲 Something isn't working purity Inferring the purity of functions labels Aug 30, 2024
@lukarade lukarade changed the title Missing 'NonLocalVariableRead' or NonLocalVariableWrite in @property functions Missing NonLocalVariableRead and NonLocalVariableWrite in @property functions 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