--===============8476294348008220198== Content-Type: multipart/signed; boundary="nextPart3689526.4WJDJjKqkX"; micalg="pgp-sha1"; protocol="application/pgp-signature" --nextPart3689526.4WJDJjKqkX Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hello, recently it turned out that KLocalizedString in PyKDE4 is not working properly in Python 3 and Python 2. The code path hasn't changed since 2008. What it looks like is that unicode strings are passed with "ascii", then encoded with utf-8. In Py2, if this process fails fails, the object gets passed as bytes, and works.In Py3, it doesn't work because encoding with ascii raises and exception. It only works if the object is passed in bytes. IOW, unicode-containing strings that weren't manually encoded to utf-8 byte strings will not work. (analysis here: https://gist.github.com/flying-sheep/5520997 ) Ultimately, this is what the code does in PyKDE4: KLocalizedString result = base; QString *arg; int iserr = 0; for (int i=0; i < PyTuple_Size(list); i++) { PyObject *pyarg = PyTuple_GET_ITEM (list, i); // ... further down in the code } result = result.subs(*arg); sipReleaseType(arg,sipType_QString,state); arg = 0; } return result.toString(); "base" is a KlocalizedString passed to the function, and so is sipIsErr. *list is a PyObject. At least from the initial investigation, the error seems to fall here in this code. Phil, where should I look to debug this problem further? Or are there alternatives to debug these conversions so I can find the real culprit? -- Luca Beltrame - KDE Forums team KDE Science supporter GPG key ID: 6E1A4E79 --nextPart3689526.4WJDJjKqkX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJRh/ReAAoJEAE/pQtuGk55XpIP/ROSXht6RoAZkkPmJJpEQlsw nHqAZQndsvIntV2z9PZJl1TwfZtL35HS2Si1TCfYMZ4klMIYT1yIO3KnjvMQLltH IhAqFX0s3tMvTjX+BdcXW78mcKlVZiOZB+273VBloJg8E1QHUhMTVZpnNYIg+ddx EX5Fxu7A1OStBHmykMNCN01J/fCkYYkcorA9Q+a5oglfe4pEmNuy0Wtt9dyTwfNU kYrxUpMZ0dpMXy1e4lirr9RccbzGRJlWzHnKRme5BoXl3lInivjLio6mgMR5bsxh Kx1ojD7wuaxR+HwXXNQcn6ZDlqBXh440tNE2wdGScC2VMGqKm2PrVrwXzxPQYcT7 oSZclu1DpD9brkgHlDt2tJyb23v7OV3hn2WWQpSsRQHZKgrANGBY38xDV6BH8CAT dGQgurJUwnnoIAbpfG3RCipmyMEaAZ24zZcNnXslc3qikc+VN1H/Biyj1JeReouP Q+iyHE6OadKUjz0FWOBfmK9HvHJ9vvUWr0Tdmh7ikUAmWhyPqFwUh1Rk63tX4mOa 3Vp6NMITGNAF9deV7zeMY+/JqmxO1jWLOg60CrFEqfV7ArG2sy78ZdllukY6OQoC gBYrrxf4pYW0+o0nAky+L2p3j+8N42OjkzGgVb4SymmnoFh8yQVmWMmAmO5YswI1 /dLvY2FpUye1kkM6By5Q =VjdZ -----END PGP SIGNATURE----- --nextPart3689526.4WJDJjKqkX-- --===============8476294348008220198== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt --===============8476294348008220198==--