diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-12-15 14:38:01 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-12-16 15:05:20 +0100 |
| commit | b6d8b5f77f5721d8b43c9d7b14f0c2aa15a519a0 (patch) | |
| tree | d10d746908c3c7d43cad7d76ed46b8ff274f60d8 /sources/pyside6/libpyside | |
| parent | 0d0ffa51609670d3a034c0b5ac5d2b6855bf9372 (diff) | |
libpyside: Rename the static strings
Shiboken::Py(Magic)Name needs to be disambiguated from
PySide::Py(Magic)Name as otherwise
using namespace Shiboken;
using namespace PySide;
leads to ambiguities in jumbo builds.
Task-number: PYSIDE-2155
Change-Id: I7ffd1c9325f9c9a83be8ef797aebb096cc15f593
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside')
| -rw-r--r-- | sources/pyside6/libpyside/feature_select.cpp | 8 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/globalreceiverv2.cpp | 8 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pyside.cpp | 12 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pysidesignal.cpp | 22 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pysidestaticstrings.cpp | 4 | ||||
| -rw-r--r-- | sources/pyside6/libpyside/pysidestaticstrings.h | 4 |
6 files changed, 29 insertions, 29 deletions
diff --git a/sources/pyside6/libpyside/feature_select.cpp b/sources/pyside6/libpyside/feature_select.cpp index c12869777..b3b692578 100644 --- a/sources/pyside6/libpyside/feature_select.cpp +++ b/sources/pyside6/libpyside/feature_select.cpp @@ -129,18 +129,18 @@ static void ensureNewDictType() static inline PyObject *nextInCircle(PyObject *dict) { // returns a borrowed ref - AutoDecRef next_dict(PyObject_GetAttr(dict, PyName::dict_ring())); + AutoDecRef next_dict(PyObject_GetAttr(dict, PySideName::dict_ring())); return next_dict; } static inline void setNextDict(PyObject *dict, PyObject *next_dict) { - PyObject_SetAttr(dict, PyName::dict_ring(), next_dict); + PyObject_SetAttr(dict, PySideName::dict_ring(), next_dict); } static inline void setSelectId(PyObject *dict, int select_id) { - PyObject_SetAttr(dict, PyName::select_id(), PyLong_FromLong(select_id)); + PyObject_SetAttr(dict, PySideName::select_id(), PyLong_FromLong(select_id)); } static inline int getSelectId(PyObject *dict) @@ -585,7 +585,7 @@ PyObject *adjustPropertyName(PyObject *dict, PyObject *name) if (PyList_CheckExact(sig)) { name_clash = true; } else { - Shiboken::AutoDecRef params(PyObject_GetAttr(sig, PyName::parameters())); + Shiboken::AutoDecRef params(PyObject_GetAttr(sig, PySideName::parameters())); // Are there parameters except self or cls? if (PyObject_Size(params.object()) > 1) name_clash = true; diff --git a/sources/pyside6/libpyside/globalreceiverv2.cpp b/sources/pyside6/libpyside/globalreceiverv2.cpp index a72455289..8289eaff6 100644 --- a/sources/pyside6/libpyside/globalreceiverv2.cpp +++ b/sources/pyside6/libpyside/globalreceiverv2.cpp @@ -78,10 +78,10 @@ DynamicSlotDataV2::DynamicSlotDataV2(PyObject *callback, GlobalReceiverV2 *paren // PYSIDE-1523: PyMethod_Check is not accepting compiled form, we just go by attributes. m_isMethod = true; - m_callback = PyObject_GetAttr(callback, PySide::PyName::im_func()); + m_callback = PyObject_GetAttr(callback, PySide::PySideName::im_func()); Py_DECREF(m_callback); - m_pythonSelf = PyObject_GetAttr(callback, PySide::PyName::im_self()); + m_pythonSelf = PyObject_GetAttr(callback, PySide::PySideName::im_self()); Py_DECREF(m_pythonSelf); //monitor class from method lifetime @@ -102,8 +102,8 @@ GlobalReceiverKey DynamicSlotDataV2::key(PyObject *callback) return {PyMethod_GET_SELF(callback), PyMethod_GET_FUNCTION(callback)}; } else if (PySide::isCompiledMethod(callback)) { // PYSIDE-1589: Fix for slots in compiled functions - Shiboken::AutoDecRef self(PyObject_GetAttr(callback, PySide::PyName::im_self())); - Shiboken::AutoDecRef func(PyObject_GetAttr(callback, PySide::PyName::im_func())); + Shiboken::AutoDecRef self(PyObject_GetAttr(callback, PySide::PySideName::im_self())); + Shiboken::AutoDecRef func(PyObject_GetAttr(callback, PySide::PySideName::im_func())); return {self, func}; } return {nullptr, callback}; diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index 09acfea07..b3d88e23b 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -273,7 +273,7 @@ static bool _setProperty(PyObject *qObj, PyObject *name, PyObject *value, bool * static PyObject *magicGet = Shiboken::PyMagicName::get(); if (found && prop_flag) { // the indirection of the setter descriptor in a true property - AutoDecRef descr(PyObject_GetAttr(look, PyName::fset())); + AutoDecRef descr(PyObject_GetAttr(look, PySideName::fset())); propSetter.reset(PyObject_CallMethodObjArgs(descr, magicGet, qObj, nullptr)); } else { // look is already the descriptor @@ -530,7 +530,7 @@ PyObject *getHiddenDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *n // would create confusion with overload. // Note: before implementing this property handling, the meta function code // below created meta functions which was quite wrong. - auto *subdict = _PepType_Lookup(Py_TYPE(self), PyMagicName::property_methods()); + auto *subdict = _PepType_Lookup(Py_TYPE(self), PySideMagicName::property_methods()); PyObject *propName = PyDict_GetItem(subdict, name); if (propName) { // We really have a property name and need to fetch the fget or fset function. @@ -543,7 +543,7 @@ PyObject *getHiddenDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *n auto *trial = arr[idx]; auto *res = PyObject_GetAttr(prop, trial); if (res) { - AutoDecRef elemName(PyObject_GetAttr(res, PyMagicName::name())); + AutoDecRef elemName(PyObject_GetAttr(res, PySideMagicName::name())); // Note: This comparison works because of interned strings. if (elemName == name) return res; @@ -774,9 +774,9 @@ QString pyPathToQString(PyObject *path) bool isCompiledMethod(PyObject *callback) { - return PyObject_HasAttr(callback, PySide::PyName::im_func()) - && PyObject_HasAttr(callback, PySide::PyName::im_self()) - && PyObject_HasAttr(callback, PySide::PyMagicName::code()); + return PyObject_HasAttr(callback, PySide::PySideName::im_func()) + && PyObject_HasAttr(callback, PySide::PySideName::im_self()) + && PyObject_HasAttr(callback, PySide::PySideMagicName::code()); } static const unsigned char qt_resource_name[] = { diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp index d7d38d081..5df42261c 100644 --- a/sources/pyside6/libpyside/pysidesignal.cpp +++ b/sources/pyside6/libpyside/pysidesignal.cpp @@ -373,20 +373,20 @@ static void extractFunctionArgumentsFromSlot(PyObject *slot, // just go by attributes. isMethod = true; - function = PyObject_GetAttr(slot, PySide::PyName::im_func()); + function = PyObject_GetAttr(slot, PySide::PySideName::im_func()); // Not retaining a reference inline with what PyMethod_GET_FUNCTION does. Py_DECREF(function); if (functionName != nullptr) { - PyObject *name = PyObject_GetAttr(function, PySide::PyMagicName::name()); + PyObject *name = PyObject_GetAttr(function, PySide::PySideMagicName::name()); *functionName = Shiboken::String::toCString(name); // Not retaining a reference inline with what PepFunction_GetName does. Py_DECREF(name); } objCode = reinterpret_cast<PepCodeObject *>( - PyObject_GetAttr(function, PySide::PyMagicName::code())); + PyObject_GetAttr(function, PySide::PySideMagicName::code())); // Not retaining a reference inline with what PyFunction_GET_CODE does. Py_XDECREF(objCode); @@ -401,14 +401,14 @@ static void extractFunctionArgumentsFromSlot(PyObject *slot, function = slot; if (functionName != nullptr) { - PyObject *name = PyObject_GetAttr(function, PySide::PyMagicName::name()); + PyObject *name = PyObject_GetAttr(function, PySide::PySideMagicName::name()); *functionName = Shiboken::String::toCString(name); // Not retaining a reference inline with what PepFunction_GetName does. Py_DECREF(name); } objCode = reinterpret_cast<PepCodeObject *>( - PyObject_GetAttr(function, PySide::PyMagicName::code())); + PyObject_GetAttr(function, PySide::PySideMagicName::code())); // Not retaining a reference inline with what PyFunction_GET_CODE does. Py_XDECREF(objCode); @@ -525,7 +525,7 @@ static PyObject *signalInstanceConnect(PyObject *self, PyObject *args, PyObject if (match) { Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); Shiboken::AutoDecRef pyMethod(PyObject_GetAttr(source->d->source, - PySide::PyName::qtConnect())); + PySide::PySideName::qtConnect())); if (pyMethod.isNull()) { // PYSIDE-79: check if pyMethod exists. PyErr_SetString(PyExc_RuntimeError, "method 'connect' vanished!"); return nullptr; @@ -579,7 +579,7 @@ static PyObject *signalInstanceEmit(PyObject *self, PyObject *args) PyList_Append(pyArgs, PyTuple_GetItem(args, i)); Shiboken::AutoDecRef pyMethod(PyObject_GetAttr(source->d->source, - PySide::PyName::qtEmit())); + PySide::PySideName::qtEmit())); Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); return PyObject_CallObject(pyMethod.object(), tupleArgs); @@ -653,7 +653,7 @@ static PyObject *signalInstanceDisconnect(PyObject *self, PyObject *args) if (match) { Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs)); Shiboken::AutoDecRef pyMethod(PyObject_GetAttr(source->d->source, - PySide::PyName::qtDisconnect())); + PySide::PySideName::qtDisconnect())); PyObject *result = PyObject_CallObject(pyMethod, tupleArgs); if (!result || result == Py_True) return result; @@ -981,7 +981,7 @@ PySideSignalInstance *initialize(PySideSignal *self, PyObject *name, PyObject *o bool connect(PyObject *source, const char *signal, PyObject *callback) { Shiboken::AutoDecRef pyMethod(PyObject_GetAttr(source, - PySide::PyName::qtConnect())); + PySide::PySideName::qtConnect())); if (pyMethod.isNull()) return false; @@ -1248,8 +1248,8 @@ QString codeCallbackName(PyObject *callback, const QString &funcName) // PYSIDE-1523: Handle the compiled case. if (PySide::isCompiledMethod(callback)) { // Not retaining references inline with what PyMethod_GET_(SELF|FUNC) does. - Shiboken::AutoDecRef self(PyObject_GetAttr(callback, PySide::PyName::im_self())); - Shiboken::AutoDecRef func(PyObject_GetAttr(callback, PySide::PyName::im_func())); + Shiboken::AutoDecRef self(PyObject_GetAttr(callback, PySide::PySideName::im_self())); + Shiboken::AutoDecRef func(PyObject_GetAttr(callback, PySide::PySideName::im_func())); return funcName + QString::number(quint64(self), 16) + QString::number(quint64(func), 16); } return funcName + QString::number(quint64(callback), 16); diff --git a/sources/pyside6/libpyside/pysidestaticstrings.cpp b/sources/pyside6/libpyside/pysidestaticstrings.cpp index 637e184be..92f4b204c 100644 --- a/sources/pyside6/libpyside/pysidestaticstrings.cpp +++ b/sources/pyside6/libpyside/pysidestaticstrings.cpp @@ -13,7 +13,7 @@ PyObject *funcName() \ namespace PySide { -namespace PyName +namespace PySideName { STATIC_STRING_IMPL(qtConnect, "connect") STATIC_STRING_IMPL(qtDisconnect, "disconnect") @@ -27,7 +27,7 @@ STATIC_STRING_IMPL(parameters, "parameters") STATIC_STRING_IMPL(property, "property") STATIC_STRING_IMPL(select_id, "select_id") } // namespace PyName -namespace PyMagicName +namespace PySideMagicName { STATIC_STRING_IMPL(code, "__code__") STATIC_STRING_IMPL(doc, "__doc__") diff --git a/sources/pyside6/libpyside/pysidestaticstrings.h b/sources/pyside6/libpyside/pysidestaticstrings.h index eea0813a7..1514c3f45 100644 --- a/sources/pyside6/libpyside/pysidestaticstrings.h +++ b/sources/pyside6/libpyside/pysidestaticstrings.h @@ -9,7 +9,7 @@ namespace PySide { -namespace PyName +namespace PySideName { PYSIDE_API PyObject *qtConnect(); PYSIDE_API PyObject *qtDisconnect(); @@ -23,7 +23,7 @@ PYSIDE_API PyObject *parameters(); PYSIDE_API PyObject *property(); PYSIDE_API PyObject *select_id(); } // namespace PyName -namespace PyMagicName +namespace PySideMagicName { PYSIDE_API PyObject *code(); PYSIDE_API PyObject *doc(); |
