@@ -125,7 +125,7 void ShellImplGenerator::write(QTextStream &s, const AbstractMetaClass *meta_cla | |||||
125 | AbstractMetaArgumentList args = fun->arguments(); |
|
125 | AbstractMetaArgumentList args = fun->arguments(); | |
126 |
|
126 | |||
127 | s << "if (_wrapper && (_wrapper->ob_refcnt > 0)) {" << endl; |
|
127 | s << "if (_wrapper && (_wrapper->ob_refcnt > 0)) {" << endl; | |
128 | s << " static PyObject* name = PyString_FromString(\"" << fun->name() << "\");" << endl; |
|
128 | s << "#ifdef PY3K\n static PyObject* name = PyUnicode_FromString(\"" << fun->name() << "\");\n#else\n static PyObject* name = PyString_FromString(\"" << fun->name() << "\");\n#endif" << endl; | |
129 | s << " PyObject* obj = PyBaseObject_Type.tp_getattro((PyObject*)_wrapper, name);" << endl; |
|
129 | s << " PyObject* obj = PyBaseObject_Type.tp_getattro((PyObject*)_wrapper, name);" << endl; | |
130 | s << " if (obj) {" << endl; |
|
130 | s << " if (obj) {" << endl; | |
131 | s << " static const char* argumentList[] ={\""; |
|
131 | s << " static const char* argumentList[] ={\""; |
@@ -353,7 +353,11 | |||||
353 | <inject-code class="pywrap-h"> |
|
353 | <inject-code class="pywrap-h"> | |
354 | PyObject* data(QByteArray* b) { |
|
354 | PyObject* data(QByteArray* b) { | |
355 | if (b->data()) { |
|
355 | if (b->data()) { | |
|
356 | #ifdef PY3K | |||
|
357 | return PyUnicode_FromStringAndSize(b->data(), b->size()); | |||
|
358 | #else | |||
356 | return PyString_FromStringAndSize(b->data(), b->size()); |
|
359 | return PyString_FromStringAndSize(b->data(), b->size()); | |
|
360 | #endif | |||
357 | } else { |
|
361 | } else { | |
358 | Py_INCREF(Py_None); |
|
362 | Py_INCREF(Py_None); | |
359 | return Py_None; |
|
363 | return Py_None; |
@@ -1163,7 +1163,11 | |||||
1163 |
|
1163 | |||
1164 | <inject-code class="pywrap-h"> |
|
1164 | <inject-code class="pywrap-h"> | |
1165 | PyObject* data(QByteArray* b) { |
|
1165 | PyObject* data(QByteArray* b) { | |
|
1166 | #ifdef PY3K | |||
|
1167 | return PyUnicode_FromStringAndSize(b->data(), b->size()); | |||
|
1168 | #else | |||
1166 | return PyString_FromStringAndSize(b->data(), b->size()); |
|
1169 | return PyString_FromStringAndSize(b->data(), b->size()); | |
|
1170 | #endif | |||
1167 | } |
|
1171 | } | |
1168 | </inject-code> |
|
1172 | </inject-code> | |
1169 |
|
1173 | |||
@@ -1948,7 +1952,11 | |||||
1948 | r.resize(len); |
|
1952 | r.resize(len); | |
1949 | int result = d->readRawData(r.data(), r.size()); |
|
1953 | int result = d->readRawData(r.data(), r.size()); | |
1950 | if (result>=0) { |
|
1954 | if (result>=0) { | |
|
1955 | #ifdef PY3K | |||
|
1956 | return PyUnicode_FromStringAndSize(r.data(), result); | |||
|
1957 | #else | |||
1951 | return PyString_FromStringAndSize(r.data(), result); |
|
1958 | return PyString_FromStringAndSize(r.data(), result); | |
|
1959 | #endif | |||
1952 | } else { |
|
1960 | } else { | |
1953 | Py_INCREF(Py_None); |
|
1961 | Py_INCREF(Py_None); | |
1954 | return Py_None; |
|
1962 | return Py_None; |
@@ -359,7 +359,11 | |||||
359 | <inject-code class="pywrap-h"> |
|
359 | <inject-code class="pywrap-h"> | |
360 | PyObject* data(QByteArray* b) { |
|
360 | PyObject* data(QByteArray* b) { | |
361 | if (b->data()) { |
|
361 | if (b->data()) { | |
362 | return PyString_FromStringAndSize(b->data(), b->size()); |
|
362 | #ifdef PY3K | |
|
363 | return PyUnicode_FromStringAndSize(b->data(), b->size()); | |||
|
364 | #else | |||
|
365 | return PyString_FromStringAndSize(b->data(), b->size()); | |||
|
366 | #endif | |||
363 | } else { |
|
367 | } else { | |
364 | Py_INCREF(Py_None); |
|
368 | Py_INCREF(Py_None); | |
365 | return Py_None; |
|
369 | return Py_None; |
@@ -1174,7 +1174,11 | |||||
1174 | <inject-code class="pywrap-h"> |
|
1174 | <inject-code class="pywrap-h"> | |
1175 | PyObject* data(QByteArray* b) { |
|
1175 | PyObject* data(QByteArray* b) { | |
1176 | if (b->data()) { |
|
1176 | if (b->data()) { | |
|
1177 | #ifdef PY3K | |||
|
1178 | return PyUnicode_FromStringAndSize(b->data(), b->size()); | |||
|
1179 | #else | |||
1177 | return PyString_FromStringAndSize(b->data(), b->size()); |
|
1180 | return PyString_FromStringAndSize(b->data(), b->size()); | |
|
1181 | #endif | |||
1178 | } else { |
|
1182 | } else { | |
1179 | Py_INCREF(Py_None); |
|
1183 | Py_INCREF(Py_None); | |
1180 | return Py_None; |
|
1184 | return Py_None; |
General Comments 0
You need to be logged in to leave comments.
Login now