PyModule_GetDict()
returns a borrowed reference. It means you must not decrease its reference count, or that the module dict will be destructed.
There are many errors in your code piece. I think you may try boost::python. And read the Python manual carefully, especially in reference count management.