You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug summary
Plot classes have annotate_<x> methods, which are internally referred to as "plot callbacks", and are implemented as classes, inheriting the bas class PlotCallback.
Nominally, these classes have an __init__ and a __call__ method. By design, __call__ isn't actually used before the plot is actually rendered (this is the very essence of a "callback"). However, I noticed that it's also the case for __init__ methods. This makes is possible to call annotate_<x> methods with completely invalid arguments without erroring; any error will only show up at render time, which can be quite confusing
Code for reproduction
Here's an example session to demonstrate the problem
The TypeError should show up as soon as we call the annotate_contour method.
This came up while I was trying to solve #3941: we have a bunch of deprecation warnings in callback methods, but they only pop at render time, so it's impossible to display the problematic line users actually typed in the warning itself.
I don't think this is a trivial fix because the current implementation for annotate_<x> methods is quite complicated and involves a lot of function wrapping. Any proposed solution will need to retain gains from #3310
Unless someone can find an elegant and compact solution soon, this shouldn't be required for yt 4.1
The text was updated successfully, but these errors were encountered:
update: turns out the same exact problem affects FIxedResolutionBuffer.apply_* methods, for similar reasons, so I'm fixing everything in one go in #3957
Bug report
Bug summary
Plot classes have
annotate_<x>
methods, which are internally referred to as "plot callbacks", and are implemented as classes, inheriting the bas classPlotCallback
.Nominally, these classes have an
__init__
and a__call__
method. By design,__call__
isn't actually used before the plot is actually rendered (this is the very essence of a "callback"). However, I noticed that it's also the case for__init__
methods. This makes is possible to callannotate_<x>
methods with completely invalid arguments without erroring; any error will only show up at render time, which can be quite confusingCode for reproduction
Here's an example session to demonstrate the problem
Expected outcome
The
TypeError
should show up as soon as we call theannotate_contour
method.This came up while I was trying to solve #3941: we have a bunch of deprecation warnings in callback methods, but they only pop at render time, so it's impossible to display the problematic line users actually typed in the warning itself.
I don't think this is a trivial fix because the current implementation for
annotate_<x>
methods is quite complicated and involves a lot of function wrapping. Any proposed solution will need to retain gains from #3310Unless someone can find an elegant and compact solution soon, this shouldn't be required for yt 4.1
The text was updated successfully, but these errors were encountered: