When calling to_info_dict on a ParamType instance which doesn't have a name attribute, an exception is raised. While this is a bug in the downstream code, only to_info_dict is affected, so the bug often goes unnoticed.
class TestType(click.ParamType):
pass
TestType().to_info_dict()
> return {"param_type": param_type, "name": self.name}
E AttributeError: 'TestType' object has no attribute 'name'
src/click/types.py:66: AttributeError
It would be nice to have some sort of reasonable fallback. I've put coded such possibility at main...phy1729:fix-ParamType-no-name . I also fixed where the docs neglected to specify name in an example.
Environment:
- Python version: Python 3.9.9
- Click version: 8.0.3
When calling
to_info_dicton aParamTypeinstance which doesn't have anameattribute, an exception is raised. While this is a bug in the downstream code, onlyto_info_dictis affected, so the bug often goes unnoticed.It would be nice to have some sort of reasonable fallback. I've put coded such possibility at main...phy1729:fix-ParamType-no-name . I also fixed where the docs neglected to specify
namein an example.Environment: