marshmallow-code / marshmallow-code/marshmallow
fields.Function's _serialize method passes in obj instead of value
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
As a result, everytime you serialize a field that is a Function, it tries to serialize the containing object instead of the value.
offending code:
https://github.com/marshmallow-code/marshmallow/blob/dev/src/marshmallow/fields.py#L1803
should be:
```python
return self._call_or_raise(self.serialize_func, value, attr)
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/marshmallow/fields.py#L1803 and compare Function._serialize with the serialize_func call shown in the issue. Exercise serialization of a Function field and verify that the callback receives the field value rather than the containing object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100