Skip to content

Commit 204cbe4

Browse files
committed
interrogate: support unicode characters in Python 3 for 'char' arg
Fixes panda3d#626
1 parent 9512187 commit 204cbe4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

dtool/src/interrogate/interfaceMakerPythonNative.cxx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4937,13 +4937,14 @@ write_function_instance(ostream &out, FunctionRemap *remap,
49374937
expected_params += "NoneType";
49384938

49394939
} else if (TypeManager::is_char(type)) {
4940-
indent(out, indent_level) << "char " << param_name << default_expr << ";\n";
4940+
indent(out, indent_level) << "char *" << param_name << "_str;\n";
4941+
indent(out, indent_level) << "Py_ssize_t " << param_name << "_len;\n";
49414942

4942-
format_specifiers += "c";
4943-
parameter_list += ", &" + param_name;
4943+
format_specifiers += "s#";
4944+
parameter_list += ", &" + param_name + "_str, &" + param_name + "_len";
4945+
extra_param_check << " && " << param_name << "_len == 1";
49444946

4945-
// extra_param_check << " && isascii(" << param_name << ")";
4946-
pexpr_string = "(char) " + param_name;
4947+
pexpr_string = param_name + "_str[0]";
49474948
expected_params += "char";
49484949
only_pyobjects = false;
49494950

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy