Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b5430f

Browse files
committed
raise EOFError when load() hits EOF, instead of KeyError
1 parent cd259d0 commit 7b5430f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lib/pickle.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ def marker(self):
356356

357357
dispatch = {}
358358

359+
def load_eof(self):
360+
raise EOFError
361+
dispatch[''] = load_eof
362+
359363
def load_persid(self):
360364
pid = self.readline()[:-1]
361365
self.stack.append(self.persisent_load(pid))

0 commit comments

Comments
 (0)