Skip to content

Commit

Permalink
Merge pull request #294 from RobbeSneyders/master
Browse files Browse the repository at this point in the history
[#293] Set position to 0 instead of None to prevent TypeError in Python 3
  • Loading branch information
mmckerns committed Nov 22, 2018
2 parents d077296 + 8e3b630 commit c2cc750
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dill/_dill.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def save_attrgetter(pickler, obj):

def _save_file(pickler, obj, open_):
if obj.closed:
position = None
position = 0
else:
obj.flush()
if obj in (sys.__stdout__, sys.__stderr__, sys.__stdin__):
Expand Down Expand Up @@ -1011,7 +1011,7 @@ def save_file(pickler, obj):
def save_stringi(pickler, obj):
log.info("Io: %s" % obj)
if obj.closed:
value = ''; position = None
value = ''; position = 0
else:
value = obj.getvalue(); position = obj.tell()
pickler.save_reduce(_create_stringi, (value, position, \
Expand All @@ -1023,7 +1023,7 @@ def save_stringi(pickler, obj):
def save_stringo(pickler, obj):
log.info("Io: %s" % obj)
if obj.closed:
value = ''; position = None
value = ''; position = 0
else:
value = obj.getvalue(); position = obj.tell()
pickler.save_reduce(_create_stringo, (value, position, \
Expand Down

0 comments on commit c2cc750

Please sign in to comment.