Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix early crash on python3 + PyQt5 #589

Merged
merged 2 commits into from
Aug 22, 2016

Conversation

sthalik
Copy link
Contributor

@sthalik sthalik commented Aug 21, 2016

Must pass "bytes" data type to QByteArray in PyQt5.

Check for Python 3.0 shouldn't be necessary since PyQt5 is python3-only.

Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
Skip the check at runtime if Python3 isn't found. The Python 2 bytes() -
aka str() ctor works fine without encoding.
@@ -14,7 +14,12 @@

try:
# pylint: disable=bytes-builtin
bstr = bytes
bytes()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should work sans the ().... could even do b = bytes

@davvid
Copy link
Member

davvid commented Aug 22, 2016

Notes aside, i think I'll take this PR as-is and see what I can tweak on my end. Thanks for the fix!

@davvid davvid merged commit f8cdf8a into git-cola:master Aug 22, 2016
davvid added a commit to davvid/git-cola that referenced this pull request Aug 22, 2016
Arrange for `bstr()` to be defined as a function for Python 3 only.
Avoid exception by checking the Python version explicitly.

Set `bstr = bytes` for modern Python2 and use `str` for historical
Pythons.

Related-to: git-cola#589
Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit to davvid/git-cola that referenced this pull request Aug 22, 2016
QByteArray on PyQt5 only accepts byte strings.  QByteArray on PyQt4
accepts byte strings too, so simplify the logic by encoding to a byte
string unconditionally.

Related-to: git-cola#589
Signed-off-by: David Aguilar <davvid@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants