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

Potential bug computing len of argspec.defaults #51

Open
slothyrulez opened this issue Nov 29, 2021 · 0 comments
Open

Potential bug computing len of argspec.defaults #51

slothyrulez opened this issue Nov 29, 2021 · 0 comments

Comments

@slothyrulez
Copy link

TypeError object of type 'NoneType' has no len()

https://docs.python.org/3.8/library/inspect.html?highlight=inspect#inspect.getfullargspec
https://docs.python.org/3.8/library/inspect.html?highlight=inspect#inspect.getargspec

defaults is an n-tuple of default argument values corresponding to the last n positional parameters, or None if there are no such defaults defined

https://github.com/unhaggle/django-memoize/blob/1ca9af73adf3e5e336aafe85b82993a0a3a66a77/memoize/__init__.py?_pjax=%23repo-content-pjax-container#L250

elif abs(i - args_len) <= len(argspec.defaults)

Possible fix:

elif abs(i - args_len) <= len(argspec.defaults if argspec.defaults else [])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant