I don't care about the implementation, but about the interface. What does "invalid" mean here? If the module were named IPv4Netmask then it would be clear that "invalid" includes IPv6. But the module handles IPv6 too and the bug fix concerns it, so the docs should be explicit about IPv6: 
>Convert netmask in bits form (20) to IPv4 netmask string ("255.255.240.0").

Clearly documenting the interface like this also makes us realize that this commit is not necessary to fix the bug (and left alone, only solves some of the cases). It is still OK to have it because it produces consistent output in the corner case.