Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with pickling an unpickled object #476

Open
fl8k opened this issue Jun 11, 2022 · 1 comment
Open

Issue with pickling an unpickled object #476

fl8k opened this issue Jun 11, 2022 · 1 comment
Labels
lacking reproducer This issue does not have a minimal reproducing code example, making it harder to investigate it.

Comments

@fl8k
Copy link

fl8k commented Jun 11, 2022

Python 3.9.6 | cloudpickle 2.0.0
While using cloudpickle to pack some classes, I encountered the following error:
\lib\dis.py", line 347, in _get_instructions_bytes argval = cmp_op[arg] IndexError: tuple index out of range
arg = 6
op = 107

Here is the segment of code (a class method) it was processing when the error occurred:

def startTimer(self,name):  
    if name in self.timers and not self.timers[name]['start'] is None:
        if self.timers[name]['stop'] is None:
            print(f"Timer ({name}) has already been started..")
            return 
        else:
            print(f"Timer ({name}) being restarted from last stop ({self.timers[name]['stop']})")
    self.timers[name]={"start":time(),"stop":None}

Here is the bytecode:

b't\x00d\x01d\x02\x8d\x01|\x00_\x01d\x03g\x01|\x00_\x02d\x04|\x00_\x03g\x00|\x00_\x04d\x00|\x00_\x05|\x01|\x00_\x06|\x00\xa0\x07\xa1\x00\x01\x00t\x08|\x00j\x01\x83\x01\x01\x00d\x00S\x00'

Here is the unpacked code:

[(0, 116, 0), (2, 100, 1), (4, 100, 2), (6, 141, 1), (8, 124, 0), (10, 95, 1), (12, 100, 3), (14, 103, 1), (16, 124, 0), (18, 95, 2), (20, 100, 4), (22, 124, 0), (24, 95, 3), (26, 103, 0), (28, 124, 0), (30, 95, 4), (32, 100, 0), (34, 124, 0), (36, 95, 5), (38, 124, 1), (40, 124, 0), (42, 95, 6), (44, 124, 0), (46, 160, 7), (48, 161, 0), (50, 1, None), (52, 116, 8), (54, 124, 0), (56, 106, 1), (58, 131, 1), (60, 1, None), (62, 100, 0), (64, 83, None)]

This is happening when I try to re-cloudpickle an object that was already pickled and loaded with cloudpickle. The original pickling goes through fine, I am able to unpack it without issues, but when I try to re-pickle the unpacked object again I get the above error.

@fl8k fl8k changed the title Issue with pickling and unpickled object Issue with pickling an unpickled object Jun 14, 2022
@ogrisel
Copy link
Contributor

ogrisel commented Jul 11, 2022

Could you please craft a minimal reproducing example that preferably does not depend on any third party library?

@pierreglaser pierreglaser added the lacking reproducer This issue does not have a minimal reproducing code example, making it harder to investigate it. label Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lacking reproducer This issue does not have a minimal reproducing code example, making it harder to investigate it.
Projects
None yet
Development

No branches or pull requests

3 participants