CLN/ERR: use the proper exception types for the version of Python