@niemeyer: I think you're right; in at least some places psycopg2 definitely creates its errors directly from C without fetching the class from the Python namespace.
I spent some time thinking about this today, because it would be worthwhile for Launchpad to start using PostgreSQL's json type (see https://code.launchpad.net/~cjwatson/launchpad/db-distroseries-publishing-options/+merge/278241), but psycopg2 only added support for adapting that in 2.5, which causes us to run into this bug. It occurred to me that we could use the isinstance/issubclass customisation added in Python 2.6 for abc.ABCMeta, and I later noticed https://bugs.launchpad.net/storm/+bug/1006711 which suggests the same thing. Could you review https://code.launchpad.net/~cjwatson/storm/psycopg-2.5/+merge/278330 which implements this?
@niemeyer: I think you're right; in at least some places psycopg2 definitely creates its errors directly from C without fetching the class from the Python namespace.
I spent some time thinking about this today, because it would be worthwhile for Launchpad to start using PostgreSQL's json type (see https:/ /code.launchpad .net/~cjwatson/ launchpad/ db-distroseries -publishing- options/ +merge/ 278241), but psycopg2 only added support for adapting that in 2.5, which causes us to run into this bug. It occurred to me that we could use the isinstance/ issubclass customisation added in Python 2.6 for abc.ABCMeta, and I later noticed https:/ /bugs.launchpad .net/storm/ +bug/1006711 which suggests the same thing. Could you review https:/ /code.launchpad .net/~cjwatson/ storm/psycopg- 2.5/+merge/ 278330 which implements this?