Skip to content

Commit 27d9c16

Browse files
committed
Added explicit exceptions to 'compat/pickle_compat.py' and 'util/_validators.py'
1 parent e45a6c1 commit 27d9c16

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/compat/pickle_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def load_reduce(self):
3333
cls = args[0]
3434
stack[-1] = object.__new__(cls)
3535
return
36-
except:
36+
except TypeError:
3737
pass
3838

3939
# try to re-encode the arguments
@@ -44,7 +44,7 @@ def load_reduce(self):
4444
try:
4545
stack[-1] = func(*args)
4646
return
47-
except:
47+
except TypeError:
4848
pass
4949

5050
# unknown exception, re-raise
@@ -182,7 +182,7 @@ def load_newobj_ex(self):
182182

183183
try:
184184
Unpickler.dispatch[pkl.NEWOBJ_EX[0]] = load_newobj_ex
185-
except:
185+
except (AttributeError, KeyError):
186186
pass
187187

188188

@@ -210,5 +210,5 @@ def load(fh, encoding=None, compat=False, is_verbose=False):
210210
up.is_verbose = is_verbose
211211

212212
return up.load()
213-
except:
213+
except (ValueError, TypeError):
214214
raise

0 commit comments

Comments
 (0)