Bug report
Bug description:
test = defaultdict(set) #sets default factory method
test['ok'].add(1) # this is ok
test.setdefault('not_ok') # this should use the default factory method, dry principle
test['not_ok'].add(1) # error here, NoneType doesn't have add method :(
_ = test['ok2'] # this is a workaround to add a key using default factory
CPython versions tested on:
3.12
Operating systems tested on:
Windows