mem fixes

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2009-08-23 19:16:26 +01:00
1 parent 1fcb8501e8
commit f14f0a8f20
1 file changed
+6 -4
+6 -4
View File
@@ -101,9 +101,11 @@ class CppException(object):
if self.outer_class is None:
module.after_init.write_code(
'PyModule_AddObject(m, (char *) \"%s\", (PyObject *) &%s);' % (
self.python_name, self.pytypestruct))
'Py_INCREF((PyObject *) %s);\n'
'PyModule_AddObject(m, (char *) \"%s\", (PyObject *) %s);' % (
self.pytypestruct, self.python_name, self.pytypestruct))
else:
module.after_init.write_code(
'PyDict_SetItemString((PyObject*) %s.tp_dict, (char *) \"%s\", (PyObject *) &%s);' % (
self.outer_class.pytypestruct, self.python_name, self.pytypestruct))
'Py_INCREF((PyObject *) %s);\n'
'PyDict_SetItemString((PyObject*) %s.tp_dict, (char *) \"%s\", (PyObject *) %s);' % (
self.pytypestruct, self.outer_class.pytypestruct, self.python_name, self.pytypestruct))