From 75fbc6de0389b7220381e386740051ea0bf97e9b Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Mon, 4 Jun 2018 16:18:28 +0200 Subject: Adapt examples to proper QByteArray constructor After correcting the QByteArray behavior, the available constructors are constraint to bytes, bytearrays, and others QByteArrays. The modified lines are methods that use the modified argument as a QByteArray (interally), that is why we now we transform them: "test value" -> b"test value" Bytes are Python 2 and 3 compatible, so it does not affect the version. The only different change is inside `schema.py` where a change was needed to encode a QByteArray into utf-8. Since this is outside our automated test, I manually test it with Python 2.7.15 and 3.6.3 on Linux. Task-number: PYSIDE-669 Change-Id: I8c12533b482150f4aee3d813dc127eb6b819549b Reviewed-by: Friedemann Kleint --- examples/xmlpatterns/schema/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/xmlpatterns/schema/schema.py') diff --git a/examples/xmlpatterns/schema/schema.py b/examples/xmlpatterns/schema/schema.py index a10cc32ce..4a24e4f30 100755 --- a/examples/xmlpatterns/schema/schema.py +++ b/examples/xmlpatterns/schema/schema.py @@ -61,7 +61,7 @@ except NameError: # Python v3. def encode_utf8(ba): - return str(ba, encoding='utf8') + return str(ba.data(), encoding='utf8') def decode_utf8(qs): return QtCore.QByteArray(bytes(qs, encoding='utf8')) -- cgit v1.2.3