python-attrs / attrs

Python Classes Without Boilerplate
https://www.attrs.org/
MIT License
5.3k stars 374 forks source link

Use an explicit comparison to None for the converter of a field #1374

Open filbranden opened 4 days ago

filbranden commented 4 days ago

Summary

Make attrs work with a converter instance that does not evaluate True. Other code spots already do an explicit comparison to None, so do that here as well. Failing to do so on a valid converter instance that is a valid callable but has a __bool__() that evaluates to False ends up trying to call _fmt_converter_call on that callable rather than on the Converter instance created from it.

Pull Request Check List

filbranden commented 23 hours ago

@hynek Would you kindly take a look whenever possible? Thanks!