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

Bug in using cachier as a python method decorator when caching is disabled globally? #212

Closed
dphi opened this issue Apr 26, 2024 · 1 comment

Comments

@dphi
Copy link
Contributor

dphi commented Apr 26, 2024

Hi, there seems to be an issue when cachier is being used as a decorator for a method. - Or am I understanding cachier wrong?

# Python 3.12.3
import cachier  # v3.0.0

@cachier.cachier()
def test():
    return True

class Test:
    @cachier.cachier()
    def test(self):
        return True


if __name__ == "__main__":
    assert Test().test() == True  # Works
    assert test() == True         # Works
    cachier.enable_caching()
    assert Test().test() == True  # Works
    assert test() == True         # Works
    cachier.disable_caching()
    assert test() == True         # Works
    assert Test().test() == True  # TypeError: Test.test() missing 1 required positional argument: 'self'

Thanks,

Philipp

@shaypal5
Copy link
Collaborator

shaypal5 commented Aug 5, 2024

The fix for this bug was released in v3.0.1.

@shaypal5 shaypal5 closed this as completed Aug 5, 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

3 participants