Author malin
Recipients malin, pitrou
Date 2021-06-17.05:05:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623906324.37.0.876825919891.issue44439@roundup.psfhosted.org>
In-reply-to
Content
If run this code, it will raise an exception: 

    import pickle
    import lzma
    import pandas as pd
    with lzma.open("test.xz", "wb") as file:
        pickle.dump(pd.DataFrame(range(1_000_000)), file, protocol=5)

The exception:

    Traceback (most recent call last):
      File "E:\testlen.py", line 7, in <module>
        pickle.dump(pd.DataFrame(range(1_000_000)), file, protocol=5)
      File "D:\Python39\lib\lzma.py", line 234, in write
        self._pos += len(data)
    TypeError: object of type 'pickle.PickleBuffer' has no len()
    
The exception is raised in lzma.LZMAFile.write() method:
https://github.com/python/cpython/blob/v3.10.0b2/Lib/lzma.py#L238
        
PickleBuffer doesn't have .__len__ method, is it intended?
History
Date User Action Args
2021-06-17 05:05:24malinsetrecipients: + malin, pitrou
2021-06-17 05:05:24malinsetmessageid: <1623906324.37.0.876825919891.issue44439@roundup.psfhosted.org>
2021-06-17 05:05:24malinlinkissue44439 messages
2021-06-17 05:05:23malincreate