Fixed #15901 -- Wrapped all PEP-249 exceptions.