|
@@ -4819,7 +4819,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|
|
<< default_value->_str.size() << ";\n";
|
|
<< default_value->_str.size() << ";\n";
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- indent(out, indent_level) << "char *" << param_name << "_str = NULL;\n";
|
|
|
|
|
|
|
+ indent(out, indent_level) << "const char *" << param_name << "_str = NULL;\n";
|
|
|
indent(out, indent_level) << "Py_ssize_t " << param_name << "_len;\n";
|
|
indent(out, indent_level) << "Py_ssize_t " << param_name << "_len;\n";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4828,7 +4828,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|
|
// As a special hack to fix pickling in Python 3, if the method name
|
|
// As a special hack to fix pickling in Python 3, if the method name
|
|
|
// starts with py_decode_, we take a bytes object instead of a str.
|
|
// starts with py_decode_, we take a bytes object instead of a str.
|
|
|
if (remap->_cppfunc->get_local_name().substr(0, 10) == "py_decode_") {
|
|
if (remap->_cppfunc->get_local_name().substr(0, 10) == "py_decode_") {
|
|
|
- indent(out, indent_level) << "if (PyBytes_AsStringAndSize(arg, &"
|
|
|
|
|
|
|
+ indent(out, indent_level) << "if (PyBytes_AsStringAndSize(arg, (char **)&"
|
|
|
<< param_name << "_str, &" << param_name << "_len) == -1) {\n";
|
|
<< param_name << "_str, &" << param_name << "_len) == -1) {\n";
|
|
|
indent(out, indent_level + 2) << param_name << "_str = NULL;\n";
|
|
indent(out, indent_level + 2) << param_name << "_str = NULL;\n";
|
|
|
indent(out, indent_level) << "}\n";
|
|
indent(out, indent_level) << "}\n";
|
|
@@ -4838,7 +4838,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|
|
<< param_name << "_len);\n";
|
|
<< param_name << "_len);\n";
|
|
|
}
|
|
}
|
|
|
out << "#else\n"; // NB. PyString_AsStringAndSize also accepts a PyUnicode.
|
|
out << "#else\n"; // NB. PyString_AsStringAndSize also accepts a PyUnicode.
|
|
|
- indent(out, indent_level) << "if (PyString_AsStringAndSize(arg, &"
|
|
|
|
|
|
|
+ indent(out, indent_level) << "if (PyString_AsStringAndSize(arg, (char **)&"
|
|
|
<< param_name << "_str, &" << param_name << "_len) == -1) {\n";
|
|
<< param_name << "_str, &" << param_name << "_len) == -1) {\n";
|
|
|
indent(out, indent_level + 2) << param_name << "_str = NULL;\n";
|
|
indent(out, indent_level + 2) << param_name << "_str = NULL;\n";
|
|
|
indent(out, indent_level) << "}\n";
|
|
indent(out, indent_level) << "}\n";
|