diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-09-16 18:23:51 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:17:15 -0300 |
commit | cbfebc05a591a2370c3fad044e7a45a305c8ba4a (patch) | |
tree | a21742a87815907bfa004813dfa98bbf63ae8af4 /generator | |
parent | 2cc05efe4c28c90d5dd6126d251f5ca9a9ebde07 (diff) |
Use PyBytes instead of PyString on generated code.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/cppgenerator.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index d54a02ab6..2a1badf0e 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -1441,6 +1441,8 @@ void CppGenerator::writeErrorSection(QTextStream& s, OverloadData& overloadData) strArg = "unicode"; else if (strArg == "PyString") strArg = "str"; + else if (strArg == "PyBytes") + strArg = "\"SBK_STR_NAME\""; else if (strArg == "PySequece") strArg = "list"; else if (strArg == "PyTuple") @@ -3705,7 +3707,7 @@ void CppGenerator::writeGetattroFunction(QTextStream& s, const AbstractMetaClass } s << INDENT << '}' << endl; - s << INDENT << "const char* cname = PyString_AS_STRING(name);" << endl; + s << INDENT << "const char* cname = PyBytes_AS_STRING(name);" << endl; foreach (const AbstractMetaFunction* func, getMethodsWithBothStaticAndNonStaticMethods(metaClass)) { s << INDENT << "if (strcmp(cname, \"" << func->name() << "\") == 0)" << endl; Indentation indent(INDENT); @@ -4195,12 +4197,12 @@ QString CppGenerator::writeReprFunction(QTextStream& s, const AbstractMetaClass* s << INDENT << "if (mod)" << endl; { Indentation indent(INDENT); - s << INDENT << "return PyString_FromFormat(\"<%s.%s at %p>\", PyString_AS_STRING(mod), str.constData(), self);" << endl; + s << INDENT << "return PyBytes_FromFormat(\"<%s.%s at %p>\", PyBytes_AS_STRING(mod), str.constData(), self);" << endl; } s << INDENT << "else" << endl; { Indentation indent(INDENT); - s << INDENT << "return PyString_FromFormat(\"<%s at %p>\", str.constData(), self);" << endl; + s << INDENT << "return PyBytes_FromFormat(\"<%s at %p>\", str.constData(), self);" << endl; } s << '}' << endl; s << "} // extern C" << endl << endl;; |