I wrote a custom Python module to serialize a Python dictionary, instantiated in Mojo, using the 'pickle' class from Python's standard library. Running the Python module's 'main' function shows that the code works in the Python environment. When running the Mojo module's 'main' function, the custom method converts the dictionary into a serialized string and returns it to the calling function in Mojo, then crashes after Mojo successfully prints out the returned string. Commenting out the print statement has no effect...Mojo still crashes.
When I comment out the call 'to_pickle' and assign a valid serialized string, the deserialization function 'from_pickle' works properly and Mojo does not crash. See attached below for two source code files and the output from Mojo when it crashes after the 'to_pickle' function.
Bug description
I wrote a custom Python module to serialize a Python dictionary, instantiated in Mojo, using the 'pickle' class from Python's standard library. Running the Python module's 'main' function shows that the code works in the Python environment. When running the Mojo module's 'main' function, the custom method converts the dictionary into a serialized string and returns it to the calling function in Mojo, then crashes after Mojo successfully prints out the returned string. Commenting out the print statement has no effect...Mojo still crashes.
When I comment out the call 'to_pickle' and assign a valid serialized string, the deserialization function 'from_pickle' works properly and Mojo does not crash. See attached below for two source code files and the output from Mojo when it crashes after the 'to_pickle' function.
Mojo 'to_pickle':
var py_object_hex: String = py_module.to_pickle(py_dict.py_object)
PythonMojo 'from_pickle':
var py_object = py_module.from_pickle(py_object_hex)
PythonSteps to reproduce
Source Code: https://github.com/johnsoez4/py_pickle Files:
System information