You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was looking at this issue (new to this project) and I am struggling a bit.
I assume the primary changes would be made to the marshal.rs file. My first thought is that we would add more cases the loads and dumps match statements to handle PyStr, PyInt, PyFloat etc. However, the loads function expects the returning of a PyCode object, thus at some point a PyCode object would have to be created (either in loads after reading the raw bytes, or in dumps by converting all PyObjectRef into PyCode first.
Am I understanding this correctly? If so, how can we convert and the ConstantData/PyObjectRef/bytes into a PyCode or CodeObject?
FYI I am able to get any constant to a PyConstant without much trouble, it's the CodeObject creation that seems necessary and is confusing.
Thanks for any advice or tips you can give. I'm somewhat new to rust and interpreters and appreciate all the help I can get!
Your approach is correct. The return type can be changed to PyObjectRef to include any type of python object. The most common way to convert PyCode or other types into PyObjectRef is using into_pyobject. The other way - PyObjectRef to each type - will be try_into_value.
marshal.dumps / marshal.loads round-trip None, bool, int, float, str, bytes, tuple, list, dict, set, and code objects, with marshal.version exposed. Lib/test/test_marshal.py has a single leftover expectedFailure about set repr order under PYTHONHASHSEED, which is not missing marshal support.
Activity
jakearmendariz commentedon Dec 19, 2021
Hi, I was looking at this issue (new to this project) and I am struggling a bit.
I assume the primary changes would be made to the marshal.rs file. My first thought is that we would add more cases the loads and dumps match statements to handle
PyStr,PyInt,PyFloatetc. However, theloadsfunction expects the returning of aPyCodeobject, thus at some point aPyCodeobject would have to be created (either in loads after reading the raw bytes, or in dumps by converting allPyObjectRefintoPyCodefirst.Am I understanding this correctly? If so, how can we convert and the
ConstantData/PyObjectRef/bytes into aPyCodeorCodeObject?FYI I am able to get any constant to a
PyConstantwithout much trouble, it's theCodeObjectcreation that seems necessary and is confusing.Thanks for any advice or tips you can give. I'm somewhat new to rust and interpreters and appreciate all the help I can get!
youknowone commentedon Dec 19, 2021
Your approach is correct. The return type can be changed to
PyObjectRefto include any type of python object. The most common way to convertPyCodeor other types intoPyObjectRefis usinginto_pyobject. The other way - PyObjectRef to each type - will betry_into_value.djrmarques commentedon Apr 25, 2022
Hello, is this issue closed already?
youknowone commentedon Apr 25, 2022
Oh, yep.
test_marshal.pyis done. So this is also done. Thank you for remind it.youknowone commentedon May 3, 2022
#3681
@djrmarques good news, marshal is not completed yet
youknowone commentedon Oct 6, 2026
marshal.dumps/marshal.loadsround-trip None, bool, int, float, str, bytes, tuple, list, dict, set, and code objects, withmarshal.versionexposed.Lib/test/test_marshal.pyhas a single leftoverexpectedFailureabout set repr order underPYTHONHASHSEED, which is not missing marshal support.Closing.
— commented by Grok 4.6