Skip to content

Commit cf505db

Browse files
committed
updated per GH discusion thread.
1 parent c52f92a commit cf505db

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pandas/core/indexing.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -848,10 +848,8 @@ def _multi_take(self, tup):
848848
[(a, self._convert_for_reindex(t, axis=o._get_axis_number(a)))
849849
for t, a in zip(tup, o._AXIS_ORDERS)])
850850
return o.reindex(**d)
851-
except (KeyError, IndexError, self._exception):
851+
except (KeyError, IndexError):
852852
raise self._exception
853-
except:
854-
raise
855853

856854
def _convert_for_reindex(self, key, axis=0):
857855
labels = self.obj._get_axis(axis)

pandas/tests/indexing/test_indexing.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,6 @@ def _print(result, error=None):
278278
k2 = key2
279279
_eq(t, o, a, obj, key1, k2)
280280

281-
#GH14554: used to make sure recursion errors bubble up as expected
282-
recursive_df = pd.DataFrame({'a':[1,]}, index=['a'])
283-
def recursive_indexing_function(self, a):
284-
return self.recursive_indexing_function(self.recursive_df.loc[['a'], ['a']])
285-
286281
def test_indexer_caching(self):
287282
# GH5727
288283
# make sure that indexers are in the _internal_names_set
@@ -1223,14 +1218,21 @@ def test_loc_getitem_bool(self):
12231218
fails=KeyError)
12241219

12251220
def test_recursion_fails_loc(self):
1226-
#GH14554
1227-
#RuntimeError should bubble up if appropriate, rather
1228-
#than method specific exception
1221+
# GH14554
1222+
# RuntimeError should bubble up if appropriate, rather
1223+
# than method specific exception
1224+
1225+
recursive_df = pd.DataFrame({'a': [1,]}, index=['a'])
1226+
1227+
def recursive_indexing_function(self, a):
1228+
return recursive_indexing_function(
1229+
recursive_df[['a'], ['a']])
1230+
12291231
oldVal=sys.getrecursionlimit()
12301232
sys.setrecursionlimit(50)
12311233
with self.assertRaises(RuntimeError):
12321234
try:
1233-
self.recursive_indexing_function(1)
1235+
recursive_indexing_function(self, 1)
12341236
finally:
12351237
sys.setrecursionlimit(oldVal)
12361238

0 commit comments

Comments
 (0)