Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/jedi/_compatibility.py: 28%
18 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 06:09 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 06:09 +0000
1"""
2This module is here to ensure compatibility of Windows/Linux/MacOS and
3different Python versions.
4"""
5import errno
6import sys
7import pickle
10def pickle_load(file):
11 try:
12 return pickle.load(file)
13 # Python on Windows don't throw EOF errors for pipes. So reraise them with
14 # the correct type, which is caught upwards.
15 except OSError:
16 if sys.platform == 'win32':
17 raise EOFError()
18 raise
21def pickle_dump(data, file, protocol):
22 try:
23 pickle.dump(data, file, protocol)
24 # On Python 3.3 flush throws sometimes an error even though the writing
25 # operation should be completed.
26 file.flush()
27 # Python on Windows don't throw EPIPE errors for pipes. So reraise them with
28 # the correct type and error number.
29 except OSError:
30 if sys.platform == 'win32':
31 raise IOError(errno.EPIPE, "Broken pipe")
32 raise