warn when default is None and non-optional converter is used

Open
#385 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start by reading the optional converter work introduced in #173 and reproduce the Breaks example from the issue. Trace where converter and default validation are handled, then add a regression test showing that a non-optional converter with default=None produces a warning rather than failing only when the attribute is later used.

Written by the indexing model from the issue text.

Description

Feature

#173 introduced optional converters

i noted that attrs doesnt warm if one uses plain types as converters, but just breaks on use later

aka

@attr.s
class Breaks(object):
  bad = attr.ib(default=None, convert=int)
Dominant language
Python
Stars
5.8k
Forks
480
Avg merge
2h 15m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-attrs/attrs

All issues in python-attrs/attrs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.