In base a questo comment e alla documentazione di riferimento, Pickle 4.0+ da Python 3.4+ dovrebbe essere in grado di decodificare gli oggetti byte superiori a 4 GB.Python 3 - Può decollare gestire oggetti byte più grandi di 4 GB?
Tuttavia, utilizzando Python 3.4.3 o pitone 3.5.0b2 su Mac OS X 10.10.4, ottengo un errore quando provo a salamoia un grande array di byte:
>>> import pickle
>>> x = bytearray(8 * 1000 * 1000 * 1000)
>>> fp = open("x.dat", "wb")
>>> pickle.dump(x, fp, protocol = 4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument
C'è un bug nel il mio codice o sto fraintendendo la documentazione?
Non c'è nessun problema per me. Python 3.4.1 su Windows. – Jedi
Interruzioni su OS X. Questo in realtà non ha nulla a che fare con pickle. 'open ('/ dev/null', 'wb'). write (bytearray (2 ** 31 - 1))' funziona, ma 'open ('/ dev/null', 'wb'). write (bytearray (2 ** 3)) 'genera quell'errore. Python 2 non ha questo problema. – Blender
@Blender: ciò che genera un errore per te funziona con Python 2.7.10 e Python 3.4.3 (su OS X, versioni MacPorts). – EOL