Skip to content

Commit

Permalink
Fix pickles() flagging __builtins__ as unpickleable due to the `a…
Browse files Browse the repository at this point in the history
…ll()` function (#538)

Currently:
```python
>>> import dill
>>> dill.pickles(__builtins__)  # __builtins__.all() raises a TypeError for a missing argument
False
>>> dill.copy(__builtins__)
<module 'builtins' (built-in)>
>>> _ is __builtins__
True
```

Expected:
```python
>>> import dill
>>> dill.pickles(__builtins__, exact=True)
True
```
  • Loading branch information
leogama committed Aug 10, 2022
1 parent 87b8541 commit 7d17338
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dill/_dill.py
Expand Up @@ -1983,7 +1983,7 @@ def pickles(obj,exact=False,safe=False,**kwds):
try:
#FIXME: should be "(pik == obj).all()" for numpy comparison, though that'll fail if shapes differ
result = bool(pik.all() == obj.all())
except AttributeError:
except (AttributeError, TypeError):
warnings.filterwarnings('ignore')
result = pik == obj
warnings.resetwarnings()
Expand Down

0 comments on commit 7d17338

Please sign in to comment.