Now I use a common ancestor "plpy.BaseError" for plpy builtin classes. So plpy.SPIError isn't descendant of plpy.Error and then there are not possible incompatibility issues.
Instead modification builtin function plpy.debug, plpy.info, ... and introduction incompatibility I wrote new set of functions with keyword parameters (used mainly for elevel < ERROR):
plpy.raise_debug, plpy.raise_info, plpy.raise_notice, plpy.raise_warning, plpy.raise_error and plpy.raise_fatal.
With this patch we can write:
plpy.raise_warning('some is wrong', hint = 'bla bla')
raise plpy.Error(some is wrong', sqlcode = 'XX543')