]> crepu.dev Git - config.git/blame - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/jedi/_compatibility.py
ActualizaciĆ³n de Readme
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / jedi / _compatibility.py
CommitLineData
53e6db90
DC
1"""
2This module is here to ensure compatibility of Windows/Linux/MacOS and
3different Python versions.
4"""
5import errno
6import sys
7import pickle
8
9
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
19
20
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