Make sure `kwargs=None` is properly handled. Fixes #16945.

Ouch!