@@ -526,7 +526,7 @@ def get_locales(prefix=None, normalize=True,
526526 """
527527 try :
528528 raw_locales = locale_getter ()
529- except :
529+ except Exception :
530530 return None
531531
532532 try :
@@ -757,7 +757,7 @@ def set_trace():
757757 from IPython .core .debugger import Pdb
758758 try :
759759 Pdb (color_scheme = 'Linux' ).set_trace (sys ._getframe ().f_back )
760- except :
760+ except Exception :
761761 from pdb import Pdb as OldPdb
762762 OldPdb ().set_trace (sys ._getframe ().f_back )
763763
@@ -1265,9 +1265,9 @@ def assert_series_equal(left, right, check_dtype=True,
12651265 check_dtype = check_dtype )
12661266 elif is_interval_dtype (left ) or is_interval_dtype (right ):
12671267 # TODO: big hack here
1268- l = pd .IntervalIndex (left )
1269- r = pd .IntervalIndex (right )
1270- assert_index_equal (l , r , obj = '{obj}.index' .format (obj = obj ))
1268+ left = pd .IntervalIndex (left )
1269+ right = pd .IntervalIndex (right )
1270+ assert_index_equal (left , right , obj = '{obj}.index' .format (obj = obj ))
12711271
12721272 else :
12731273 _testing .assert_almost_equal (left .get_values (), right .get_values (),
@@ -1439,8 +1439,9 @@ def assert_panelnd_equal(left, right,
14391439 assert_index_equal (left_ind , right_ind , check_names = check_names )
14401440
14411441 if by_blocks :
1442- rblocks = right .blocks
1443- lblocks = left .blocks
1442+ with warnings .catch_warnings (record = True ):
1443+ rblocks = right .blocks
1444+ lblocks = left .blocks
14441445 for dtype in list (set (list (lblocks .keys ()) + list (rblocks .keys ()))):
14451446 assert dtype in lblocks
14461447 assert dtype in rblocks
@@ -2345,7 +2346,7 @@ def wrapper(*args, **kwargs):
23452346
23462347 try :
23472348 e_str = traceback .format_exc (e )
2348- except :
2349+ except Exception :
23492350 e_str = str (e )
23502351
23512352 if any ([m .lower () in e_str .lower () for m in _skip_on_messages ]):
@@ -2582,7 +2583,7 @@ def assert_produces_warning(expected_warning=Warning, filter_level="always",
25822583 for m in clear :
25832584 try :
25842585 m .__warningregistry__ .clear ()
2585- except :
2586+ except Exception :
25862587 pass
25872588
25882589 saw_warning = False
@@ -2849,7 +2850,7 @@ def setTZ(tz):
28492850 if tz is None :
28502851 try :
28512852 del os .environ ['TZ' ]
2852- except :
2853+ except KeyError :
28532854 pass
28542855 else :
28552856 os .environ ['TZ' ] = tz
0 commit comments