-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow args to pass through _allow_super_init #11900
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
Conversation
Is this correct or is the first error message incorrect? If this is right it’d be nice to have a short test. |
All reactions
Sorry, something went wrong.
The function signature is:
which doesn't force I copy pasted the error messages I got from the terminal. It definitely took me longer than I wanted to find what was wrong in my code. Where do your tests go? |
All reactions
Sorry, something went wrong.
Tests go in |
All reactions
Sorry, something went wrong.
Yeah.... qt5agg uses a different code path that doesn't have the error. I added a test, but it doesn't cover the error since it is using the Agg backend. |
All reactions
Sorry, something went wrong.
0dac93f
to
c51e282
Compare
I think the test should really go to test_backend_qt4agg (as there's no problem with qt5)?... which is not run on CI both because we can't install pyqt4 there and because we can't import pyqt4 and pyqt5 in the same process, but that's another can of worms. Otherwise looks good. Doesn't seem to warrant backporting though. |
All reactions
Sorry, something went wrong.
Qt5 is not the same codepath as Qt5Agg. The problem is with Qt5 (I'm using PySide, but the code change The bug was in |
All reactions
Sorry, something went wrong.
Now I'm confused by how exactly you got the error. "qt5" is not a backend by itself, qt5agg and qt5cairo are. |
All reactions
Sorry, something went wrong.
I don't see backends_qt5 has a different FigureCanvas object The bug is in the decorator for
|
All reactions
Sorry, something went wrong.
But I don't see any tests for the QT backend, only the QTAgg, so I don't really have anything to base myself on. And I'm just learning how to use Qt, so I'm no expert. |
All reactions
Sorry, something went wrong.
I'm still confused; on master, v2.2.2, and v2.2.3 , without this PR, I can run from matplotlib.backends.backend_qt4agg import FigureCanvas
from matplotlib.figure import Figure
FigureCanvas(Figure())
FigureCanvas(figure=Figure()) without the errors in your original message for either qt4 or qt5. Can you specify what code triggers the error this PR is supposed to fix? |
All reactions
Sorry, something went wrong.
In [2]: from matplotlib.backends.backend_qt5 import FigureCanvas
...: from matplotlib.figure import Figure
...:
...: FigureCanvas(Figure())
...:
...:
...:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-d7282e013989> in <module>()
2 from matplotlib.figure import Figure
3
----> 4 FigureCanvas(Figure())
5
TypeError: wrapper() takes 1 positional argument but 2 were given |
All reactions
Sorry, something went wrong.
I don't know the history well enough, but I think |
All reactions
Sorry, something went wrong.
Perhaps a better explanation: https://stackoverflow.com/questions/47271291/matplotlib-backends-backend-qt5-vs-from-matplotlib-backends-backend-qt5agg |
All reactions
-
👍 1 reaction
Sorry, something went wrong.
hmm ok, maybe that is why I had to add the navbar for things to draw. that said, it is still a bug. the decorator should also pass |
All reactions
Sorry, something went wrong.
I can't repro your bug...
(regardless of the fact that this class shouldn't really be instantiated as noted by @jklymak above). In fact the super-method is called in
not posiitionally so it's unclear how you can get positional arguments to reach the patched super-init. |
All reactions
Sorry, something went wrong.
Maybe because I'm on PySide2.... PyQt5 just passes the original
The bug happens because the decorator only passes the keyword args and drops the args. |
All reactions
Sorry, something went wrong.
Ah, I see. |
All reactions
Sorry, something went wrong.
c51e282
to
6fdf2b5
Compare
Ok i removed the tests. |
All reactions
Sorry, something went wrong.
Thanks for the persistence @hmaarrfk ! Sorry this was a confusing one... |
All reactions
Sorry, something went wrong.
Yeah it was. I'll try to use Qt5Agg, see how that works. |
All reactions
Sorry, something went wrong.
@meeseeksdev backport to v2.2.x |
All reactions
Sorry, something went wrong.
@meeseeksdev backport to v3.0.x |
All reactions
Sorry, something went wrong.
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
All reactions
Sorry, something went wrong.
…900-on-v3.0.x Backport PR #11900 on branch v3.0.x
Looks like this did not get backported to 2.2.x but did make it into 3.0.0, remilestoned to match that. |
All reactions
Sorry, something went wrong.
Without this, if you call
FigureCanvas
without any parameters, you would get the errorBut if you would try to provide the positional argument, you would get
because only
**kwargs
were passed through.PR Checklist