Add some more (char*) typecasts to suppress warnings with Python 2.4 and recent GCC

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2012-02-20 12:01:39 +00:00
1 parent f481166e93
commit ced5c014dc
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -1747,20 +1747,20 @@ typedef struct {
code_sink.writeln("PyTypeObject *_%s;" % self.pytypestruct)
module.after_init.write_code("/* Import the %r class from module %r */" % (self.full_name, self.import_from_module))
module.after_init.write_code("{"); module.after_init.indent()
module.after_init.write_code("PyObject *module = PyImport_ImportModule(\"%s\");" % module_name)
module.after_init.write_code("PyObject *module = PyImport_ImportModule((char*) \"%s\");" % module_name)
module.after_init.write_code(
"if (module == NULL) {\n"
" return %s;\n"
"}" % (error_retcode,))
module.after_init.write_code("_%s = (PyTypeObject*) PyObject_GetAttrString(module, \"%s\");\n"
module.after_init.write_code("_%s = (PyTypeObject*) PyObject_GetAttrString(module, (char*) \"%s\");\n"
% (self.pytypestruct, self.get_python_name()))
module.after_init.write_code("if (PyErr_Occurred()) PyErr_Clear();")
if self.typeid_map_name is not None:
code_sink.writeln("pybindgen::TypeMap *_%s;" % self.typeid_map_name)
module.after_init.write_code("/* Import the %r class type map from module %r */" % (self.full_name, self.import_from_module))
module.after_init.write_code("PyObject *_cobj = PyObject_GetAttrString(module, \"_%s\");"
module.after_init.write_code("PyObject *_cobj = PyObject_GetAttrString(module, (char*) \"_%s\");"
% (self.typeid_map_name))
module.after_init.write_code("if (_cobj == NULL) {\n"
" _%s = new pybindgen::TypeMap;\n"
+1 -1
View File
@@ -89,7 +89,7 @@ class StdMapWrapperRegistry(WrapperRegistry):
def generate_import(self, code_sink, code_block, module_pyobj_var):
code_sink.writeln("std::map<void*, PyObject*> *_%s;" % self.map_name)
code_block.write_code("PyObject *_cobj = PyObject_GetAttrString(%s, \"_%s\");"
code_block.write_code("PyObject *_cobj = PyObject_GetAttrString(%s, (char*) \"_%s\");"
% (module_pyobj_var, self.map_name))
code_block.write_code("if (_cobj == NULL) {\n"
" _%(MAP)s = NULL;\n"