PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 934 - A __getitem__ of QByteArray behaves strange
: A __getitem__ of QByteArray behaves strange
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtCore
: 1.0.4
: All All
: P3 trivial
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2011-07-16 10:34 EEST by mar.kazmierczak
Modified: 2011-07-22 22:12 EEST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mar.kazmierczak 2011-07-16 10:34:34 EEST
Example:

from PySide import QtCore
ba = QtCore.QByteArray(1, '\x00')
print ord(ba.at(0))
print ord(ba[0])

First ord works correctly while second generates an exception. For any other
characters than '\x00' it works. I suspect the __getitem__ method returns a
string instead of a character.
Comment 1 Hugo Parente Lima 2011-07-18 21:16:28 EEST
We are using
PyString_FromString() instead of PyString_FromStringAndSize( , 2)

So it's returning an empty string when the string starts with zero.

It will be fixed soon, thanks for reporting.
Comment 2 Hugo Parente Lima 2011-07-22 16:53:44 EEST
Fixed in commit:

pyside/239ae999fa0d07893e5e29f611d1919374853b2f
Comment 3 renato filho 2011-07-22 22:12:57 EEST
release 1.0.5