Commit 023f3c5
committed
Avoid calling vars() on arbitrary third-party manager_class.
vars(...) may fail if the third-party manager_class has no `__dict__`,
which can happen in contrieved cases involving `__slots__` or extension
modules, or more simply if the backend has no FigureCanvas attribute or
if the canvas class has no manager_class attribute, in which case
manager_class = None. (Note that this can only be the case if that
third-party FigureCanvas doesn't inherit from FigureCanvasBase, which is
probably not a great idea.)
In any case, instead of vars(), inspect.getattr_static does what we want
too and also handles that case.
Also replace another (unrelated) use of vars() with a plain getattr.1 parent 22d036e commit 023f3c5
2 files changed
+7
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
898 | 898 | | |
899 | 899 | | |
900 | 900 | | |
901 | | - | |
| 901 | + | |
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
332 | 333 | | |
333 | 334 | | |
334 | 335 | | |
| |||
0 commit comments