We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 753bc56 commit a968691Copy full SHA for a968691
lib/matplotlib/gridspec.py
@@ -145,6 +145,8 @@ def __getitem__(self, key):
145
else:
146
if k1 < 0:
147
k1 += nrows
148
+ if k1 >= nrows or k1 < 0 :
149
+ raise IndexError("index out of range")
150
row1, row2 = k1, k1+1
151
152
@@ -153,6 +155,8 @@ def __getitem__(self, key):
153
155
154
156
if k2 < 0:
157
k2 += ncols
158
+ if k2 >= ncols or k2 < 0 :
159
160
col1, col2 = k2, k2+1
161
162
@@ -167,6 +171,8 @@ def __getitem__(self, key):
167
171
168
172
if key < 0:
169
173
key += total
174
+ if key >= total or key < 0 :
175
170
176
num1, num2 = key, None
177
178
0 commit comments