diff options
author | Christian Tismer <tismer@stackless.com> | 2018-08-13 01:50:26 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2018-08-21 13:50:37 +0000 |
commit | 28e82039e7b0c611f78d4b15dc7fb2ba232bb76c (patch) | |
tree | 365788a607ffa679645d20ee81c94b99269faec3 /sources/shiboken2/libshiboken/pep384impl.h | |
parent | 877c9be79d660fe1317a6fb46c585fb688abc21e (diff) |
Implement Proper Name Mangling
When types have attributes starting with two underscores but
ending with at most one, Python uses name mangling to create
a unique private variable.
PySide needs to obey this rule in the tp_getattro methods.
We implemented it as an optimized _Pep_PrivateMangle function that
solves the problem internally without exposing the _Py_Mangle
function.
Remark: I think the exclusion of the _Py_Mangle function is another
oversight in the Limited API.
Task-number: PYSIDE-772
Change-Id: I0bfc2418dae439e963a16e37443f2099c6980696
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken2/libshiboken/pep384impl.h')
-rw-r--r-- | sources/shiboken2/libshiboken/pep384impl.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h index d06947f06..b566a6218 100644 --- a/sources/shiboken2/libshiboken/pep384impl.h +++ b/sources/shiboken2/libshiboken/pep384impl.h @@ -452,6 +452,15 @@ LIBSHIBOKEN_API PyObject *PyTime_FromTime( /***************************************************************************** * + * Extra support for name mangling + * + */ + +// PYSIDE-772: This function supports the fix, but is not meant as public. +LIBSHIBOKEN_API PyObject *_Pep_PrivateMangle(PyObject *self, PyObject *name); + +/***************************************************************************** + * * Extra support for signature.cpp * */ |