Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix #5687: Don't pass unicode to QApplication() #5690

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

Merged
merged 1 commit into from
Dec 22, 2015

Conversation

pankajp
Copy link
Contributor

@pankajp pankajp commented Dec 17, 2015

PySide QApplication constructor cannot handle unicode text
(segfaults), so we instead pass an empty list to the constructor.

Fixes #5687

@jdmarch
Copy link

jdmarch commented Dec 17, 2015

Confirmed fixes segfault on Mac and Linux

@tacaswell tacaswell added this to the Critical bugfix release (1.5.1) milestone Dec 17, 2015
@tacaswell
Copy link
Member

Thing change went in in 378e37d so this is definitily a regression from 1.4.

Sorry, I could have sworn I tested this against PySide when this went in.

attn @mfitzp

@tacaswell
Copy link
Member

tracking down what is going on here:

http://doc.qt.io/qt-5/qapplication.html#QApplication is underlying c++, says must be at least one as does http://pyqt.sourceforge.net/Docs/PyQt4/qapplication.html#QApplication where as pyside does not explicitly note this https://srinikom.github.io/pyside-docs/PySide/QtGui/QApplication.html#PySide.QtGui.QApplication

@pankajp
Copy link
Contributor Author

pankajp commented Dec 18, 2015

@tacaswell Thanks for pointing to the documentation which states there must be atleast one string in the list. I was not aware of that. In fact i tested using a empty list and it works fine in all combinations of PySide/PyQt4/PyQt5 X python2/python3
I guess I should just change it back to a normal str with space then as it was before that commit.

PySide QApplication constructor cannot handle unicode text.
@pankajp
Copy link
Contributor Author

pankajp commented Dec 18, 2015

I have reverted the QApplication() args to the way it was before commit 378e37d broke it.

@tacaswell
Copy link
Member

If an empty list works, I would assume the documentation is wrong 😈

Is this only a pyside + LPy issue? I think it would be better to have conditional code to special case that rather than have incorrect unicode handling.

@pankajp
Copy link
Contributor Author

pankajp commented Dec 18, 2015

I don't think passing string (in py2) is incorrect behavior because the underlying C++ method accepts char**, and also because passing unicode segfaults pyside. It was changed to unicode in a misguided attempt to unify text type. Using unicode here has no correctness benefit simply because we are passing in a constant, and not text which can be set by user and/or the OS.

@tacaswell
Copy link
Member

Can you also file a bug/is there a bug upstream with pyside?

I guess this is ok. The path to dropping py2 is going to include a sed s/six.text_type/str/g operation anyway and as you point out we do not take user input here so we can not be surprised by unicode input.

Test failures look un-related (and my fault 😞 )

@tacaswell tacaswell closed this Dec 21, 2015
@tacaswell tacaswell reopened this Dec 21, 2015
@tacaswell tacaswell self-assigned this Dec 22, 2015
tacaswell added a commit that referenced this pull request Dec 22, 2015
Fix #5687: Don't pass unicode to QApplication()
@tacaswell tacaswell merged commit fd83789 into matplotlib:master Dec 22, 2015
@tacaswell
Copy link
Member

@pankajp Can you please follow up with upstream (pyside) on this?

@pankajp pankajp deleted the patch-1 branch December 22, 2015 05:03
@pankajp
Copy link
Contributor Author

pankajp commented Dec 22, 2015

Reported upstream: https://bugreports.qt.io/browse/PYSIDE-306. Should be easy to fix if someone gets the time.

@tacaswell
Copy link
Member

Thanks !

On Tue, Dec 22, 2015, 00:11 Pankaj Pandey [email protected] wrote:

Reported upstream: https://bugreports.qt.io/browse/PYSIDE-306. Should be
easy to fix if someone gets the time.


Reply to this email directly or view it on GitHub
#5690 (comment)
.

tacaswell added a commit that referenced this pull request Jan 1, 2016
Fix #5687: Don't pass unicode to QApplication()
@tacaswell
Copy link
Member

Backported as 1241122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants