Explicitly catch TypeError when doing pyparsing monkeypatch check

This is follow-on to @pelson's comments in @2380.