inveniosoftware / inveniosoftware/flask-resources
Mutable default values for arguments
- Dominant language
- Python
- Stars
- 3
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
Package version (if known): 1.0.0
## Describe the bug
It looks like there's some mutable objects used as default values for some function arguments, e.g. a [dictionary literal here](https://github.com/inveniosoftware/flask-resources/blob/master/flask_resources/serializers/base.py#L48).
Chances are that this is [unintentional and basically a pitfall](https://towardsdatascience.com/python-pitfall-mutable-default-arguments-9385e8265422) that I think every Python programmer has fallen into at some point.
Unless this is intended, we should change the default values for arguments to something non-mutable.
Contributor guide
Research direction
Start with flask_resources/serializers/base.py around line 48, then inspect the package for other function arguments using mutable default values. Done means the unintended mutable defaults have been replaced with non-mutable defaults and the existing test suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100