| 1 | { |
| 2 | "task_id": "matplotlib__matplotlib-25442", |
| 3 | "setup_info": { |
| 4 | "repo_path": "/home/haifeng/projects/reverse-prompt/SWE-bench/testbed/matplotlib__matplotlib/setup_matplotlib__matplotlib__3.7", |
| 5 | "env_name": "setup_matplotlib__matplotlib__3.7", |
| 6 | "pre_install": [], |
| 7 | "install": "python -m pip install -e .", |
| 8 | "test_cmd": "pytest --no-header -rA --tb=no -p no:cacheprovider lib/matplotlib/tests/test_offsetbox.py" |
| 9 | }, |
| 10 | "task_info": { |
| 11 | "instance_id": "matplotlib__matplotlib-25442", |
| 12 | "base_commit": "73394f2b11321e03a5df199ec0196f27a728b0b0", |
| 13 | "hints_text": "Can you report to https://github.com/anntzer/mplcursors/issues? I'll close here but feel free to open an issue if a Matplotlib bug is identified. ", |
| 14 | "created_at": "2023-03-12T21:58:08Z", |
| 15 | "test_patch": "diff --git a/lib/matplotlib/tests/test_offsetbox.py b/lib/matplotlib/tests/test_offsetbox.py\n--- a/lib/matplotlib/tests/test_offsetbox.py\n+++ b/lib/matplotlib/tests/test_offsetbox.py\n@@ -450,3 +450,11 @@ def test_paddedbox():\n pb = PaddedBox(ta, pad=15, draw_frame=True)\n ab = AnchoredOffsetbox('lower right', child=pb)\n ax.add_artist(ab)\n+\n+\n+def test_remove_draggable():\n+ fig, ax = plt.subplots()\n+ an = ax.annotate(\"foo\", (.5, .5))\n+ an.draggable(True)\n+ an.remove()\n+ MouseEvent(\"button_release_event\", fig.canvas, 1, 1)._process()\n", |
| 16 | "repo": "matplotlib/matplotlib", |
| 17 | "problem_statement": "[Bug]: Attribute Error combining matplotlib 3.7.1 and mplcursor on data selection\n### Bug summary\r\n\r\nIf you combine mplcursor and matplotlib 3.7.1, you'll get an `AttributeError: 'NoneType' object has no attribute 'canvas'` after clicking a few data points. Henceforth, selecting a new data point will trigger the same traceback. Otherwise, it works fine. \r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport mplcursors as mpl\r\n\r\nx = np.arange(1, 11) \r\ny1 = x\r\n\r\nplt.scatter(x,y1)\r\n\r\nmpl.cursor()\r\nplt.show()\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"C:\\Users\\MrAni\\Python\\miniconda3\\lib\\site-packages\\matplotlib\\cbook\\__init__.py\", line 304, in process\r\n func(*args, **kwargs)\r\n File \"C:\\Users\\MrAni\\Python\\miniconda3\\lib\\site-packages\\matplotlib\\offsetbox.py\", line 1550, in on_release\r\n if self._check_still_parented() and self.got_artist:\r\n File \"C:\\Users\\MrAni\\Python\\miniconda3\\lib\\site-packages\\matplotlib\\offsetbox.py\", line 1560, in _check_still_parented\r\n self.disconnect()\r\n File \"C:\\Users\\MrAni\\Python\\miniconda3\\lib\\site-packages\\matplotlib\\offsetbox.py\", line 1568, in disconnect\r\n self.canvas.mpl_disconnect(cid)\r\n File \"C:\\Users\\MrAni\\Python\\miniconda3\\lib\\site-packages\\matplotlib\\offsetbox.py\", line 1517, in <lambda>\r\n canvas = property(lambda self: self.ref_artist.figure.canvas)\r\nAttributeError: 'NoneType' object has no attribute 'canvas'\r\n```\r\n\r\n### Expected outcome\r\n\r\nNo terminal output\r\n\r\n### Additional information\r\n\r\nUsing matplotlib 3.7.0 or lower works fine. Using a conda install or pip install doesn't affect the output. \r\n\r\n### Operating system\r\n\r\nWindows 11 and Windwos 10 \r\n\r\n### Matplotlib Version\r\n\r\n3.7.1\r\n\r\n### Matplotlib Backend\r\n\r\nQtAgg\r\n\r\n### Python version\r\n\r\n3.9.16\r\n\r\n### Jupyter version\r\n\r\n_No response_\r\n\r\n### Installation\r\n\r\nconda\n", |
| 18 | "version": "3.7", |
| 19 | "FAIL_TO_PASS": [ |
| 20 | "lib/matplotlib/tests/test_offsetbox.py::test_remove_draggable" |
| 21 | ], |
| 22 | "PASS_TO_PASS": [ |
| 23 | "lib/matplotlib/tests/test_offsetbox.py::test_anchoredtext_horizontal_alignment[png]", |
| 24 | "lib/matplotlib/tests/test_offsetbox.py::test_annotationbbox_extents", |
| 25 | "lib/matplotlib/tests/test_offsetbox.py::test_annotationbbox_properties", |
| 26 | "lib/matplotlib/tests/test_offsetbox.py::test_arrowprops_copied", |
| 27 | "lib/matplotlib/tests/test_offsetbox.py::test_expand_with_tight_layout", |
| 28 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1--1-widths0]", |
| 29 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1--1-widths1]", |
| 30 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1--1-widths2]", |
| 31 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1--1-widths3]", |
| 32 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-0-widths0]", |
| 33 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-0-widths1]", |
| 34 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-0-widths2]", |
| 35 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-0-widths3]", |
| 36 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-100-widths0]", |
| 37 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-100-widths1]", |
| 38 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-100-widths2]", |
| 39 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-100-widths3]", |
| 40 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-250-widths0]", |
| 41 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-250-widths1]", |
| 42 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-250-widths2]", |
| 43 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-250-widths3]", |
| 44 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-None-widths0]", |
| 45 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-None-widths1]", |
| 46 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-None-widths2]", |
| 47 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal--1-None-widths3]", |
| 48 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0--1-widths0]", |
| 49 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0--1-widths1]", |
| 50 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0--1-widths2]", |
| 51 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0--1-widths3]", |
| 52 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-0-widths0]", |
| 53 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-0-widths1]", |
| 54 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-0-widths2]", |
| 55 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-0-widths3]", |
| 56 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-100-widths0]", |
| 57 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-100-widths1]", |
| 58 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-100-widths2]", |
| 59 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-100-widths3]", |
| 60 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-250-widths0]", |
| 61 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-250-widths1]", |
| 62 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-250-widths2]", |
| 63 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-250-widths3]", |
| 64 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-None-widths0]", |
| 65 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-None-widths1]", |
| 66 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-None-widths2]", |
| 67 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-0-None-widths3]", |
| 68 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1--1-widths0]", |
| 69 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1--1-widths1]", |
| 70 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1--1-widths2]", |
| 71 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1--1-widths3]", |
| 72 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-0-widths0]", |
| 73 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-0-widths1]", |
| 74 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-0-widths2]", |
| 75 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-0-widths3]", |
| 76 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-100-widths0]", |
| 77 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-100-widths1]", |
| 78 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-100-widths2]", |
| 79 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-100-widths3]", |
| 80 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-250-widths0]", |
| 81 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-250-widths1]", |
| 82 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-250-widths2]", |
| 83 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-250-widths3]", |
| 84 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-None-widths0]", |
| 85 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-None-widths1]", |
| 86 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-None-widths2]", |
| 87 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-1-None-widths3]", |
| 88 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250--1-widths0]", |
| 89 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250--1-widths1]", |
| 90 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250--1-widths2]", |
| 91 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250--1-widths3]", |
| 92 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-0-widths0]", |
| 93 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-0-widths1]", |
| 94 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-0-widths2]", |
| 95 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-0-widths3]", |
| 96 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-100-widths0]", |
| 97 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-100-widths1]", |
| 98 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-100-widths2]", |
| 99 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-100-widths3]", |
| 100 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-250-widths0]", |
| 101 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-250-widths1]", |
| 102 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-250-widths2]", |
| 103 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-250-widths3]", |
| 104 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-None-widths0]", |
| 105 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-None-widths1]", |
| 106 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-None-widths2]", |
| 107 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[equal-250-None-widths3]", |
| 108 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1--1-widths0]", |
| 109 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1--1-widths1]", |
| 110 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1--1-widths2]", |
| 111 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1--1-widths3]", |
| 112 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-0-widths0]", |
| 113 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-0-widths1]", |
| 114 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-0-widths2]", |
| 115 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-0-widths3]", |
| 116 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-100-widths0]", |
| 117 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-100-widths1]", |
| 118 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-100-widths2]", |
| 119 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-100-widths3]", |
| 120 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-250-widths0]", |
| 121 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-250-widths1]", |
| 122 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-250-widths2]", |
| 123 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-250-widths3]", |
| 124 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-None-widths0]", |
| 125 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-None-widths1]", |
| 126 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-None-widths2]", |
| 127 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand--1-None-widths3]", |
| 128 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0--1-widths0]", |
| 129 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0--1-widths1]", |
| 130 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0--1-widths2]", |
| 131 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0--1-widths3]", |
| 132 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-0-widths0]", |
| 133 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-0-widths1]", |
| 134 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-0-widths2]", |
| 135 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-0-widths3]", |
| 136 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-100-widths0]", |
| 137 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-100-widths1]", |
| 138 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-100-widths2]", |
| 139 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-100-widths3]", |
| 140 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-250-widths0]", |
| 141 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-250-widths1]", |
| 142 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-250-widths2]", |
| 143 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-250-widths3]", |
| 144 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-None-widths0]", |
| 145 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-None-widths1]", |
| 146 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-None-widths2]", |
| 147 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-0-None-widths3]", |
| 148 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1--1-widths0]", |
| 149 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1--1-widths1]", |
| 150 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1--1-widths2]", |
| 151 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1--1-widths3]", |
| 152 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-0-widths0]", |
| 153 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-0-widths1]", |
| 154 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-0-widths2]", |
| 155 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-0-widths3]", |
| 156 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-100-widths0]", |
| 157 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-100-widths1]", |
| 158 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-100-widths2]", |
| 159 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-100-widths3]", |
| 160 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-250-widths0]", |
| 161 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-250-widths1]", |
| 162 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-250-widths2]", |
| 163 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-250-widths3]", |
| 164 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-None-widths0]", |
| 165 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-None-widths1]", |
| 166 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-None-widths2]", |
| 167 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-1-None-widths3]", |
| 168 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250--1-widths0]", |
| 169 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250--1-widths1]", |
| 170 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250--1-widths2]", |
| 171 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250--1-widths3]", |
| 172 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-0-widths0]", |
| 173 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-0-widths1]", |
| 174 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-0-widths2]", |
| 175 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-0-widths3]", |
| 176 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-100-widths0]", |
| 177 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-100-widths1]", |
| 178 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-100-widths2]", |
| 179 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-100-widths3]", |
| 180 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-250-widths0]", |
| 181 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-250-widths1]", |
| 182 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-250-widths2]", |
| 183 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-250-widths3]", |
| 184 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-None-widths0]", |
| 185 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-None-widths1]", |
| 186 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-None-widths2]", |
| 187 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[expand-250-None-widths3]", |
| 188 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1--1-widths0]", |
| 189 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1--1-widths1]", |
| 190 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1--1-widths2]", |
| 191 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1--1-widths3]", |
| 192 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-0-widths0]", |
| 193 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-0-widths1]", |
| 194 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-0-widths2]", |
| 195 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-0-widths3]", |
| 196 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-100-widths0]", |
| 197 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-100-widths1]", |
| 198 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-100-widths2]", |
| 199 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-100-widths3]", |
| 200 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-250-widths0]", |
| 201 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-250-widths1]", |
| 202 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-250-widths2]", |
| 203 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-250-widths3]", |
| 204 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-None-widths0]", |
| 205 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-None-widths1]", |
| 206 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-None-widths2]", |
| 207 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed--1-None-widths3]", |
| 208 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0--1-widths0]", |
| 209 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0--1-widths1]", |
| 210 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0--1-widths2]", |
| 211 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0--1-widths3]", |
| 212 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-0-widths0]", |
| 213 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-0-widths1]", |
| 214 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-0-widths2]", |
| 215 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-0-widths3]", |
| 216 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-100-widths0]", |
| 217 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-100-widths1]", |
| 218 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-100-widths2]", |
| 219 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-100-widths3]", |
| 220 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-250-widths0]", |
| 221 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-250-widths1]", |
| 222 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-250-widths2]", |
| 223 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-250-widths3]", |
| 224 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-None-widths0]", |
| 225 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-None-widths1]", |
| 226 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-None-widths2]", |
| 227 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-0-None-widths3]", |
| 228 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1--1-widths0]", |
| 229 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1--1-widths1]", |
| 230 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1--1-widths2]", |
| 231 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1--1-widths3]", |
| 232 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-0-widths0]", |
| 233 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-0-widths1]", |
| 234 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-0-widths2]", |
| 235 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-0-widths3]", |
| 236 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-100-widths0]", |
| 237 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-100-widths1]", |
| 238 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-100-widths2]", |
| 239 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-100-widths3]", |
| 240 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-250-widths0]", |
| 241 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-250-widths1]", |
| 242 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-250-widths2]", |
| 243 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-250-widths3]", |
| 244 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-None-widths0]", |
| 245 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-None-widths1]", |
| 246 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-None-widths2]", |
| 247 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-1-None-widths3]", |
| 248 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250--1-widths0]", |
| 249 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250--1-widths1]", |
| 250 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250--1-widths2]", |
| 251 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250--1-widths3]", |
| 252 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-0-widths0]", |
| 253 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-0-widths1]", |
| 254 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-0-widths2]", |
| 255 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-0-widths3]", |
| 256 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-100-widths0]", |
| 257 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-100-widths1]", |
| 258 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-100-widths2]", |
| 259 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-100-widths3]", |
| 260 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-250-widths0]", |
| 261 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-250-widths1]", |
| 262 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-250-widths2]", |
| 263 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-250-widths3]", |
| 264 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-None-widths0]", |
| 265 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-None-widths1]", |
| 266 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-None-widths2]", |
| 267 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets[fixed-250-None-widths3]", |
| 268 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_equal[widths0-6-None-expected0]", |
| 269 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_equal[widths1-2-None-expected1]", |
| 270 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_equal[widths2-None-1-expected2]", |
| 271 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_equal_total_none_sep_none", |
| 272 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_expand[widths0-None-None-expected0]", |
| 273 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_expand[widths1-10-1-expected1]", |
| 274 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_expand[widths2-5-1-expected2]", |
| 275 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_fixed[widths0-None-1-expected0]", |
| 276 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_fixed[widths1-10-1-expected1]", |
| 277 | "lib/matplotlib/tests/test_offsetbox.py::test_get_packed_offsets_fixed[widths2-5-1-expected2]", |
| 278 | "lib/matplotlib/tests/test_offsetbox.py::test_offsetbox_clip_children", |
| 279 | "lib/matplotlib/tests/test_offsetbox.py::test_offsetbox_clipping[pdf]", |
| 280 | "lib/matplotlib/tests/test_offsetbox.py::test_offsetbox_clipping[png]", |
| 281 | "lib/matplotlib/tests/test_offsetbox.py::test_offsetbox_loc_codes", |
| 282 | "lib/matplotlib/tests/test_offsetbox.py::test_packers[baseline]", |
| 283 | "lib/matplotlib/tests/test_offsetbox.py::test_packers[bottom]", |
| 284 | "lib/matplotlib/tests/test_offsetbox.py::test_packers[center]", |
| 285 | "lib/matplotlib/tests/test_offsetbox.py::test_packers[left]", |
| 286 | "lib/matplotlib/tests/test_offsetbox.py::test_packers[right]", |
| 287 | "lib/matplotlib/tests/test_offsetbox.py::test_packers[top]", |
| 288 | "lib/matplotlib/tests/test_offsetbox.py::test_paddedbox[png]", |
| 289 | "lib/matplotlib/tests/test_offsetbox.py::test_paddedbox_default_values", |
| 290 | "lib/matplotlib/tests/test_offsetbox.py::test_picking[axes", |
| 291 | "lib/matplotlib/tests/test_offsetbox.py::test_picking[data-draw]", |
| 292 | "lib/matplotlib/tests/test_offsetbox.py::test_picking[data-image]", |
| 293 | "lib/matplotlib/tests/test_offsetbox.py::test_picking[data-text]", |
| 294 | "lib/matplotlib/tests/test_offsetbox.py::test_textarea_properties", |
| 295 | "lib/matplotlib/tests/test_offsetbox.py::test_textarea_set_text[pdf]", |
| 296 | "lib/matplotlib/tests/test_offsetbox.py::test_textarea_set_text[png]", |
| 297 | "lib/matplotlib/tests/test_offsetbox.py::test_zorder" |
| 298 | ], |
| 299 | "environment_setup_commit": "0849036fd992a2dd133a0cffc3f84f58ccf1840f", |
| 300 | "patch": "diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py\n--- a/lib/matplotlib/offsetbox.py\n+++ b/lib/matplotlib/offsetbox.py\n@@ -1500,16 +1500,23 @@ def __init__(self, ref_artist, use_blit=False):\n ref_artist.set_picker(True)\n self.got_artist = False\n self._use_blit = use_blit and self.canvas.supports_blit\n- self.cids = [\n- self.canvas.callbacks._connect_picklable(\n- 'pick_event', self.on_pick),\n- self.canvas.callbacks._connect_picklable(\n- 'button_release_event', self.on_release),\n+ callbacks = ref_artist.figure._canvas_callbacks\n+ self._disconnectors = [\n+ functools.partial(\n+ callbacks.disconnect, callbacks._connect_picklable(name, func))\n+ for name, func in [\n+ (\"pick_event\", self.on_pick),\n+ (\"button_release_event\", self.on_release),\n+ (\"motion_notify_event\", self.on_motion),\n+ ]\n ]\n \n # A property, not an attribute, to maintain picklability.\n canvas = property(lambda self: self.ref_artist.figure.canvas)\n \n+ cids = property(lambda self: [\n+ disconnect.args[0] for disconnect in self._disconnectors[:2]])\n+\n def on_motion(self, evt):\n if self._check_still_parented() and self.got_artist:\n dx = evt.x - self.mouse_x\n@@ -1536,16 +1543,12 @@ def on_pick(self, evt):\n self.ref_artist.draw(\n self.ref_artist.figure._get_renderer())\n self.canvas.blit()\n- self._c1 = self.canvas.callbacks._connect_picklable(\n- \"motion_notify_event\", self.on_motion)\n self.save_offset()\n \n def on_release(self, event):\n if self._check_still_parented() and self.got_artist:\n self.finalize_offset()\n self.got_artist = False\n- self.canvas.mpl_disconnect(self._c1)\n-\n if self._use_blit:\n self.ref_artist.set_animated(False)\n \n@@ -1558,14 +1561,8 @@ def _check_still_parented(self):\n \n def disconnect(self):\n \"\"\"Disconnect the callbacks.\"\"\"\n- for cid in self.cids:\n- self.canvas.mpl_disconnect(cid)\n- try:\n- c1 = self._c1\n- except AttributeError:\n- pass\n- else:\n- self.canvas.mpl_disconnect(c1)\n+ for disconnector in self._disconnectors:\n+ disconnector()\n \n def save_offset(self):\n pass\n", |
| 301 | "pr_link": "https://github.com/matplotlib/matplotlib/pull/25442" |
| 302 | } |
| 303 | } |