I'm trying to build an exception class that I can use both in a C extension and the Python modules that import the extension.  I'm using the PyErr_NewException to create the class as a superclass of the Exception class, but I can't figure out how to create an __init__ constructor for the class.  I assume that is the best way to populate the class with the attributes I need.
You should pass a dict as the third argument to PyErr_NewException.  The dict should have an __init__ key bound to your initializer function.
Trying to build a Python class in a C extension that can be instantiated from a Python module