Skip to content

Python 3.11 cannot load object saved with 3.10 #564

@ryandgoldenberg

Description

@ryandgoldenberg

Objects that are serialized using Python 3.10 produce an error when attempting to load with Python 3.11

Version: cloudpickle==3.1.1

Steps to reproduce:

Save object using Python 3.10

import cloudpickle
squared = lambda x: x ** 2
with open('squared.pkl', 'wb') as f:
  cloudpickle.dump(squared, f)

Load object using Python 3.11

import cloudpickle
with open('squared.pkl', 'rb') as f:
  squared = cloudpickle.load(f)

...

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: code() argument 13 must be str, not int

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions